@livechat/developer-studio-api 4.1.0 → 5.2.0-generator-beta-v1.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/dist/index.mjs CHANGED
@@ -170,6 +170,11 @@ var extractTokenFromAuthorizationHeader = (headerValue) => {
170
170
  // src/utils/integrations/getIntegrationFlowUrl.ts
171
171
  import { v4 as uuidv4 } from "uuid";
172
172
 
173
+ // ../../../private/utils/src/arrays/notEmpty.ts
174
+ function notEmpty(item) {
175
+ return Boolean(item);
176
+ }
177
+
173
178
  // ../../../private/utils/src/misc/merge-deep.ts
174
179
  function isObject(item) {
175
180
  return item !== null && typeof item === "object" && !Array.isArray(item);
@@ -252,6 +257,7 @@ var IntegrationNames = /* @__PURE__ */ ((IntegrationNames2) => {
252
257
  IntegrationNames2["HelpDesk"] = "text-helpdesk";
253
258
  IntegrationNames2["Slack"] = "slack";
254
259
  IntegrationNames2["Salesforce"] = "salesforce";
260
+ IntegrationNames2["Klaviyo"] = "klaviyo";
255
261
  return IntegrationNames2;
256
262
  })(IntegrationNames || {});
257
263
  var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
@@ -271,6 +277,7 @@ var IntegrationDisplayNames = /* @__PURE__ */ ((IntegrationDisplayNames2) => {
271
277
  IntegrationDisplayNames2["HelpDesk"] = "HelpDesk";
272
278
  IntegrationDisplayNames2["Slack"] = "Slack";
273
279
  IntegrationDisplayNames2["Salesforce"] = "Salesforce";
280
+ IntegrationDisplayNames2["Klaviyo"] = "Klaviyo";
274
281
  return IntegrationDisplayNames2;
275
282
  })(IntegrationDisplayNames || {});
276
283
  var IntegrationDisplayNameToNameMap = Object.keys(IntegrationNames).reduce(
@@ -289,7 +296,7 @@ var IntegrationNameToDisplayMap = Object.keys(IntegrationNames).reduce(
289
296
  );
290
297
 
291
298
  // src/apis/text-intelligence/workflows/adapter/integrations/_contracts/requests/events.ts
292
- import { z as z9 } from "zod";
299
+ import { z as z11 } from "zod";
293
300
 
294
301
  // src/apis/text-intelligence/workflows/adapter/integrations/bigcommerce/_contracts/requests/events.ts
295
302
  import { z as z2 } from "zod";
@@ -626,8 +633,57 @@ var slackEventsZods = {
626
633
  }
627
634
  };
628
635
 
629
- // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/helpdesk.ts
636
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/domains/customer.ts
630
637
  import { z as z7 } from "zod";
638
+ var TextCustomerEventNames = /* @__PURE__ */ ((TextCustomerEventNames2) => {
639
+ TextCustomerEventNames2["EmailSet"] = "customer_email_set";
640
+ TextCustomerEventNames2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
641
+ return TextCustomerEventNames2;
642
+ })(TextCustomerEventNames || {});
643
+ var textCustomerEventsZods = {
644
+ eventName: z7.nativeEnum(TextCustomerEventNames),
645
+ events: {
646
+ emailSet: integrationEventBase.extend({
647
+ name: z7.literal("customer_email_set" /* EmailSet */),
648
+ filters: z7.array(z7.string().min(1)).min(1).optional()
649
+ }),
650
+ propertiesValuesUpdated: integrationEventBase.extend({
651
+ name: z7.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
652
+ properties: z7.array(
653
+ z7.object({
654
+ id: z7.string().min(1),
655
+ to: z7.union([z7.string(), z7.number(), z7.boolean()]).optional()
656
+ })
657
+ ).optional()
658
+ })
659
+ },
660
+ get event() {
661
+ return z7.discriminatedUnion("name", [
662
+ this.events.emailSet,
663
+ this.events.propertiesValuesUpdated
664
+ ]);
665
+ },
666
+ get subscribe() {
667
+ return integrationEventsCoreZods.withCore(
668
+ z7.object({
669
+ event: this.event,
670
+ callback: z7.string()
671
+ })
672
+ );
673
+ },
674
+ get unsubscribe() {
675
+ return integrationEventsCoreZods.withCore(
676
+ z7.object({
677
+ event: z7.object({
678
+ name: this.eventName
679
+ })
680
+ })
681
+ );
682
+ }
683
+ };
684
+
685
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/helpdesk.ts
686
+ import { z as z8 } from "zod";
631
687
 
632
688
  // src/apis/products/helpdesk/_contracts/dtos/ticket.ts
633
689
  var TicketStatus = /* @__PURE__ */ ((TicketStatus2) => {
@@ -655,64 +711,87 @@ var TextHelpDeskEventNames = /* @__PURE__ */ ((TextHelpDeskEventNames2) => {
655
711
  TextHelpDeskEventNames2["TicketTagsChanged"] = "ticket_tags_added";
656
712
  TextHelpDeskEventNames2["TicketFollowersChanged"] = "ticket_followers_added";
657
713
  TextHelpDeskEventNames2["TicketAssignmentChanged"] = "ticket_assignment_added";
714
+ TextHelpDeskEventNames2["TicketCustomFieldsChanged"] = "ticket_custom_fields_changed";
658
715
  TextHelpDeskEventNames2["TicketMessageAdded"] = "ticket_message_added";
659
716
  return TextHelpDeskEventNames2;
660
717
  })(TextHelpDeskEventNames || {});
661
- var assignmentZod = z7.object({
662
- agent: z7.string().optional(),
663
- team: z7.string().optional()
718
+ var assignmentZod = z8.object({
719
+ agent: z8.string().optional(),
720
+ team: z8.string().optional()
664
721
  });
665
- var baseFiltersZod = z7.object({
722
+ var baseFiltersZod = z8.object({
666
723
  assignment: assignmentZod.optional(),
667
- mailbox: z7.string().optional()
724
+ mailbox: z8.string().optional()
668
725
  });
669
726
  var textHelpDeskEventsZods = {
670
- provider: z7.literal("text-helpdesk" /* HelpDesk */),
671
- eventName: z7.nativeEnum(TextHelpDeskEventNames),
727
+ provider: z8.literal("text-helpdesk" /* HelpDesk */),
728
+ eventName: z8.nativeEnum(TextHelpDeskEventNames),
672
729
  events: {
673
730
  ticketCreated: integrationEventBase.extend({
674
- name: z7.literal("ticket_created" /* TicketCreated */)
731
+ name: z8.literal("ticket_created" /* TicketCreated */)
675
732
  }).extend(baseFiltersZod.shape),
676
733
  ticketUpdated: integrationEventBase.extend({
677
- name: z7.literal("ticket_updated" /* TicketUpdated */)
734
+ name: z8.literal("ticket_updated" /* TicketUpdated */)
678
735
  }).extend(baseFiltersZod.shape),
679
736
  ticketStatusChanged: integrationEventBase.extend({
680
- name: z7.literal("ticket_status_changed" /* TicketStatusChanged */),
681
- status: z7.object({
682
- from: z7.array(z7.nativeEnum(TicketStatus)).optional(),
683
- to: z7.array(z7.nativeEnum(TicketStatus)).optional()
737
+ name: z8.literal("ticket_status_changed" /* TicketStatusChanged */),
738
+ status: z8.object({
739
+ from: z8.array(z8.nativeEnum(TicketStatus)).optional(),
740
+ to: z8.array(z8.nativeEnum(TicketStatus)).optional()
684
741
  }).optional()
685
742
  }).extend(baseFiltersZod.shape),
686
743
  ticketPriorityChanged: integrationEventBase.extend({
687
- name: z7.literal("ticket_priority_changed" /* TicketPriorityChanged */),
688
- priority: z7.object({
689
- from: z7.array(z7.nativeEnum(TicketPriority)).optional(),
690
- to: z7.array(z7.nativeEnum(TicketPriority)).optional()
744
+ name: z8.literal("ticket_priority_changed" /* TicketPriorityChanged */),
745
+ priority: z8.object({
746
+ from: z8.array(z8.nativeEnum(TicketPriority)).optional(),
747
+ to: z8.array(z8.nativeEnum(TicketPriority)).optional()
691
748
  }).optional()
692
749
  }).extend(baseFiltersZod.shape),
693
750
  ticketTagsChanged: integrationEventBase.extend({
694
- name: z7.literal("ticket_tags_added" /* TicketTagsChanged */),
695
- tags: z7.object({
696
- from: z7.array(z7.string()).optional(),
697
- to: z7.array(z7.string()).optional()
751
+ name: z8.literal("ticket_tags_added" /* TicketTagsChanged */),
752
+ tags: z8.object({
753
+ from: z8.array(z8.string()).optional(),
754
+ to: z8.array(z8.string()).optional()
698
755
  }).optional()
699
756
  }).extend(baseFiltersZod.shape),
700
757
  ticketFollowersChanged: integrationEventBase.extend({
701
- name: z7.literal("ticket_followers_added" /* TicketFollowersChanged */),
702
- from: z7.array(z7.string()).optional(),
703
- to: z7.array(z7.string()).optional()
758
+ name: z8.literal("ticket_followers_added" /* TicketFollowersChanged */),
759
+ from: z8.array(z8.string()).optional(),
760
+ to: z8.array(z8.string()).optional()
704
761
  }).extend(baseFiltersZod.shape),
705
762
  ticketAssignmentChanged: integrationEventBase.extend({
706
- name: z7.literal("ticket_assignment_added" /* TicketAssignmentChanged */),
707
- from: z7.array(assignmentZod).optional(),
708
- to: z7.array(assignmentZod).optional()
763
+ name: z8.literal("ticket_assignment_added" /* TicketAssignmentChanged */),
764
+ from: z8.array(assignmentZod).optional(),
765
+ to: z8.array(assignmentZod).optional()
766
+ }).extend(baseFiltersZod.shape),
767
+ ticketCustomFieldsChanged: integrationEventBase.extend({
768
+ name: z8.literal("ticket_custom_fields_changed" /* TicketCustomFieldsChanged */),
769
+ customFields: z8.array(
770
+ z8.object({
771
+ id: z8.string().min(1),
772
+ from: z8.string().min(1).optional(),
773
+ to: z8.string().min(1).optional()
774
+ })
775
+ ).optional()
709
776
  }).extend(baseFiltersZod.shape),
710
- ticketMessageAdded: integrationEventBase.extend({
711
- name: z7.literal("ticket_message_added" /* TicketMessageAdded */)
712
- }).extend(baseFiltersZod.shape)
777
+ ticketMessageAdded: z8.discriminatedUnion("version", [
778
+ z8.object({
779
+ name: z8.literal("ticket_message_added" /* TicketMessageAdded */),
780
+ version: z8.undefined()
781
+ }).extend(baseFiltersZod.shape),
782
+ z8.object({
783
+ name: z8.literal("ticket_message_added" /* TicketMessageAdded */),
784
+ version: z8.literal("v1"),
785
+ from: z8.enum(["anyone", "agent", "requester"]).optional(),
786
+ privacy: z8.enum(["any", "public", "private"]).optional(),
787
+ filters: z8.array(z8.string()).optional(),
788
+ caseInsensitive: z8.boolean().optional(),
789
+ matchWholeWords: z8.boolean().optional()
790
+ }).extend(baseFiltersZod.shape)
791
+ ])
713
792
  },
714
793
  get event() {
715
- return z7.discriminatedUnion("name", [
794
+ return z8.union([
716
795
  this.events.ticketCreated,
717
796
  this.events.ticketUpdated,
718
797
  this.events.ticketStatusChanged,
@@ -720,33 +799,34 @@ var textHelpDeskEventsZods = {
720
799
  this.events.ticketTagsChanged,
721
800
  this.events.ticketFollowersChanged,
722
801
  this.events.ticketAssignmentChanged,
723
- this.events.ticketMessageAdded
802
+ this.events.ticketMessageAdded,
803
+ this.events.ticketCustomFieldsChanged
724
804
  ]);
725
805
  },
726
806
  get subscribe() {
727
807
  return integrationEventsCoreZods.withCore(
728
- z7.object({
808
+ z8.object({
729
809
  event: this.event,
730
- callback: z7.string()
810
+ callback: z8.string()
731
811
  })
732
812
  );
733
813
  },
734
814
  get subscribeContent() {
735
- return z7.object({
815
+ return z8.object({
736
816
  provider: this.provider,
737
817
  event: this.event,
738
- callback: z7.string()
818
+ callback: z8.string()
739
819
  });
740
820
  },
741
821
  get unsubscribe() {
742
822
  return integrationEventsCoreZods.withCore(
743
- z7.object({
823
+ z8.object({
744
824
  event: this.event
745
825
  })
746
826
  );
747
827
  },
748
828
  get unsubscribeContent() {
749
- return z7.object({
829
+ return z8.object({
750
830
  provider: this.provider,
751
831
  event: this.event
752
832
  });
@@ -754,7 +834,7 @@ var textHelpDeskEventsZods = {
754
834
  };
755
835
 
756
836
  // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/livechat.ts
757
- import { z as z8 } from "zod";
837
+ import { z as z9 } from "zod";
758
838
  var TextLivechatEventNames = /* @__PURE__ */ ((TextLivechatEventNames2) => {
759
839
  TextLivechatEventNames2["ChatStarted"] = "chat_started";
760
840
  TextLivechatEventNames2["ChatEnded"] = "chat_ended";
@@ -766,6 +846,8 @@ var TextLivechatEventNames = /* @__PURE__ */ ((TextLivechatEventNames2) => {
766
846
  TextLivechatEventNames2["UserAddedToChat"] = "user_added_to_chat";
767
847
  TextLivechatEventNames2["UserRemovedFromChat"] = "user_removed_from_chat";
768
848
  TextLivechatEventNames2["CustomerLeftChat"] = "customer_left_chat";
849
+ TextLivechatEventNames2["ChatIdle"] = "chat_idle";
850
+ TextLivechatEventNames2["ProductCardEvent"] = "product_card_event";
769
851
  return TextLivechatEventNames2;
770
852
  })(TextLivechatEventNames || {});
771
853
  var CustomerLeftChatReason = /* @__PURE__ */ ((CustomerLeftChatReason2) => {
@@ -774,63 +856,78 @@ var CustomerLeftChatReason = /* @__PURE__ */ ((CustomerLeftChatReason2) => {
774
856
  CustomerLeftChatReason2["Inactive"] = "inactive";
775
857
  return CustomerLeftChatReason2;
776
858
  })(CustomerLeftChatReason || {});
859
+ var TextLivechatProductCardEventType = /* @__PURE__ */ ((TextLivechatProductCardEventType2) => {
860
+ TextLivechatProductCardEventType2["ViewProduct"] = "view_product";
861
+ TextLivechatProductCardEventType2["AddToCart"] = "add_to_cart";
862
+ return TextLivechatProductCardEventType2;
863
+ })(TextLivechatProductCardEventType || {});
777
864
  var textLivechatEventsZods = {
778
- provider: z8.literal("text-livechat" /* LiveChat */),
779
- eventName: z8.nativeEnum(TextLivechatEventNames),
865
+ provider: z9.literal("text-livechat" /* LiveChat */),
866
+ eventName: z9.nativeEnum(TextLivechatEventNames),
780
867
  events: {
781
868
  chatStarted: integrationEventBase.extend({
782
- name: z8.literal("chat_started" /* ChatStarted */),
783
- targetAgentId: z8.string().optional()
869
+ name: z9.literal("chat_started" /* ChatStarted */),
870
+ targetAgentId: z9.string().optional()
784
871
  }),
785
872
  chatEnded: integrationEventBase.extend({
786
- name: z8.literal("chat_ended" /* ChatEnded */)
873
+ name: z9.literal("chat_ended" /* ChatEnded */)
787
874
  }),
788
875
  chatTransferred: integrationEventBase.extend({
789
- name: z8.literal("chat_transferred" /* ChatTransferred */),
790
- targetGroups: z8.array(z8.number()).optional(),
791
- targetAgents: z8.array(z8.string()).optional()
876
+ name: z9.literal("chat_transferred" /* ChatTransferred */),
877
+ targetGroups: z9.array(z9.number()).optional(),
878
+ targetAgents: z9.array(z9.string()).optional()
792
879
  }),
793
880
  chatTagged: integrationEventBase.extend({
794
- name: z8.literal("chat_tagged" /* ChatTagged */),
795
- tag: z8.string().optional(),
796
- exact: z8.boolean().optional()
881
+ name: z9.literal("chat_tagged" /* ChatTagged */),
882
+ tag: z9.string().optional(),
883
+ exact: z9.boolean().optional()
797
884
  }),
798
885
  chatRated: integrationEventBase.extend({
799
- name: z8.literal("chat_rated" /* ChatRated */),
800
- rating: z8.enum(["good", "bad", "all"]).optional()
886
+ name: z9.literal("chat_rated" /* ChatRated */),
887
+ rating: z9.enum(["good", "bad", "all"]).optional()
801
888
  }),
802
889
  chatCommented: integrationEventBase.extend({
803
- name: z8.literal("chat_commented" /* ChatCommented */)
890
+ name: z9.literal("chat_commented" /* ChatCommented */)
804
891
  }),
805
- chatMessage: z8.discriminatedUnion("version", [
806
- z8.object({
807
- name: z8.literal("chat_message" /* ChatMessage */),
808
- version: z8.undefined(),
809
- filter: z8.string().optional(),
810
- caseInsensitive: z8.boolean().optional()
892
+ chatMessage: z9.discriminatedUnion("version", [
893
+ z9.object({
894
+ name: z9.literal("chat_message" /* ChatMessage */),
895
+ version: z9.undefined(),
896
+ filter: z9.string().optional(),
897
+ caseInsensitive: z9.boolean().optional(),
898
+ matchWholeWords: z9.boolean().optional()
811
899
  }),
812
- z8.object({
813
- name: z8.literal("chat_message" /* ChatMessage */),
814
- version: z8.literal("v1"),
815
- filters: z8.array(z8.string()),
816
- caseInsensitive: z8.boolean().optional()
900
+ z9.object({
901
+ name: z9.literal("chat_message" /* ChatMessage */),
902
+ version: z9.literal("v1"),
903
+ filters: z9.array(z9.string()),
904
+ caseInsensitive: z9.boolean().optional(),
905
+ matchWholeWords: z9.boolean().optional()
817
906
  })
818
907
  ]),
819
908
  userAddedToChat: integrationEventBase.extend({
820
- name: z8.literal("user_added_to_chat" /* UserAddedToChat */),
821
- userType: z8.enum(["agent", "customer"]).optional(),
822
- targetAgentId: z8.string().optional()
909
+ name: z9.literal("user_added_to_chat" /* UserAddedToChat */),
910
+ userType: z9.enum(["agent", "customer"]).optional(),
911
+ targetAgentId: z9.string().optional()
823
912
  }),
824
913
  userRemovedFromChat: integrationEventBase.extend({
825
- name: z8.literal("user_removed_from_chat" /* UserRemovedFromChat */)
914
+ name: z9.literal("user_removed_from_chat" /* UserRemovedFromChat */)
826
915
  }),
827
916
  customerLeftChat: integrationEventBase.extend({
828
- name: z8.literal("customer_left_chat" /* CustomerLeftChat */),
829
- reasons: z8.array(z8.nativeEnum(CustomerLeftChatReason)).optional()
917
+ name: z9.literal("customer_left_chat" /* CustomerLeftChat */),
918
+ reasons: z9.array(z9.nativeEnum(CustomerLeftChatReason)).optional()
919
+ }),
920
+ chatIdle: integrationEventBase.extend({
921
+ name: z9.literal("chat_idle" /* ChatIdle */)
922
+ }),
923
+ productCardEvent: integrationEventBase.extend({
924
+ name: z9.literal("product_card_event" /* ProductCardEvent */),
925
+ type: z9.nativeEnum(TextLivechatProductCardEventType),
926
+ product_id: z9.string().optional()
830
927
  })
831
928
  },
832
929
  get event() {
833
- return z8.union([
930
+ return z9.union([
834
931
  this.events.chatStarted,
835
932
  this.events.chatEnded,
836
933
  this.events.chatTransferred,
@@ -840,33 +937,72 @@ var textLivechatEventsZods = {
840
937
  this.events.chatMessage,
841
938
  this.events.userAddedToChat,
842
939
  this.events.userRemovedFromChat,
843
- this.events.customerLeftChat
940
+ this.events.customerLeftChat,
941
+ this.events.chatIdle,
942
+ this.events.productCardEvent
844
943
  ]);
845
944
  },
846
945
  get subscribe() {
847
946
  return integrationEventsCoreZods.withCore(
848
- z8.object({
947
+ z9.object({
849
948
  event: this.event,
850
- callback: z8.string()
949
+ callback: z9.string()
851
950
  })
852
951
  );
853
952
  },
854
953
  get subscribeContent() {
855
- return z8.object({
954
+ return z9.object({
856
955
  provider: this.provider,
857
956
  event: this.event,
858
- callback: z8.string()
957
+ callback: z9.string()
859
958
  });
860
959
  },
861
960
  get unsubscribe() {
862
961
  return integrationEventsCoreZods.withCore(
863
- z8.object({
962
+ z9.object({
864
963
  event: this.event
865
964
  })
866
965
  );
867
966
  },
868
967
  get unsubscribeContent() {
869
- return z8.object({
968
+ return z9.object({
969
+ provider: this.provider,
970
+ event: this.event
971
+ });
972
+ }
973
+ };
974
+
975
+ // src/apis/text-intelligence/workflows/adapter/integrations/text/_contracts/requests/events/text.ts
976
+ import { z as z10 } from "zod";
977
+ var textEventsZods = {
978
+ provider: z10.literal("text" /* Text */),
979
+ get event() {
980
+ return textCustomerEventsZods.event;
981
+ },
982
+ get subscribe() {
983
+ return integrationEventsCoreZods.withCore(
984
+ z10.object({
985
+ event: this.event,
986
+ callback: z10.string()
987
+ })
988
+ );
989
+ },
990
+ get subscribeContent() {
991
+ return z10.object({
992
+ provider: this.provider,
993
+ event: this.event,
994
+ callback: z10.string()
995
+ });
996
+ },
997
+ get unsubscribe() {
998
+ return integrationEventsCoreZods.withCore(
999
+ z10.object({
1000
+ event: this.event
1001
+ })
1002
+ );
1003
+ },
1004
+ get unsubscribeContent() {
1005
+ return z10.object({
870
1006
  provider: this.provider,
871
1007
  event: this.event
872
1008
  });
@@ -875,7 +1011,8 @@ var textLivechatEventsZods = {
875
1011
 
876
1012
  // src/apis/text-intelligence/workflows/adapter/integrations/_contracts/requests/events.ts
877
1013
  var integrationEventsZods = {
878
- providerName: z9.enum([
1014
+ providerName: z11.enum([
1015
+ "text" /* Text */,
879
1016
  "text-livechat" /* LiveChat */,
880
1017
  "text-helpdesk" /* HelpDesk */,
881
1018
  "mailchimp" /* Mailchimp */,
@@ -885,11 +1022,12 @@ var integrationEventsZods = {
885
1022
  "bigcommerce" /* BigCommerce */
886
1023
  ]),
887
1024
  get event() {
888
- return textLivechatEventsZods.event.or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event).or(slackEventsZods.event);
1025
+ return textEventsZods.event.or(textLivechatEventsZods.event).or(textHelpDeskEventsZods.event).or(shopifyEventsZods.event).or(mailchimpEventsZods.event).or(hubspotEventsZods.event).or(bigcommerceEventsZods.event).or(slackEventsZods.event);
889
1026
  },
890
1027
  get subscribe() {
891
1028
  return integrationEventsCoreZods.withCore(
892
- z9.discriminatedUnion("provider", [
1029
+ z11.discriminatedUnion("provider", [
1030
+ textEventsZods.subscribeContent,
893
1031
  textLivechatEventsZods.subscribeContent,
894
1032
  textHelpDeskEventsZods.subscribeContent,
895
1033
  shopifyEventsZods.subscribeContent,
@@ -902,7 +1040,8 @@ var integrationEventsZods = {
902
1040
  },
903
1041
  get unsubscribe() {
904
1042
  return integrationEventsCoreZods.withCore(
905
- z9.discriminatedUnion("provider", [
1043
+ z11.discriminatedUnion("provider", [
1044
+ textEventsZods.unsubscribeContent,
906
1045
  textLivechatEventsZods.unsubscribeContent,
907
1046
  textHelpDeskEventsZods.unsubscribeContent,
908
1047
  shopifyEventsZods.unsubscribeContent,
@@ -2067,19 +2206,17 @@ var mailchimpApi = {
2067
2206
  },
2068
2207
  getMetadata(_0) {
2069
2208
  return __async(this, arguments, function* ({ token }) {
2070
- const {
2071
- data: { dc: server }
2072
- } = yield axios7.get(
2073
- "https://login.mailchimp.com/oauth2/metadata",
2074
- {
2075
- headers: {
2076
- "Content-Type": "application/json",
2077
- Authorization: `OAuth ${token}`
2078
- }
2209
+ var _a, _b, _c, _d;
2210
+ const { data } = yield axios7.get("https://login.mailchimp.com/oauth2/metadata", {
2211
+ headers: {
2212
+ "Content-Type": "application/json",
2213
+ Authorization: `OAuth ${token}`
2079
2214
  }
2080
- );
2215
+ });
2216
+ const email = (_d = (_c = (_a = data.login) == null ? void 0 : _a.email) != null ? _c : (_b = data.login) == null ? void 0 : _b.login_email) != null ? _d : data.accountname;
2081
2217
  return {
2082
- server
2218
+ server: data.dc,
2219
+ email
2083
2220
  };
2084
2221
  });
2085
2222
  }
@@ -3214,7 +3351,8 @@ var salesforceApi = {
3214
3351
  const url = new URL(data.profile);
3215
3352
  const instance_url = url.origin;
3216
3353
  return {
3217
- instance_url
3354
+ instance_url,
3355
+ email: data.email
3218
3356
  };
3219
3357
  });
3220
3358
  }
@@ -3834,12 +3972,13 @@ var textPlatformWorkflowsCredentialsApi = {
3834
3972
  });
3835
3973
  });
3836
3974
  },
3837
- connect(id, code, authorization) {
3975
+ connect(id, code, codeVerifier, authorization) {
3838
3976
  return __async(this, null, function* () {
3839
3977
  return textClientInstance.put(
3840
3978
  urls2.connect(id),
3841
3979
  {
3842
- code
3980
+ code,
3981
+ code_verifier: codeVerifier
3843
3982
  },
3844
3983
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
3845
3984
  ensureAuthorizationToken: true
@@ -4077,7 +4216,7 @@ var OauthCredentialGrantType = /* @__PURE__ */ ((OauthCredentialGrantType2) => {
4077
4216
  })(OauthCredentialGrantType || {});
4078
4217
 
4079
4218
  // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/base.ts
4080
- var WorkflowDefinitionTaskType = {
4219
+ var WorkflowTaskType = {
4081
4220
  http: "HTTP",
4082
4221
  switch: "SWITCH",
4083
4222
  forkJoin: "FORK_JOIN",
@@ -4089,23 +4228,23 @@ var WorkflowDefinitionTaskType = {
4089
4228
  inline: "INLINE",
4090
4229
  transform: "JSON_JQ_TRANSFORM"
4091
4230
  };
4092
- var WorkflowDefinitionCustomTaskName = {
4231
+ var WorkflowCustomTaskName = {
4093
4232
  // SWITCH
4094
- condition: `${WorkflowDefinitionTaskType.switch}_IF`,
4095
- switchCase: `${WorkflowDefinitionTaskType.switch}_CASE`,
4233
+ condition: `${WorkflowTaskType.switch}_IF`,
4234
+ switchCase: `${WorkflowTaskType.switch}_CASE`,
4096
4235
  // SIMPLE
4097
4236
  action: "action",
4098
4237
  awaitAgent: "await",
4099
4238
  notifyAgent: "notify_ai_agent",
4100
4239
  reasoning: "reasoning",
4101
4240
  // DO WHILE
4102
- loop: `${WorkflowDefinitionTaskType.doWhile}_LOOP`,
4103
- forEach: `${WorkflowDefinitionTaskType.doWhile}_FOR_EACH`,
4241
+ loop: `${WorkflowTaskType.doWhile}_LOOP`,
4242
+ forEach: `${WorkflowTaskType.doWhile}_FOR_EACH`,
4104
4243
  // INLINE
4105
- script: `${WorkflowDefinitionTaskType.inline}_SCRIPT`,
4244
+ script: `${WorkflowTaskType.inline}_SCRIPT`,
4106
4245
  // JQ TRANSFORM
4107
- convert: `${WorkflowDefinitionTaskType.transform}_CONVERT`,
4108
- construct: `${WorkflowDefinitionTaskType.transform}_CONSTRUCT`
4246
+ convert: `${WorkflowTaskType.transform}_CONVERT`,
4247
+ construct: `${WorkflowTaskType.transform}_CONSTRUCT`
4109
4248
  };
4110
4249
  var WorkflowExecutionTaskStatus = /* @__PURE__ */ ((WorkflowExecutionTaskStatus2) => {
4111
4250
  WorkflowExecutionTaskStatus2["Completed"] = "COMPLETED";
@@ -4121,6 +4260,11 @@ var WorkflowExecutionTaskStatus = /* @__PURE__ */ ((WorkflowExecutionTaskStatus2
4121
4260
  return WorkflowExecutionTaskStatus2;
4122
4261
  })(WorkflowExecutionTaskStatus || {});
4123
4262
 
4263
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/http.ts
4264
+ function isWorkflowBaseHttpTaskCore(task) {
4265
+ return task.name === WorkflowTaskType.http;
4266
+ }
4267
+
4124
4268
  // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/tasks/switch/variants/condition.ts
4125
4269
  var WorkflowConditionTaskLogic = /* @__PURE__ */ ((WorkflowConditionTaskLogic2) => {
4126
4270
  WorkflowConditionTaskLogic2["AND"] = "AND";
@@ -4204,6 +4348,9 @@ var WorkflowTriggerType = {
4204
4348
  webhookManual: "webhook_manual"
4205
4349
  };
4206
4350
 
4351
+ // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowElement.ts
4352
+ var TRIGGER_REFERENCE_NAME = "trigger";
4353
+
4207
4354
  // src/apis/integrations/text/platform/workflow/workflows/_contracts/dtos/workflowExecution.ts
4208
4355
  var WorkflowExecutionStatus = /* @__PURE__ */ ((WorkflowExecutionStatus2) => {
4209
4356
  WorkflowExecutionStatus2["Succeeded"] = "succeeded";
@@ -4429,82 +4576,395 @@ function getWorkflowApiCrmConfig(authorization) {
4429
4576
  });
4430
4577
  }
4431
4578
 
4432
- // src/apis/integrations/vercel/instance.ts
4433
- import axios20 from "axios";
4434
- function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
4435
- if (req.headers instanceof Headers) {
4436
- return {
4437
- token: req.headers.get(`${headerPrefix}-token`)
4438
- };
4439
- }
4440
- return {
4441
- token: req.headers[`${headerPrefix}-token`]
4442
- };
4443
- }
4444
- var vercelClientInstance = axios20.create({
4445
- baseURL: "https://api.vercel.com"
4446
- });
4447
- vercelClientInstance.interceptors.response.use(
4448
- (r) => r,
4449
- (error) => {
4450
- var _a, _b;
4451
- if (axios20.isAxiosError(error)) {
4452
- if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
4453
- throw new UnauthorizeApiError("vercel");
4579
+ // src/apis/integrations/text/platform/workflow/workflows/internal/crm/api.ts
4580
+ var getUrl3 = (segments = []) => buildUrlFromSegments(segments, "/internal/crm");
4581
+ var urls4 = {
4582
+ getOrganizations: (queryParams) => enrichUrlWithQueryParams(getUrl3(["stats"]), queryParams),
4583
+ getOrganization: (organizationId) => getUrl3(["stats", organizationId]),
4584
+ getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl3(["workflows"]), queryParams),
4585
+ getWorkflow: (id) => getUrl3(["workflows", id]),
4586
+ getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
4587
+ getUrl3(["workflows", id, "executions"]),
4588
+ queryParams
4589
+ ),
4590
+ getWorkflowExecution: (id, executionId) => getUrl3(["workflows", id, "executions", executionId]),
4591
+ getWorkflowIntrospection: (id) => getUrl3(["workflows", id, "metadata"])
4592
+ };
4593
+ var textPlatformWorkflowsInternalCrmApi = {
4594
+ meta: {
4595
+ urls: urls4
4596
+ },
4597
+ getOrganizations(queryParams, authorization) {
4598
+ return __async(this, null, function* () {
4599
+ const { data: organizations } = yield textClientInstance.get(
4600
+ urls4.getOrganizations(queryParams),
4601
+ getWorkflowApiCrmConfig(authorization)
4602
+ );
4603
+ return organizations;
4604
+ });
4605
+ },
4606
+ getOrganization(organizationId, authorization) {
4607
+ return __async(this, null, function* () {
4608
+ const { data: organization } = yield textClientInstance.get(
4609
+ urls4.getOrganization(organizationId),
4610
+ getWorkflowApiCrmConfig(authorization)
4611
+ );
4612
+ return organization;
4613
+ });
4614
+ },
4615
+ getWorkflows(queryParams, authorization) {
4616
+ return __async(this, null, function* () {
4617
+ const { data: workflows } = yield textClientInstance.get(urls4.getWorkflows(queryParams), getWorkflowApiCrmConfig(authorization));
4618
+ workflows.data = workflows.data.map(enrichWorkflowTrigger);
4619
+ return workflows;
4620
+ });
4621
+ },
4622
+ getWorkflow(workflowId, authorization) {
4623
+ return __async(this, null, function* () {
4624
+ const searchParams = new URLSearchParams();
4625
+ const query = searchParams.toString();
4626
+ const { data: workflow } = yield textClientInstance.get(
4627
+ `${urls4.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
4628
+ getWorkflowApiCrmConfig(authorization)
4629
+ );
4630
+ return enrichWorkflowTrigger(workflow);
4631
+ });
4632
+ },
4633
+ getWorkflowExecutions(workflowId, queryParams, authorization) {
4634
+ return __async(this, null, function* () {
4635
+ const { data: executions } = yield textClientInstance.get(
4636
+ urls4.getWorkflowExecutions(workflowId, queryParams),
4637
+ getWorkflowApiCrmConfig(authorization)
4638
+ );
4639
+ return executions;
4640
+ });
4641
+ },
4642
+ getWorkflowExecution(workflowId, executionId, authorization) {
4643
+ return __async(this, null, function* () {
4644
+ const { data: execution } = yield textClientInstance.get(
4645
+ urls4.getWorkflowExecution(workflowId, executionId),
4646
+ getWorkflowApiCrmConfig(authorization)
4647
+ );
4648
+ return execution;
4649
+ });
4650
+ },
4651
+ getWorkflowIntrospection(workflowId, version, authorization) {
4652
+ return __async(this, null, function* () {
4653
+ const searchParams = new URLSearchParams();
4654
+ if (version) {
4655
+ searchParams.append("version", `${version}`);
4454
4656
  }
4455
- }
4456
- throw error;
4657
+ const query = searchParams.toString();
4658
+ const { data: introspection } = yield textClientInstance.get(
4659
+ `${urls4.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
4660
+ getWorkflowApiCrmConfig(authorization)
4661
+ );
4662
+ return {
4663
+ tasks: introspection
4664
+ };
4665
+ });
4457
4666
  }
4458
- );
4459
- function getVercelClientConfig(options = {}) {
4460
- var _a;
4461
- const currentHeaders = vercelClientInstance.defaults.headers;
4462
- const config = {
4463
- authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
4464
- };
4465
- if (options.ensureAuthorizationToken && !config.authorization) {
4466
- throw new UnauthorizeApiError("vercel");
4667
+ };
4668
+
4669
+ // src/apis/integrations/text/platform/workflow/workflows/internal/api.ts
4670
+ var textPlatformWorkflowsInternalApi = {
4671
+ crm: textPlatformWorkflowsInternalCrmApi
4672
+ };
4673
+
4674
+ // src/apis/integrations/text/platform/workflow/workflows/api.ts
4675
+ var enrichWorkflowTrigger = (workflow) => {
4676
+ var _a, _b, _c, _d, _e, _f, _g, _h;
4677
+ if (((_a = workflow.trigger) == null ? void 0 : _a.type) === WorkflowTriggerType.webhook) {
4678
+ workflow.trigger.name = (_c = workflow.trigger.sub_type) != null ? _c : `${workflow.trigger.webhook.source}-${(_b = workflow.trigger.webhook.event) == null ? void 0 : _b.name}`;
4467
4679
  }
4468
- return {
4469
- headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
4470
- };
4471
- }
4472
- function initVercelClient(token) {
4473
- if (token) {
4474
- updateVercelClient(token);
4680
+ if (((_d = workflow.trigger) == null ? void 0 : _d.type) === WorkflowTriggerType.webhookManual) {
4681
+ workflow.trigger.name = "webhook_manual";
4475
4682
  }
4476
- }
4477
- function updateVercelClient(token) {
4478
- const headers = vercelClientInstance.defaults.headers;
4479
- if (token) {
4480
- headers.Authorization = `Bearer ${token}`;
4481
- } else {
4482
- delete headers.Authorization;
4683
+ if (((_e = workflow.trigger) == null ? void 0 : _e.type) === WorkflowTriggerType.manual) {
4684
+ workflow.trigger.name = "manual";
4483
4685
  }
4484
- }
4485
-
4486
- // src/apis/platform/accounts/instance.ts
4487
- var AccountsApiError = class extends ApiErrorBase {
4488
- constructor() {
4489
- super(...arguments);
4490
- this.name = "accounts";
4686
+ if (((_f = workflow.trigger) == null ? void 0 : _f.type) === WorkflowTriggerType.agent) {
4687
+ workflow.trigger.name = "ai_agent";
4491
4688
  }
4492
- };
4493
- var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
4494
- constructor(message) {
4495
- super("accounts", message);
4689
+ if (((_g = workflow.trigger) == null ? void 0 : _g.type) === WorkflowTriggerType.recurring) {
4690
+ workflow.trigger.name = "scheduled";
4496
4691
  }
4497
- };
4498
- var AccountApiClient = class extends ApiClient {
4499
- constructor() {
4500
- super(...arguments);
4501
- this.UnauthorizedError = UnauthorizeAccountsApiError;
4502
- this.Error = AccountsApiError;
4503
- this.options = {
4504
- headers: {
4505
- "Content-Type": "application/json"
4506
- }
4507
- };
4692
+ if (((_h = workflow.trigger) == null ? void 0 : _h.type) === WorkflowTriggerType.oneTime) {
4693
+ workflow.trigger.name = "one_time";
4694
+ }
4695
+ return workflow;
4696
+ };
4697
+ var getUrl4 = (segments = [], version) => buildUrlFromSegments(
4698
+ segments,
4699
+ `/workflow_platform/${version ? `${version}/` : ""}workflows`
4700
+ );
4701
+ var urls5 = {
4702
+ getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl4([], "v1.0" /* V1 */), queryParams),
4703
+ createWorkflow: () => getUrl4(),
4704
+ getWorkflow: (id) => getUrl4([id], "v1.0" /* V1 */),
4705
+ updateWorkflow: (id) => getUrl4([id]),
4706
+ deleteWorkflow: (id) => getUrl4([id]),
4707
+ createWorkflowDraft: (id) => getUrl4([id, "draft"]),
4708
+ publishWorkflowDraft: (id) => getUrl4([id, "publish"]),
4709
+ toggleWorkflowActivation: (id) => getUrl4([id, "activation"]),
4710
+ executeWorkflow: (id) => getUrl4([id, "executions"]),
4711
+ getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
4712
+ getUrl4([id, "executions"], "v1.0" /* V1 */),
4713
+ queryParams
4714
+ ),
4715
+ getWorkflowExecution: (id, executionId) => getUrl4([id, "executions", executionId], "v1.0" /* V1 */),
4716
+ getWorkflowIntrospection: (id) => getUrl4([id, "metadata"], "v1.0" /* V1 */),
4717
+ introspectWorkflowTask: (id) => getUrl4([id, "run_task"], "v1.0" /* V1 */)
4718
+ };
4719
+ var textPlatformWorkflowsApi = {
4720
+ internal: textPlatformWorkflowsInternalApi,
4721
+ meta: {
4722
+ urls: urls5
4723
+ },
4724
+ getWorkflows(queryParams, authorization) {
4725
+ return __async(this, null, function* () {
4726
+ const { data: workflows } = yield textClientInstance.get(
4727
+ urls5.getWorkflows(queryParams),
4728
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4729
+ ensureAuthorizationToken: true
4730
+ }))
4731
+ );
4732
+ workflows.data = workflows.data.map(enrichWorkflowTrigger);
4733
+ return workflows;
4734
+ });
4735
+ },
4736
+ getWorkflow(workflowId, version, authorization) {
4737
+ return __async(this, null, function* () {
4738
+ const searchParams = new URLSearchParams();
4739
+ if (version) {
4740
+ searchParams.append("version", `${version}`);
4741
+ }
4742
+ const query = searchParams.toString();
4743
+ const { data: workflow } = yield textClientInstance.get(
4744
+ `${urls5.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
4745
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4746
+ ensureAuthorizationToken: true
4747
+ }))
4748
+ );
4749
+ return enrichWorkflowTrigger(workflow);
4750
+ });
4751
+ },
4752
+ createWorkflow(payload, authorization) {
4753
+ return __async(this, null, function* () {
4754
+ return textClientInstance.post(
4755
+ urls5.createWorkflow(),
4756
+ __spreadProps(__spreadValues({}, payload), {
4757
+ trigger: payload.trigger || {}
4758
+ }),
4759
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4760
+ ensureAuthorizationToken: true
4761
+ }))
4762
+ );
4763
+ });
4764
+ },
4765
+ updateWorkflow(workflowId, payload, authorization) {
4766
+ return __async(this, null, function* () {
4767
+ return textClientInstance.put(
4768
+ urls5.updateWorkflow(workflowId),
4769
+ __spreadProps(__spreadValues({}, payload), {
4770
+ trigger: payload.trigger || {}
4771
+ }),
4772
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4773
+ ensureAuthorizationToken: true
4774
+ }))
4775
+ );
4776
+ });
4777
+ },
4778
+ deleteWorkflow(workflowId, authorization) {
4779
+ return __async(this, null, function* () {
4780
+ return textClientInstance.delete(urls5.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4781
+ ensureAuthorizationToken: true
4782
+ }))));
4783
+ });
4784
+ },
4785
+ createWorkflowDraft(workflowId, payload, authorization) {
4786
+ return __async(this, null, function* () {
4787
+ return textClientInstance.post(
4788
+ urls5.createWorkflowDraft(workflowId),
4789
+ __spreadProps(__spreadValues({}, payload), {
4790
+ trigger: payload.trigger || {}
4791
+ }),
4792
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4793
+ ensureAuthorizationToken: true
4794
+ }))
4795
+ );
4796
+ });
4797
+ },
4798
+ publishWorkflowDraft(workflowId, authorization) {
4799
+ return __async(this, null, function* () {
4800
+ return textClientInstance.post(
4801
+ urls5.publishWorkflowDraft(workflowId),
4802
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4803
+ ensureAuthorizationToken: true
4804
+ }))
4805
+ );
4806
+ });
4807
+ },
4808
+ toggleWorkflowActivation(workflowId, isActive, authorization) {
4809
+ return __async(this, null, function* () {
4810
+ return textClientInstance.put(
4811
+ urls5.toggleWorkflowActivation(workflowId),
4812
+ {
4813
+ active: isActive
4814
+ },
4815
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4816
+ ensureAuthorizationToken: true
4817
+ }))
4818
+ );
4819
+ });
4820
+ },
4821
+ executeWorkflow(workflowId, input, authorization) {
4822
+ return __async(this, null, function* () {
4823
+ const { data: execution } = yield textClientInstance.post(
4824
+ urls5.executeWorkflow(workflowId),
4825
+ {
4826
+ input
4827
+ },
4828
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4829
+ ensureAuthorizationToken: true
4830
+ }))
4831
+ );
4832
+ return execution;
4833
+ });
4834
+ },
4835
+ getWorkflowExecutions(workflowId, queryParams, authorization) {
4836
+ return __async(this, null, function* () {
4837
+ const { data: executions } = yield textClientInstance.get(
4838
+ urls5.getWorkflowExecutions(workflowId, queryParams),
4839
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4840
+ ensureAuthorizationToken: true
4841
+ }))
4842
+ );
4843
+ return executions;
4844
+ });
4845
+ },
4846
+ getWorkflowExecution(workflowId, executionId, authorization) {
4847
+ return __async(this, null, function* () {
4848
+ const { data: execution } = yield textClientInstance.get(
4849
+ urls5.getWorkflowExecution(workflowId, executionId),
4850
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4851
+ ensureAuthorizationToken: true
4852
+ }))
4853
+ );
4854
+ return execution;
4855
+ });
4856
+ },
4857
+ getWorkflowIntrospection(workflowId, version, authorization) {
4858
+ return __async(this, null, function* () {
4859
+ const searchParams = new URLSearchParams();
4860
+ if (version) {
4861
+ searchParams.append("version", `${version}`);
4862
+ }
4863
+ const query = searchParams.toString();
4864
+ const { data: introspection } = yield textClientInstance.get(
4865
+ `${urls5.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
4866
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4867
+ ensureAuthorizationToken: true
4868
+ }))
4869
+ );
4870
+ return {
4871
+ tasks: introspection
4872
+ };
4873
+ });
4874
+ },
4875
+ introspectWorkflowTask(workflowId, payload, authorization) {
4876
+ return __async(this, null, function* () {
4877
+ const response = yield textClientInstance.post(
4878
+ urls5.introspectWorkflowTask(workflowId),
4879
+ {
4880
+ task_reference_name: payload.taskReferenceName,
4881
+ input_parameters: payload.inputParameters
4882
+ },
4883
+ getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
4884
+ ensureAuthorizationToken: true
4885
+ }))
4886
+ );
4887
+ return response.data;
4888
+ });
4889
+ }
4890
+ };
4891
+
4892
+ // src/apis/integrations/vercel/instance.ts
4893
+ import axios20 from "axios";
4894
+ function getVercelClientAuthorization(req, headerPrefix = "x-adapter-vercel") {
4895
+ if (req.headers instanceof Headers) {
4896
+ return {
4897
+ token: req.headers.get(`${headerPrefix}-token`)
4898
+ };
4899
+ }
4900
+ return {
4901
+ token: req.headers[`${headerPrefix}-token`]
4902
+ };
4903
+ }
4904
+ var vercelClientInstance = axios20.create({
4905
+ baseURL: "https://api.vercel.com"
4906
+ });
4907
+ vercelClientInstance.interceptors.response.use(
4908
+ (r) => r,
4909
+ (error) => {
4910
+ var _a, _b;
4911
+ if (axios20.isAxiosError(error)) {
4912
+ if (((_a = error.response) == null ? void 0 : _a.status) === 401 || ((_b = error.response) == null ? void 0 : _b.status) === 403) {
4913
+ throw new UnauthorizeApiError("vercel");
4914
+ }
4915
+ }
4916
+ throw error;
4917
+ }
4918
+ );
4919
+ function getVercelClientConfig(options = {}) {
4920
+ var _a;
4921
+ const currentHeaders = vercelClientInstance.defaults.headers;
4922
+ const config = {
4923
+ authorization: (_a = options.token ? `Bearer ${options.token}` : void 0) != null ? _a : currentHeaders.Authorization
4924
+ };
4925
+ if (options.ensureAuthorizationToken && !config.authorization) {
4926
+ throw new UnauthorizeApiError("vercel");
4927
+ }
4928
+ return {
4929
+ headers: __spreadValues({}, config.authorization ? { Authorization: config.authorization } : {})
4930
+ };
4931
+ }
4932
+ function initVercelClient(token) {
4933
+ if (token) {
4934
+ updateVercelClient(token);
4935
+ }
4936
+ }
4937
+ function updateVercelClient(token) {
4938
+ const headers = vercelClientInstance.defaults.headers;
4939
+ if (token) {
4940
+ headers.Authorization = `Bearer ${token}`;
4941
+ } else {
4942
+ delete headers.Authorization;
4943
+ }
4944
+ }
4945
+
4946
+ // src/apis/platform/accounts/instance.ts
4947
+ var AccountsApiError = class extends ApiErrorBase {
4948
+ constructor() {
4949
+ super(...arguments);
4950
+ this.name = "accounts";
4951
+ }
4952
+ };
4953
+ var UnauthorizeAccountsApiError = class extends UnauthorizeApiError {
4954
+ constructor(message) {
4955
+ super("accounts", message);
4956
+ }
4957
+ };
4958
+ var AccountApiClient = class extends ApiClient {
4959
+ constructor() {
4960
+ super(...arguments);
4961
+ this.UnauthorizedError = UnauthorizeAccountsApiError;
4962
+ this.Error = AccountsApiError;
4963
+ this.options = {
4964
+ headers: {
4965
+ "Content-Type": "application/json"
4966
+ }
4967
+ };
4508
4968
  }
4509
4969
  };
4510
4970
  var platformAccountsClientInstance = new AccountApiClient({
@@ -4553,6 +5013,42 @@ function initBillingClient(baseUrl, token) {
4553
5013
  }
4554
5014
  }
4555
5015
 
5016
+ // src/apis/platform/cdp/events/_contracts/payloads/events.ts
5017
+ import { z as z12 } from "zod";
5018
+ var CdpCustomerEventType = /* @__PURE__ */ ((CdpCustomerEventType2) => {
5019
+ CdpCustomerEventType2["EmailSet"] = "customer_email_set";
5020
+ CdpCustomerEventType2["PropertiesValuesUpdated"] = "customer_properties_values_updated";
5021
+ return CdpCustomerEventType2;
5022
+ })(CdpCustomerEventType || {});
5023
+ var customerMetadataZod = z12.object({
5024
+ organization_id: z12.string(),
5025
+ customer_id: z12.string(),
5026
+ master_id: z12.string()
5027
+ });
5028
+ var cdpCustomerEventMessageZod = z12.discriminatedUnion("type", [
5029
+ z12.object({
5030
+ id: z12.string(),
5031
+ type: z12.literal("customer_email_set" /* EmailSet */),
5032
+ data: customerMetadataZod.extend({
5033
+ email: z12.string()
5034
+ }).passthrough()
5035
+ }),
5036
+ z12.object({
5037
+ id: z12.string(),
5038
+ type: z12.literal("customer_properties_values_updated" /* PropertiesValuesUpdated */),
5039
+ data: customerMetadataZod.extend({
5040
+ customer_properties: z12.record(
5041
+ z12.object({
5042
+ value: z12.unknown(),
5043
+ last_updated_at: z12.string(),
5044
+ last_updated_agent_account_id: z12.string().optional(),
5045
+ last_updated_agent_client_id: z12.string().optional()
5046
+ }).passthrough()
5047
+ )
5048
+ }).passthrough()
5049
+ })
5050
+ ]);
5051
+
4556
5052
  // src/apis/platform/console/instance.ts
4557
5053
  import axios22 from "axios";
4558
5054
  var REGION = {
@@ -4883,6 +5379,7 @@ var HelpDeskWebhookEventType = /* @__PURE__ */ ((HelpDeskWebhookEventType2) => {
4883
5379
  HelpDeskWebhookEventType2["TicketTagsChanged"] = "tickets.events.tags";
4884
5380
  HelpDeskWebhookEventType2["TicketFollowersChanged"] = "tickets.events.followers";
4885
5381
  HelpDeskWebhookEventType2["TicketAssignmentChanged"] = "tickets.events.assignment";
5382
+ HelpDeskWebhookEventType2["TicketCustomFieldsChanged"] = "tickets.events.customFields";
4886
5383
  HelpDeskWebhookEventType2["TicketMessageAdded"] = "tickets.events.message";
4887
5384
  return HelpDeskWebhookEventType2;
4888
5385
  })(HelpDeskWebhookEventType || {});
@@ -4896,6 +5393,7 @@ var LivechatWebhookActions = /* @__PURE__ */ ((LivechatWebhookActions2) => {
4896
5393
  LivechatWebhookActions2["UserAddedToChat"] = "user_added_to_chat";
4897
5394
  LivechatWebhookActions2["UserRemovedFromChat"] = "user_removed_from_chat";
4898
5395
  LivechatWebhookActions2["IncomingEvent"] = "incoming_event";
5396
+ LivechatWebhookActions2["IncomingRichMessagePostback"] = "incoming_rich_message_postback";
4899
5397
  LivechatWebhookActions2["ThreadTagged"] = "thread_tagged";
4900
5398
  LivechatWebhookActions2["ThreadUntagged"] = "thread_untagged";
4901
5399
  LivechatWebhookActions2["IncomingCustomer"] = "incoming_customer";
@@ -4918,6 +5416,7 @@ var LivechatWebhookSystemMessages = /* @__PURE__ */ ((LivechatWebhookSystemMessa
4918
5416
  LivechatWebhookSystemMessages2["ChatArchivedCustomerManual"] = "manual_archived_customer";
4919
5417
  LivechatWebhookSystemMessages2["ChatArchivedCustomerDisconnected"] = "archived_customer_disconnected";
4920
5418
  LivechatWebhookSystemMessages2["ChatArchivedInactive"] = "routing.archived_inactive";
5419
+ LivechatWebhookSystemMessages2["ChatIdle"] = "routing.idle";
4921
5420
  return LivechatWebhookSystemMessages2;
4922
5421
  })(LivechatWebhookSystemMessages || {});
4923
5422
 
@@ -4999,40 +5498,40 @@ function initLiveChatClient(baseUrl, token) {
4999
5498
  }
5000
5499
 
5001
5500
  // src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/dtos/notification.ts
5002
- import { z as z10 } from "zod";
5501
+ import { z as z13 } from "zod";
5003
5502
  var integrationNotificationZods = {
5004
- notification: z10.object({
5005
- id: z10.string(),
5006
- jobId: z10.string().nullable(),
5007
- subscription_id: z10.string(),
5008
- organization_id: z10.string(),
5009
- user_id: z10.string().nullable(),
5010
- source: z10.string().nullable(),
5011
- sourceKey: z10.string().nullable(),
5012
- target: z10.string(),
5013
- targetKey: z10.string(),
5014
- eventName: z10.string(),
5015
- callback: z10.string(),
5016
- status: z10.string(),
5017
- statusCode: z10.number().nullable(),
5018
- attempts: z10.number(),
5019
- error: z10.string().nullable(),
5020
- enqueuedAt: z10.string(),
5021
- completedAt: z10.string()
5503
+ notification: z13.object({
5504
+ id: z13.string(),
5505
+ jobId: z13.string().nullable(),
5506
+ subscription_id: z13.string(),
5507
+ organization_id: z13.string(),
5508
+ user_id: z13.string().nullable(),
5509
+ source: z13.string().nullable(),
5510
+ sourceKey: z13.string().nullable(),
5511
+ target: z13.string(),
5512
+ targetKey: z13.string(),
5513
+ eventName: z13.string(),
5514
+ callback: z13.string(),
5515
+ status: z13.string(),
5516
+ statusCode: z13.number().nullable(),
5517
+ attempts: z13.number(),
5518
+ error: z13.string().nullable(),
5519
+ enqueuedAt: z13.string(),
5520
+ completedAt: z13.string()
5022
5521
  })
5023
5522
  };
5024
5523
 
5025
5524
  // src/apis/text-intelligence/workflows/adapter/admin/events/notifications/_contracts/requests/notifications.ts
5026
- import { z as z11 } from "zod";
5525
+ import { z as z14 } from "zod";
5027
5526
  var integrationNotificationRequestZods = {
5028
- getNotifications: z11.object({
5029
- target: z11.string().optional(),
5030
- status: z11.string().optional(),
5031
- eventName: z11.string().optional(),
5032
- search: z11.string().optional(),
5033
- page: z11.number().optional(),
5034
- size: z11.number().optional(),
5035
- order_by: z11.enum([
5527
+ getNotifications: z14.object({
5528
+ target: z14.string().optional(),
5529
+ status: z14.string().optional(),
5530
+ eventName: z14.string().optional(),
5531
+ search: z14.string().optional(),
5532
+ page: z14.number().optional(),
5533
+ size: z14.number().optional(),
5534
+ order_by: z14.enum([
5036
5535
  "id",
5037
5536
  "status",
5038
5537
  "target",
@@ -5041,60 +5540,60 @@ var integrationNotificationRequestZods = {
5041
5540
  "organization_id",
5042
5541
  "user_id"
5043
5542
  ]).optional(),
5044
- order: z11.enum(["asc", "desc"]).optional()
5543
+ order: z14.enum(["asc", "desc"]).optional()
5045
5544
  })
5046
5545
  };
5047
5546
 
5048
5547
  // src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/dtos/subscription.ts
5049
- import { z as z12 } from "zod";
5548
+ import { z as z15 } from "zod";
5050
5549
  var integrationSubscriptionZods = {
5051
- subscription: z12.object({
5052
- id: z12.string(),
5053
- organization_id: z12.string(),
5054
- user_id: z12.string(),
5055
- callback: z12.string(),
5056
- source: z12.string(),
5057
- sourceKey: z12.string(),
5058
- target: z12.string(),
5059
- targets: z12.array(
5060
- z12.object({
5061
- id: z12.string(),
5062
- target: z12.string(),
5063
- targetKey: z12.string()
5550
+ subscription: z15.object({
5551
+ id: z15.string(),
5552
+ organization_id: z15.string(),
5553
+ user_id: z15.string(),
5554
+ callback: z15.string(),
5555
+ source: z15.string(),
5556
+ sourceKey: z15.string(),
5557
+ target: z15.string(),
5558
+ targets: z15.array(
5559
+ z15.object({
5560
+ id: z15.string(),
5561
+ target: z15.string(),
5562
+ targetKey: z15.string()
5064
5563
  })
5065
5564
  ).optional(),
5066
- event: z12.unknown(),
5067
- orphaned_at: z12.string().datetime().nullable(),
5068
- orphaned_reason: z12.string().nullable(),
5069
- orphaned_last_hit: z12.string().datetime().nullable(),
5070
- orphaned_hit_count: z12.number()
5565
+ event: z15.unknown(),
5566
+ orphaned_at: z15.string().datetime().nullable(),
5567
+ orphaned_reason: z15.string().nullable(),
5568
+ orphaned_last_hit: z15.string().datetime().nullable(),
5569
+ orphaned_hit_count: z15.number()
5071
5570
  }),
5072
- stats: z12.object({
5073
- totalSubscriptions: z12.number(),
5074
- uniqueOrganizations: z12.number(),
5075
- uniqueUsers: z12.number(),
5076
- byTarget: z12.array(z12.object({ target: z12.string(), count: z12.number() })),
5077
- bySource: z12.array(z12.object({ source: z12.string(), count: z12.number() })),
5078
- topOrganizations: z12.array(
5079
- z12.object({ organizationId: z12.string(), count: z12.number() })
5571
+ stats: z15.object({
5572
+ totalSubscriptions: z15.number(),
5573
+ uniqueOrganizations: z15.number(),
5574
+ uniqueUsers: z15.number(),
5575
+ byTarget: z15.array(z15.object({ target: z15.string(), count: z15.number() })),
5576
+ bySource: z15.array(z15.object({ source: z15.string(), count: z15.number() })),
5577
+ topOrganizations: z15.array(
5578
+ z15.object({ organizationId: z15.string(), count: z15.number() })
5080
5579
  ),
5081
- topCallbackDomains: z12.array(
5082
- z12.object({ domain: z12.string(), count: z12.number() })
5580
+ topCallbackDomains: z15.array(
5581
+ z15.object({ domain: z15.string(), count: z15.number() })
5083
5582
  )
5084
5583
  })
5085
5584
  };
5086
5585
 
5087
5586
  // src/apis/text-intelligence/workflows/adapter/admin/events/subscriptions/_contracts/requests/subscriptions.ts
5088
- import { z as z13 } from "zod";
5587
+ import { z as z16 } from "zod";
5089
5588
  var integrationSubscriptionRequestZods = {
5090
- getSubscriptions: z13.object({
5091
- target: z13.string().optional(),
5092
- source: z13.string().optional(),
5093
- search: z13.string().optional(),
5094
- orphaned: z13.boolean().optional(),
5095
- page: z13.number().optional(),
5096
- size: z13.number().optional(),
5097
- order_by: z13.enum([
5589
+ getSubscriptions: z16.object({
5590
+ target: z16.string().optional(),
5591
+ source: z16.string().optional(),
5592
+ search: z16.string().optional(),
5593
+ orphaned: z16.boolean().optional(),
5594
+ page: z16.number().optional(),
5595
+ size: z16.number().optional(),
5596
+ order_by: z16.enum([
5098
5597
  "id",
5099
5598
  "source",
5100
5599
  "target",
@@ -5102,7 +5601,7 @@ var integrationSubscriptionRequestZods = {
5102
5601
  "user_id",
5103
5602
  "orphaned_at"
5104
5603
  ]).optional(),
5105
- order: z13.enum(["asc", "desc"]).optional()
5604
+ order: z16.enum(["asc", "desc"]).optional()
5106
5605
  })
5107
5606
  };
5108
5607
 
@@ -5406,384 +5905,74 @@ var textPlatformWorkflowsResourcesApi = {
5406
5905
  var _a;
5407
5906
  const baseProvider = (_a = integrationNameToProduct[resource.provider]) != null ? _a : resource.provider;
5408
5907
  const provider = resource.product ? `${baseProvider}-${resource.product}` : baseProvider;
5409
- const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5410
- ensureAuthorizationToken: true
5411
- }));
5412
- return textClientInstance.get(
5413
- `/workflow_platform/external_resources/${encodeURIComponent(provider)}/${encodeURIComponent(resource.name)}`,
5414
- __spreadProps(__spreadValues({}, config), {
5415
- params,
5416
- headers: __spreadProps(__spreadValues({}, config.headers), {
5417
- "X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
5418
- })
5419
- })
5420
- ).catch((error) => {
5421
- if (error instanceof TextApiError) {
5422
- throw error.withCustomMessage(
5423
- `Couldn't get external resources. [${error.message}]`
5424
- );
5425
- }
5426
- throw error;
5427
- });
5428
- });
5429
- }
5430
- };
5431
-
5432
- // src/apis/integrations/text/platform/workflow/templates/api.ts
5433
- var getUrl3 = (segments = [], version) => buildUrlFromSegments(
5434
- segments,
5435
- `/workflow_platform/${version ? `${version}/` : ""}workflows/templates`
5436
- );
5437
- var urls4 = {
5438
- getList: (queryParams) => enrichUrlWithQueryParams(getUrl3([], "v1.0" /* V1 */), queryParams),
5439
- get: (templateId) => getUrl3([templateId], "v1.0" /* V1 */)
5440
- };
5441
- var textPlatformWorkflowsTemplatesApi = {
5442
- meta: {
5443
- urls: urls4
5444
- },
5445
- getList(queryParams, authorization) {
5446
- return __async(this, null, function* () {
5447
- return textClientInstance.get(
5448
- urls4.getList(queryParams),
5449
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5450
- ensureAuthorizationToken: true
5451
- }))
5452
- ).catch((error) => {
5453
- if (error instanceof TextApiError) {
5454
- throw error.withCustomMessage(
5455
- `Couldn't get workflow templates. [${error.message}]`
5456
- );
5457
- }
5458
- throw error;
5459
- });
5460
- });
5461
- },
5462
- get(templateId, authorization) {
5463
- return __async(this, null, function* () {
5464
- return textClientInstance.get(
5465
- urls4.get(templateId),
5466
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5467
- ensureAuthorizationToken: true
5468
- }))
5469
- ).catch((error) => {
5470
- if (error instanceof TextApiError) {
5471
- throw error.withCustomMessage(
5472
- `Couldn't get workflow template. [${error.message}]`
5473
- );
5474
- }
5475
- throw error;
5476
- });
5477
- });
5478
- }
5479
- };
5480
-
5481
- // src/apis/integrations/text/platform/workflow/workflows/internal/crm/api.ts
5482
- var getUrl4 = (segments = []) => buildUrlFromSegments(segments, "/internal/crm");
5483
- var urls5 = {
5484
- getOrganizations: (queryParams) => enrichUrlWithQueryParams(getUrl4(["stats"]), queryParams),
5485
- getOrganization: (organizationId) => getUrl4(["stats", organizationId]),
5486
- getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl4(["workflows"]), queryParams),
5487
- getWorkflow: (id) => getUrl4(["workflows", id]),
5488
- getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
5489
- getUrl4(["workflows", id, "executions"]),
5490
- queryParams
5491
- ),
5492
- getWorkflowExecution: (id, executionId) => getUrl4(["workflows", id, "executions", executionId]),
5493
- getWorkflowIntrospection: (id) => getUrl4(["workflows", id, "metadata"])
5494
- };
5495
- var textPlatformWorkflowsInternalCrmApi = {
5496
- meta: {
5497
- urls: urls5
5498
- },
5499
- getOrganizations(queryParams, authorization) {
5500
- return __async(this, null, function* () {
5501
- const { data: organizations } = yield textClientInstance.get(
5502
- urls5.getOrganizations(queryParams),
5503
- getWorkflowApiCrmConfig(authorization)
5504
- );
5505
- return organizations;
5506
- });
5507
- },
5508
- getOrganization(organizationId, authorization) {
5509
- return __async(this, null, function* () {
5510
- const { data: organization } = yield textClientInstance.get(
5511
- urls5.getOrganization(organizationId),
5512
- getWorkflowApiCrmConfig(authorization)
5513
- );
5514
- return organization;
5515
- });
5516
- },
5517
- getWorkflows(queryParams, authorization) {
5518
- return __async(this, null, function* () {
5519
- const { data: workflows } = yield textClientInstance.get(urls5.getWorkflows(queryParams), getWorkflowApiCrmConfig(authorization));
5520
- workflows.data = workflows.data.map(enrichWorkflowTrigger);
5521
- return workflows;
5522
- });
5523
- },
5524
- getWorkflow(workflowId, authorization) {
5525
- return __async(this, null, function* () {
5526
- const searchParams = new URLSearchParams();
5527
- const query = searchParams.toString();
5528
- const { data: workflow } = yield textClientInstance.get(
5529
- `${urls5.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
5530
- getWorkflowApiCrmConfig(authorization)
5531
- );
5532
- return enrichWorkflowTrigger(workflow);
5533
- });
5534
- },
5535
- getWorkflowExecutions(workflowId, queryParams, authorization) {
5536
- return __async(this, null, function* () {
5537
- const { data: executions } = yield textClientInstance.get(
5538
- urls5.getWorkflowExecutions(workflowId, queryParams),
5539
- getWorkflowApiCrmConfig(authorization)
5540
- );
5541
- return executions;
5542
- });
5543
- },
5544
- getWorkflowExecution(workflowId, executionId, authorization) {
5545
- return __async(this, null, function* () {
5546
- const { data: execution } = yield textClientInstance.get(
5547
- urls5.getWorkflowExecution(workflowId, executionId),
5548
- getWorkflowApiCrmConfig(authorization)
5549
- );
5550
- return execution;
5551
- });
5552
- },
5553
- getWorkflowIntrospection(workflowId, version, authorization) {
5554
- return __async(this, null, function* () {
5555
- const searchParams = new URLSearchParams();
5556
- if (version) {
5557
- searchParams.append("version", `${version}`);
5558
- }
5559
- const query = searchParams.toString();
5560
- const { data: introspection } = yield textClientInstance.get(
5561
- `${urls5.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
5562
- getWorkflowApiCrmConfig(authorization)
5563
- );
5564
- return {
5565
- tasks: introspection
5566
- };
5908
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5909
+ ensureAuthorizationToken: true
5910
+ }));
5911
+ return textClientInstance.get(
5912
+ `/workflow_platform/external_resources/${encodeURIComponent(provider)}/${encodeURIComponent(resource.name)}`,
5913
+ __spreadProps(__spreadValues({}, config), {
5914
+ params,
5915
+ headers: __spreadProps(__spreadValues({}, config.headers), {
5916
+ "X-Cred-ID": authorization == null ? void 0 : authorization.credentialId
5917
+ })
5918
+ })
5919
+ ).catch((error) => {
5920
+ if (error instanceof TextApiError) {
5921
+ throw error.withCustomMessage(
5922
+ `Couldn't get external resources. [${error.message}]`
5923
+ );
5924
+ }
5925
+ throw error;
5926
+ });
5567
5927
  });
5568
5928
  }
5569
5929
  };
5570
5930
 
5571
- // src/apis/integrations/text/platform/workflow/workflows/internal/api.ts
5572
- var textPlatformWorkflowsInternalApi = {
5573
- crm: textPlatformWorkflowsInternalCrmApi
5574
- };
5575
-
5576
- // src/apis/integrations/text/platform/workflow/workflows/api.ts
5577
- var enrichWorkflowTrigger = (workflow) => {
5578
- var _a, _b, _c, _d, _e, _f;
5579
- if (((_a = workflow.trigger) == null ? void 0 : _a.type) === WorkflowTriggerType.webhook) {
5580
- workflow.trigger.name = `${workflow.trigger.webhook.source}-${(_b = workflow.trigger.webhook.event) == null ? void 0 : _b.name}`;
5581
- }
5582
- if (((_c = workflow.trigger) == null ? void 0 : _c.type) === WorkflowTriggerType.webhookManual) {
5583
- workflow.trigger.name = "webhook_manual";
5584
- }
5585
- if (((_d = workflow.trigger) == null ? void 0 : _d.type) === WorkflowTriggerType.manual) {
5586
- workflow.trigger.name = "manual";
5587
- }
5588
- if (((_e = workflow.trigger) == null ? void 0 : _e.type) === WorkflowTriggerType.agent) {
5589
- workflow.trigger.name = "ai_agent";
5590
- }
5591
- if (((_f = workflow.trigger) == null ? void 0 : _f.type) === WorkflowTriggerType.recurring) {
5592
- workflow.trigger.name = "scheduled";
5593
- }
5594
- return workflow;
5595
- };
5931
+ // src/apis/integrations/text/platform/workflow/templates/api.ts
5596
5932
  var getUrl5 = (segments = [], version) => buildUrlFromSegments(
5597
5933
  segments,
5598
- `/workflow_platform/${version ? `${version}/` : ""}workflows`
5934
+ `/workflow_platform/${version ? `${version}/` : ""}workflows/templates`
5599
5935
  );
5600
5936
  var urls6 = {
5601
- getWorkflows: (queryParams) => enrichUrlWithQueryParams(getUrl5([], "v1.0" /* V1 */), queryParams),
5602
- createWorkflow: () => getUrl5(),
5603
- getWorkflow: (id) => getUrl5([id], "v1.0" /* V1 */),
5604
- updateWorkflow: (id) => getUrl5([id]),
5605
- deleteWorkflow: (id) => getUrl5([id]),
5606
- createWorkflowDraft: (id) => getUrl5([id, "draft"]),
5607
- publishWorkflowDraft: (id) => getUrl5([id, "publish"]),
5608
- toggleWorkflowActivation: (id) => getUrl5([id, "activation"]),
5609
- executeWorkflow: (id) => getUrl5([id, "executions"]),
5610
- getWorkflowExecutions: (id, queryParams) => enrichUrlWithQueryParams(
5611
- getUrl5([id, "executions"], "v1.0" /* V1 */),
5612
- queryParams
5613
- ),
5614
- getWorkflowExecution: (id, executionId) => getUrl5([id, "executions", executionId], "v1.0" /* V1 */),
5615
- getWorkflowIntrospection: (id) => getUrl5([id, "metadata"], "v1.0" /* V1 */),
5616
- introspectWorkflowTask: (id) => getUrl5([id, "run_task"], "v1.0" /* V1 */)
5937
+ getList: (queryParams) => enrichUrlWithQueryParams(getUrl5([], "v1.0" /* V1 */), queryParams),
5938
+ get: (templateId) => getUrl5([templateId], "v1.0" /* V1 */)
5617
5939
  };
5618
- var textPlatformWorkflowsApi = {
5619
- internal: textPlatformWorkflowsInternalApi,
5940
+ var textPlatformWorkflowsTemplatesApi = {
5620
5941
  meta: {
5621
5942
  urls: urls6
5622
5943
  },
5623
- getWorkflows(queryParams, authorization) {
5624
- return __async(this, null, function* () {
5625
- const { data: workflows } = yield textClientInstance.get(
5626
- urls6.getWorkflows(queryParams),
5627
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5628
- ensureAuthorizationToken: true
5629
- }))
5630
- );
5631
- workflows.data = workflows.data.map(enrichWorkflowTrigger);
5632
- return workflows;
5633
- });
5634
- },
5635
- getWorkflow(workflowId, version, authorization) {
5636
- return __async(this, null, function* () {
5637
- const searchParams = new URLSearchParams();
5638
- if (version) {
5639
- searchParams.append("version", `${version}`);
5640
- }
5641
- const query = searchParams.toString();
5642
- const { data: workflow } = yield textClientInstance.get(
5643
- `${urls6.getWorkflow(workflowId)}${query ? `?${query}` : ""}`,
5644
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5645
- ensureAuthorizationToken: true
5646
- }))
5647
- );
5648
- return enrichWorkflowTrigger(workflow);
5649
- });
5650
- },
5651
- createWorkflow(payload, authorization) {
5652
- return __async(this, null, function* () {
5653
- return textClientInstance.post(
5654
- urls6.createWorkflow(),
5655
- __spreadProps(__spreadValues({}, payload), {
5656
- trigger: payload.trigger || {}
5657
- }),
5658
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5659
- ensureAuthorizationToken: true
5660
- }))
5661
- );
5662
- });
5663
- },
5664
- updateWorkflow(workflowId, payload, authorization) {
5665
- return __async(this, null, function* () {
5666
- return textClientInstance.put(
5667
- urls6.updateWorkflow(workflowId),
5668
- __spreadProps(__spreadValues({}, payload), {
5669
- trigger: payload.trigger || {}
5670
- }),
5671
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5672
- ensureAuthorizationToken: true
5673
- }))
5674
- );
5675
- });
5676
- },
5677
- deleteWorkflow(workflowId, authorization) {
5678
- return __async(this, null, function* () {
5679
- return textClientInstance.delete(urls6.deleteWorkflow(workflowId), __spreadValues({}, getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5680
- ensureAuthorizationToken: true
5681
- }))));
5682
- });
5683
- },
5684
- createWorkflowDraft(workflowId, payload, authorization) {
5685
- return __async(this, null, function* () {
5686
- return textClientInstance.post(
5687
- urls6.createWorkflowDraft(workflowId),
5688
- __spreadProps(__spreadValues({}, payload), {
5689
- trigger: payload.trigger || {}
5690
- }),
5691
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5692
- ensureAuthorizationToken: true
5693
- }))
5694
- );
5695
- });
5696
- },
5697
- publishWorkflowDraft(workflowId, authorization) {
5698
- return __async(this, null, function* () {
5699
- return textClientInstance.post(
5700
- urls6.publishWorkflowDraft(workflowId),
5701
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5702
- ensureAuthorizationToken: true
5703
- }))
5704
- );
5705
- });
5706
- },
5707
- toggleWorkflowActivation(workflowId, isActive, authorization) {
5708
- return __async(this, null, function* () {
5709
- return textClientInstance.put(
5710
- urls6.toggleWorkflowActivation(workflowId),
5711
- {
5712
- active: isActive
5713
- },
5714
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5715
- ensureAuthorizationToken: true
5716
- }))
5717
- );
5718
- });
5719
- },
5720
- executeWorkflow(workflowId, input, authorization) {
5721
- return __async(this, null, function* () {
5722
- const { data: execution } = yield textClientInstance.post(
5723
- urls6.executeWorkflow(workflowId),
5724
- {
5725
- input
5726
- },
5727
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5728
- ensureAuthorizationToken: true
5729
- }))
5730
- );
5731
- return execution;
5732
- });
5733
- },
5734
- getWorkflowExecutions(workflowId, queryParams, authorization) {
5735
- return __async(this, null, function* () {
5736
- const { data: executions } = yield textClientInstance.get(
5737
- urls6.getWorkflowExecutions(workflowId, queryParams),
5738
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5739
- ensureAuthorizationToken: true
5740
- }))
5741
- );
5742
- return executions;
5743
- });
5744
- },
5745
- getWorkflowExecution(workflowId, executionId, authorization) {
5746
- return __async(this, null, function* () {
5747
- const { data: execution } = yield textClientInstance.get(
5748
- urls6.getWorkflowExecution(workflowId, executionId),
5749
- getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5750
- ensureAuthorizationToken: true
5751
- }))
5752
- );
5753
- return execution;
5754
- });
5755
- },
5756
- getWorkflowIntrospection(workflowId, version, authorization) {
5944
+ getList(queryParams, authorization) {
5757
5945
  return __async(this, null, function* () {
5758
- const searchParams = new URLSearchParams();
5759
- if (version) {
5760
- searchParams.append("version", `${version}`);
5761
- }
5762
- const query = searchParams.toString();
5763
- const { data: introspection } = yield textClientInstance.get(
5764
- `${urls6.getWorkflowIntrospection(workflowId)}${query ? `?${query}` : ""}`,
5946
+ return textClientInstance.get(
5947
+ urls6.getList(queryParams),
5765
5948
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5766
5949
  ensureAuthorizationToken: true
5767
5950
  }))
5768
- );
5769
- return {
5770
- tasks: introspection
5771
- };
5951
+ ).catch((error) => {
5952
+ if (error instanceof TextApiError) {
5953
+ throw error.withCustomMessage(
5954
+ `Couldn't get workflow templates. [${error.message}]`
5955
+ );
5956
+ }
5957
+ throw error;
5958
+ });
5772
5959
  });
5773
5960
  },
5774
- introspectWorkflowTask(workflowId, payload, authorization) {
5961
+ get(templateId, authorization) {
5775
5962
  return __async(this, null, function* () {
5776
- const response = yield textClientInstance.post(
5777
- urls6.introspectWorkflowTask(workflowId),
5778
- {
5779
- task_reference_name: payload.taskReferenceName,
5780
- input_parameters: payload.inputParameters
5781
- },
5963
+ return textClientInstance.get(
5964
+ urls6.get(templateId),
5782
5965
  getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
5783
5966
  ensureAuthorizationToken: true
5784
5967
  }))
5785
- );
5786
- return response.data;
5968
+ ).catch((error) => {
5969
+ if (error instanceof TextApiError) {
5970
+ throw error.withCustomMessage(
5971
+ `Couldn't get workflow template. [${error.message}]`
5972
+ );
5973
+ }
5974
+ throw error;
5975
+ });
5787
5976
  });
5788
5977
  }
5789
5978
  };
@@ -5803,11 +5992,87 @@ var textPlatformApi = {
5803
5992
  workflow: textPlatformWorkflowApi
5804
5993
  };
5805
5994
 
5995
+ // src/apis/integrations/text/resourcer/api.ts
5996
+ var buildResourcePath = ({ provider, domain, name }) => {
5997
+ let targetProvider = provider;
5998
+ if (["text-livechat" /* LiveChat */, "text-helpdesk" /* HelpDesk */].includes(
5999
+ provider
6000
+ )) {
6001
+ targetProvider = "text" /* Text */;
6002
+ }
6003
+ return [targetProvider, domain, name].filter(notEmpty).join("/");
6004
+ };
6005
+ var urls7 = {
6006
+ listSchema: () => "/workflow_resources/schema",
6007
+ getSchema: (provider) => `/workflow_resources/schema/${provider}`,
6008
+ getResource: (resource) => `/workflow_resources/resources/${buildResourcePath(resource)}`
6009
+ };
6010
+ var textResourcerApi = {
6011
+ getResource(resource, credentialId, authorization) {
6012
+ return __async(this, null, function* () {
6013
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
6014
+ ensureAuthorizationToken: true
6015
+ }));
6016
+ return textClientInstance.get(urls7.getResource(resource), __spreadProps(__spreadValues({}, config), {
6017
+ headers: __spreadProps(__spreadValues({}, config.headers), {
6018
+ "X-Credential-ID": credentialId
6019
+ })
6020
+ })).catch((error) => {
6021
+ if (error instanceof TextApiError) {
6022
+ throw error.withCustomMessage(
6023
+ `Couldn't get resourcer resource. [${error.message}]`
6024
+ );
6025
+ }
6026
+ throw error;
6027
+ });
6028
+ });
6029
+ },
6030
+ listSchema(credentialId, authorization) {
6031
+ return __async(this, null, function* () {
6032
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
6033
+ ensureAuthorizationToken: true
6034
+ }));
6035
+ return textClientInstance.get(urls7.listSchema(), __spreadProps(__spreadValues({}, config), {
6036
+ headers: __spreadProps(__spreadValues({}, config.headers), {
6037
+ "X-Credential-ID": credentialId
6038
+ })
6039
+ })).catch((error) => {
6040
+ if (error instanceof TextApiError) {
6041
+ throw error.withCustomMessage(
6042
+ `Couldn't list resourcer schema. [${error.message}]`
6043
+ );
6044
+ }
6045
+ throw error;
6046
+ });
6047
+ });
6048
+ },
6049
+ getSchema(provider, credentialId, authorization) {
6050
+ return __async(this, null, function* () {
6051
+ const config = getTextClientConfig(__spreadProps(__spreadValues({}, authorization), {
6052
+ ensureAuthorizationToken: true
6053
+ }));
6054
+ return textClientInstance.get(urls7.getSchema(provider), __spreadProps(__spreadValues({}, config), {
6055
+ headers: __spreadProps(__spreadValues({}, config.headers), {
6056
+ "X-Credential-ID": credentialId
6057
+ })
6058
+ })).catch((error) => {
6059
+ if (error instanceof TextApiError) {
6060
+ throw error.withCustomMessage(
6061
+ `Couldn't get resourcer schema. [${error.message}]`
6062
+ );
6063
+ }
6064
+ throw error;
6065
+ });
6066
+ });
6067
+ }
6068
+ };
6069
+
5806
6070
  // src/apis/integrations/text/api.ts
5807
6071
  var textApi = {
5808
6072
  platform: textPlatformApi,
5809
6073
  ai: textAiAgentApi,
5810
- externalAccountManager: textExternalAccountManagerApi
6074
+ externalAccountManager: textExternalAccountManagerApi,
6075
+ resourcer: textResourcerApi
5811
6076
  };
5812
6077
 
5813
6078
  // src/apis/integrations/vercel/api.ts
@@ -6108,7 +6373,7 @@ var integrationsApi = {
6108
6373
  };
6109
6374
 
6110
6375
  // src/apis/platform/accounts/accounts/api.ts
6111
- var urls7 = (withBaseUrl = false) => {
6376
+ var urls8 = (withBaseUrl = false) => {
6112
6377
  const getUrl7 = (segments = []) => buildUrlFromSegments(
6113
6378
  segments,
6114
6379
  "/v2/accounts",
@@ -6124,7 +6389,7 @@ var api2 = {
6124
6389
  getAccounts(authorization) {
6125
6390
  return __async(this, null, function* () {
6126
6391
  return platformAccountsClientInstance.get(
6127
- urls7().getAccounts(),
6392
+ urls8().getAccounts(),
6128
6393
  {
6129
6394
  authorization,
6130
6395
  customErrorMessage: "Accounts couldn't be fetched."
@@ -6135,7 +6400,7 @@ var api2 = {
6135
6400
  getAccount(accountId, authorization) {
6136
6401
  return __async(this, null, function* () {
6137
6402
  return platformAccountsClientInstance.get(
6138
- urls7().getAccount(accountId),
6403
+ urls8().getAccount(accountId),
6139
6404
  {
6140
6405
  authorization,
6141
6406
  customErrorMessage: "Account couldn't be fetched."
@@ -6157,7 +6422,7 @@ var api2 = {
6157
6422
  };
6158
6423
  var platformAccountsAccountApi = __spreadProps(__spreadValues({}, api2), {
6159
6424
  meta: {
6160
- urls: urls7
6425
+ urls: urls8
6161
6426
  }
6162
6427
  });
6163
6428
 
@@ -6323,18 +6588,18 @@ var platformAccountsPersonalAccessTokenApi = {
6323
6588
 
6324
6589
  // src/apis/platform/accounts/products/api.ts
6325
6590
  var getUrl6 = (segments = []) => buildUrlFromSegments(segments, "/v2/organizations");
6326
- var urls8 = {
6591
+ var urls9 = {
6327
6592
  getOrganizationProducts: () => getUrl6(["my", "products"]),
6328
6593
  updateOrganizationProducts: () => getUrl6(["my", "products"])
6329
6594
  };
6330
6595
  var platformAccountsProductsApi = {
6331
6596
  meta: {
6332
- urls: urls8
6597
+ urls: urls9
6333
6598
  },
6334
6599
  getOrganizationProducts(authorization) {
6335
6600
  return __async(this, null, function* () {
6336
6601
  return platformAccountsClientInstance.get(
6337
- urls8.getOrganizationProducts(),
6602
+ urls9.getOrganizationProducts(),
6338
6603
  { authorization, customErrorMessage: "Products couldn't be fetched." }
6339
6604
  );
6340
6605
  });
@@ -6342,7 +6607,7 @@ var platformAccountsProductsApi = {
6342
6607
  updateOrganizationProducts(payload, authorization) {
6343
6608
  return __async(this, null, function* () {
6344
6609
  return platformAccountsClientInstance.post(
6345
- urls8.updateOrganizationProducts(),
6610
+ urls9.updateOrganizationProducts(),
6346
6611
  payload,
6347
6612
  { authorization, customErrorMessage: "Products couldn't be updated." }
6348
6613
  );
@@ -7772,7 +8037,7 @@ var platformDpsApplicationStatsApi = {
7772
8037
  var platformDpsApplicationWebhooksApi = {
7773
8038
  updateAppWebhooks(appId, payload, authorization) {
7774
8039
  return __async(this, null, function* () {
7775
- yield dpsClientInstance.put(
8040
+ return dpsClientInstance.put(
7776
8041
  `/v2/applications/${encodeURIComponent(appId)}/webhook`,
7777
8042
  payload,
7778
8043
  getDpsClientConfig(authorization)
@@ -8972,7 +9237,7 @@ var livechatWebhookApi = {
8972
9237
  registerWebhook(webhook, authorization) {
8973
9238
  return __async(this, null, function* () {
8974
9239
  yield livechatClientInstance.post(
8975
- `/v${webhook.api_version || "3.5"}/configuration/action/register_webhook`,
9240
+ `/v${webhook.api_version || "3.6"}/configuration/action/register_webhook`,
8976
9241
  {
8977
9242
  url: webhook.url,
8978
9243
  action: webhook.action,
@@ -8998,7 +9263,7 @@ var livechatWebhookApi = {
8998
9263
  yield Promise.all(
8999
9264
  webhooks.map((webhook) => __async(this, null, function* () {
9000
9265
  return livechatClientInstance.post(
9001
- `/v${webhook.api_version || "3.5"}/configuration/action/register_webhook`,
9266
+ `/v${webhook.api_version || "3.6"}/configuration/action/register_webhook`,
9002
9267
  {
9003
9268
  url: webhook.url,
9004
9269
  action: webhook.action,
@@ -9367,6 +9632,7 @@ export {
9367
9632
  BigCommerceApiError,
9368
9633
  BigCommerceEventNames,
9369
9634
  BigCommerceWebhookScopes,
9635
+ CdpCustomerEventType,
9370
9636
  ConsoleApiError,
9371
9637
  CredentialStatus,
9372
9638
  CredentialType,
@@ -9403,9 +9669,12 @@ export {
9403
9669
  SlackMessageEventSubTypes,
9404
9670
  SortBy,
9405
9671
  SortOrder,
9672
+ TRIGGER_REFERENCE_NAME,
9406
9673
  TextApiError,
9674
+ TextCustomerEventNames,
9407
9675
  TextHelpDeskEventNames,
9408
9676
  TextLivechatEventNames,
9677
+ TextLivechatProductCardEventType,
9409
9678
  TicketPriority,
9410
9679
  TicketStatus,
9411
9680
  UnauthorizeAccountsApiError,
@@ -9415,12 +9684,12 @@ export {
9415
9684
  WorkflowConditionTaskOperator,
9416
9685
  WorkflowConditionTaskOperatorGroup,
9417
9686
  WorkflowConditionTaskOperatorValueType,
9418
- WorkflowDefinitionCustomTaskName,
9419
- WorkflowDefinitionTaskType,
9687
+ WorkflowCustomTaskName,
9420
9688
  WorkflowExecutionDefinitionStatus,
9421
9689
  WorkflowExecutionStatus,
9422
9690
  WorkflowExecutionTaskStatus,
9423
9691
  WorkflowItemKind,
9692
+ WorkflowTaskType,
9424
9693
  WorkflowTemplateCategory,
9425
9694
  WorkflowTriggerType,
9426
9695
  WorkflowsApiError,
@@ -9436,8 +9705,10 @@ export {
9436
9705
  bigcommerceEventsZods,
9437
9706
  billingClientInstance,
9438
9707
  buildUrlFromSegments,
9708
+ cdpCustomerEventMessageZod,
9439
9709
  consoleClientInstance,
9440
9710
  dpsClientInstance,
9711
+ enrichWorkflowTrigger,
9441
9712
  extractTokenFromAuthorizationHeader,
9442
9713
  getAdapterClientConfig,
9443
9714
  getAdapterClientDefaultConfig,
@@ -9511,6 +9782,7 @@ export {
9511
9782
  integrationSubscriptionZods,
9512
9783
  isFilter,
9513
9784
  isFilterGroup,
9785
+ isWorkflowBaseHttpTaskCore,
9514
9786
  livechatClientInstance,
9515
9787
  mailchimpClientInstance,
9516
9788
  mailchimpEventsZods,
@@ -9525,6 +9797,8 @@ export {
9525
9797
  slackClientInstance,
9526
9798
  slackEventsZods,
9527
9799
  textClientInstance,
9800
+ textCustomerEventsZods,
9801
+ textEventsZods,
9528
9802
  textHelpDeskEventsZods,
9529
9803
  textLivechatEventsZods,
9530
9804
  updateAdapterClient,