@livechat/platform-workflows 0.0.50 → 0.0.52

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
@@ -469,20 +469,22 @@ import {
469
469
  getConfig,
470
470
  setConfig
471
471
  } from "@livechat/developer-studio-ui-react";
472
- var config = {
472
+ var configBase = {
473
473
  env: "labs"
474
474
  };
475
+ var config = getWorkflowsConfig(configBase);
475
476
  function setWorkflowsConfig(newConfig) {
476
- config = __spreadValues(__spreadValues({}, config), newConfig);
477
+ configBase = __spreadValues(__spreadValues({}, configBase), newConfig);
477
478
  setConfig({
478
- env: config.env,
479
- basePath: config.basePath
479
+ env: configBase.env,
480
+ basePath: configBase.basePath
480
481
  });
482
+ config = getWorkflowsConfig(configBase);
481
483
  }
482
- function getWorkflowsConfig() {
483
- const isProd = config.env === "prod";
484
- const coreConfig = getConfig();
485
- return __spreadProps(__spreadValues(__spreadValues({}, coreConfig), config), {
484
+ function getWorkflowsConfig(base) {
485
+ const isProd = base.env === "prod";
486
+ const coreConfig = getConfig(base);
487
+ return __spreadProps(__spreadValues(__spreadValues({}, coreConfig), configBase), {
486
488
  // Authorization
487
489
  accountsClientId: isProd ? "381b682538d896b6a25f54caf1805650" : "bc52b2c51dc4a5c2491ca49eaa7354d0",
488
490
  // Workflows
@@ -495,7 +497,7 @@ function getWorkflowsConfig() {
495
497
  });
496
498
  }
497
499
  var getWorkflowsEnv = (key) => {
498
- return getWorkflowsConfig()[key];
500
+ return config[key];
499
501
  };
500
502
 
501
503
  // ../../../node_modules/.pnpm/@emotion+react@11.13.3_@types+react@18.2.5_react@18.2.0/node_modules/@emotion/react/dist/emotion-element-b4c8b265.esm.js
@@ -1975,9 +1977,7 @@ var WORKFLOW_HTTP_TASK_OUTPUT_SCHEMA = (body) => ({
1975
1977
  });
1976
1978
 
1977
1979
  // src/views/Flows/Definitions/Mocks/System/index.ts
1978
- import {
1979
- WorkflowDefinitionTaskType
1980
- } from "@livechat/developer-studio-api";
1980
+ import { WorkflowDefinitionTaskType } from "@livechat/developer-studio-api";
1981
1981
 
1982
1982
  // src/constants/products.ts
1983
1983
  var OTHER_PRODUCT_TYPE = {
@@ -1998,7 +1998,7 @@ var PRODUCT_NAMES = {
1998
1998
  };
1999
1999
 
2000
2000
  // src/views/Flows/Definitions/Mocks/System/index.ts
2001
- var systemTaskConfigs = {
2001
+ var systemTaskConfigs = () => ({
2002
2002
  [WorkflowDefinitionTaskType.http]: {
2003
2003
  key: WorkflowDefinitionTaskType.http,
2004
2004
  type: "other",
@@ -2069,7 +2069,7 @@ var systemTaskConfigs = {
2069
2069
  },
2070
2070
  specification: {}
2071
2071
  }
2072
- };
2072
+ });
2073
2073
  var workflowForkTask = {
2074
2074
  name: "fork",
2075
2075
  type: "FORK_JOIN",
@@ -2127,7 +2127,7 @@ var workflowHttpTask = {
2127
2127
  }
2128
2128
  }
2129
2129
  };
2130
- var systemTaskTemplates = {
2130
+ var systemTaskTemplates = () => ({
2131
2131
  [WorkflowDefinitionTaskType.http]: workflowHttpTask,
2132
2132
  [WorkflowDefinitionTaskType.switch]: workflowSwitchTask,
2133
2133
  [WorkflowDefinitionTaskType.forkJoin]: workflowForkTask,
@@ -2137,8 +2137,8 @@ var systemTaskTemplates = {
2137
2137
  [WorkflowDefinitionTaskType.addNode]: workflowAddNodeTask,
2138
2138
  [WorkflowDefinitionTaskType.addTrigger]: workflowAddTriggerTask,
2139
2139
  [WorkflowDefinitionTaskType.trigger]: workflowTriggerTask
2140
- };
2141
- var systemTriggerConfigs = {
2140
+ });
2141
+ var systemTriggerConfigs = () => ({
2142
2142
  ["scheduled" /* Scheduled */]: {
2143
2143
  key: "scheduled" /* Scheduled */,
2144
2144
  type: "system",
@@ -2178,8 +2178,8 @@ var systemTriggerConfigs = {
2178
2178
  output: {}
2179
2179
  }
2180
2180
  }
2181
- };
2182
- var systemTriggerTemplates = {
2181
+ });
2182
+ var systemTriggerTemplates = () => ({
2183
2183
  ["manual" /* Manual */]: {
2184
2184
  type: "manual_only"
2185
2185
  },
@@ -2187,7 +2187,7 @@ var systemTriggerTemplates = {
2187
2187
  type: "recurring",
2188
2188
  schedule: "* * * * *"
2189
2189
  }
2190
- };
2190
+ });
2191
2191
 
2192
2192
  // src/views/Flows/Definitions/Mocks/BigCommerce/index.ts
2193
2193
  var bigCommerceProductBody = {
@@ -2525,7 +2525,7 @@ var bigCommerceCustomerResponse = {
2525
2525
  }
2526
2526
  }
2527
2527
  };
2528
- var bigCommerceTaskConfigs = {
2528
+ var bigCommerceTaskConfigs = () => ({
2529
2529
  ["BIGCOMMERCE_CREATE_BLOG_POST" /* CreateBlogPost */]: {
2530
2530
  key: "BIGCOMMERCE_CREATE_BLOG_POST" /* CreateBlogPost */,
2531
2531
  type: WorkflowDefinitionTaskType2.http,
@@ -2891,8 +2891,8 @@ var bigCommerceTaskConfigs = {
2891
2891
  })
2892
2892
  }
2893
2893
  }
2894
- };
2895
- var bigCommerceTaskTemplates = {
2894
+ });
2895
+ var bigCommerceTaskTemplates = () => ({
2896
2896
  ["BIGCOMMERCE_CREATE_BLOG_POST" /* CreateBlogPost */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
2897
2897
  name: "BIGCOMMERCE_CREATE_BLOG_POST" /* CreateBlogPost */,
2898
2898
  taskReferenceName: "bigcommerce_create_blog_post",
@@ -3060,7 +3060,7 @@ var bigCommerceTaskTemplates = {
3060
3060
  })
3061
3061
  })
3062
3062
  })
3063
- };
3063
+ });
3064
3064
  var BigCommerceTriggerNames = {
3065
3065
  CartCreated: `${IntegrationNames.BigCommerce}-${BigCommerceEventNames.CartCreated}`,
3066
3066
  CartUpdated: `${IntegrationNames.BigCommerce}-${BigCommerceEventNames.CartUpdated}`,
@@ -3069,7 +3069,7 @@ var BigCommerceTriggerNames = {
3069
3069
  ProductCreated: `${IntegrationNames.BigCommerce}-${BigCommerceEventNames.ProductCreated}`,
3070
3070
  ProductUpdated: `${IntegrationNames.BigCommerce}-${BigCommerceEventNames.ProductUpdated}`
3071
3071
  };
3072
- var bigcommerceTriggerConfigs = {
3072
+ var bigcommerceTriggerConfigs = () => ({
3073
3073
  [BigCommerceTriggerNames.CartCreated]: {
3074
3074
  key: BigCommerceTriggerNames.CartCreated,
3075
3075
  name: BigCommerceEventNames.CartCreated,
@@ -3226,8 +3226,8 @@ var bigcommerceTriggerConfigs = {
3226
3226
  }
3227
3227
  }
3228
3228
  }
3229
- };
3230
- var bigcommerceTriggerTemplates = {
3229
+ });
3230
+ var bigcommerceTriggerTemplates = () => ({
3231
3231
  [BigCommerceTriggerNames.CartCreated]: {
3232
3232
  type: "webhook",
3233
3233
  webhook: {
@@ -3330,7 +3330,7 @@ var bigcommerceTriggerTemplates = {
3330
3330
  }
3331
3331
  }
3332
3332
  }
3333
- };
3333
+ });
3334
3334
 
3335
3335
  // src/views/Flows/Definitions/Mocks/HelpDesk/index.ts
3336
3336
  import {
@@ -3489,7 +3489,7 @@ var helpdeskTicketInput = {
3489
3489
  title: "Transaction ID"
3490
3490
  }
3491
3491
  };
3492
- var helpdeskTaskConfigs = {
3492
+ var helpdeskTaskConfigs = () => ({
3493
3493
  ["HELPDESK_ADD_FOLLOWERS_TO_TICKET" /* AddFollowersToTicket */]: {
3494
3494
  key: "HELPDESK_ADD_FOLLOWERS_TO_TICKET" /* AddFollowersToTicket */,
3495
3495
  type: WorkflowDefinitionTaskType3.http,
@@ -3738,8 +3738,8 @@ var helpdeskTaskConfigs = {
3738
3738
  output: helpdeskTicketResponse
3739
3739
  }
3740
3740
  }
3741
- };
3742
- var helpdeskTaskTemplates = {
3741
+ });
3742
+ var helpdeskTaskTemplates = () => ({
3743
3743
  ["HELPDESK_CREATE_TICKET" /* CreateTicket */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
3744
3744
  name: "HELPDESK_CREATE_TICKET" /* CreateTicket */,
3745
3745
  taskReferenceName: "helpdesk_create_ticket",
@@ -3858,7 +3858,7 @@ var helpdeskTaskTemplates = {
3858
3858
  })
3859
3859
  })
3860
3860
  })
3861
- };
3861
+ });
3862
3862
 
3863
3863
  // src/views/Flows/Definitions/Mocks/HubSpot/index.ts
3864
3864
  import {
@@ -3900,7 +3900,7 @@ var hubspotContactBody = {
3900
3900
  properties: hubspotContactProperties
3901
3901
  }
3902
3902
  };
3903
- var hubspotTaskConfigs = {
3903
+ var hubspotTaskConfigs = () => ({
3904
3904
  ["HUBSPOT_CREATE_CONTACT" /* CreateContact */]: {
3905
3905
  key: "HUBSPOT_CREATE_CONTACT" /* CreateContact */,
3906
3906
  type: WorkflowDefinitionTaskType4.http,
@@ -4020,8 +4020,8 @@ var hubspotTaskConfigs = {
4020
4020
  })
4021
4021
  }
4022
4022
  }
4023
- };
4024
- var hubspotTaskTemplates = {
4023
+ });
4024
+ var hubspotTaskTemplates = () => ({
4025
4025
  ["HUBSPOT_CREATE_CONTACT" /* CreateContact */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
4026
4026
  name: "HUBSPOT_CREATE_CONTACT" /* CreateContact */,
4027
4027
  taskReferenceName: "hubspot_create_contact",
@@ -4101,12 +4101,12 @@ var hubspotTaskTemplates = {
4101
4101
  })
4102
4102
  })
4103
4103
  })
4104
- };
4104
+ });
4105
4105
  var HubSpotTriggerNames = {
4106
4106
  ContactCreated: `${IntegrationNames3.HubSpot}-${HubspotEventNames.ContactCreated}`,
4107
4107
  ContactDeleted: `${IntegrationNames3.HubSpot}-${HubspotEventNames.ContactDeleted}`
4108
4108
  };
4109
- var hubspotTriggerConfigs = {
4109
+ var hubspotTriggerConfigs = () => ({
4110
4110
  [HubSpotTriggerNames.ContactCreated]: {
4111
4111
  key: HubSpotTriggerNames.ContactCreated,
4112
4112
  name: HubspotEventNames.ContactCreated,
@@ -4145,8 +4145,8 @@ var hubspotTriggerConfigs = {
4145
4145
  }
4146
4146
  }
4147
4147
  }
4148
- };
4149
- var hubSpotTriggerTemplates = {
4148
+ });
4149
+ var hubSpotTriggerTemplates = () => ({
4150
4150
  [HubSpotTriggerNames.ContactCreated]: {
4151
4151
  type: "webhook",
4152
4152
  webhook: {
@@ -4175,7 +4175,7 @@ var hubSpotTriggerTemplates = {
4175
4175
  }
4176
4176
  }
4177
4177
  }
4178
- };
4178
+ });
4179
4179
 
4180
4180
  // src/views/Flows/Definitions/Mocks/LiveChat/index.ts
4181
4181
  import {
@@ -4747,7 +4747,7 @@ var webhookSpecs = {
4747
4747
  }
4748
4748
  }
4749
4749
  };
4750
- var livechatTaskConfigs = {
4750
+ var livechatTaskConfigs = () => ({
4751
4751
  ["LIVECHAT_TRANSFER_CHAT" /* TransferChat */]: {
4752
4752
  key: "LIVECHAT_TRANSFER_CHAT" /* TransferChat */,
4753
4753
  type: WorkflowDefinitionTaskType5.http,
@@ -4952,8 +4952,8 @@ var livechatTaskConfigs = {
4952
4952
  })
4953
4953
  }
4954
4954
  }
4955
- };
4956
- var livechatTaskTemplates = {
4955
+ });
4956
+ var livechatTaskTemplates = () => ({
4957
4957
  ["LIVECHAT_TAG_CHAT" /* TagChat */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
4958
4958
  name: "LIVECHAT_TAG_CHAT" /* TagChat */,
4959
4959
  taskReferenceName: "livechat_tag_chat",
@@ -5051,7 +5051,7 @@ var livechatTaskTemplates = {
5051
5051
  })
5052
5052
  })
5053
5053
  })
5054
- };
5054
+ });
5055
5055
  var TextLiveChatTriggerNames = {
5056
5056
  ChatStarted: `${IntegrationNames4.Text}-${PRODUCT_TYPE.LC}-${TextLivechatEventNames.ChatStarted}`,
5057
5057
  ChatEnded: `${IntegrationNames4.Text}-${PRODUCT_TYPE.LC}-${TextLivechatEventNames.ChatEnded}`,
@@ -5063,7 +5063,7 @@ var TextLiveChatTriggerNames = {
5063
5063
  UserAddedToChat: `${IntegrationNames4.Text}-${PRODUCT_TYPE.LC}-${TextLivechatEventNames.UserAddedToChat}`,
5064
5064
  UserRemovedFromChat: `${IntegrationNames4.Text}-${PRODUCT_TYPE.LC}-${TextLivechatEventNames.UserRemovedFromChat}`
5065
5065
  };
5066
- var livechatTriggerConfigs = {
5066
+ var livechatTriggerConfigs = () => ({
5067
5067
  [TextLiveChatTriggerNames.ChatStarted]: {
5068
5068
  key: TextLiveChatTriggerNames.ChatStarted,
5069
5069
  name: TextLivechatEventNames.ChatStarted,
@@ -5225,8 +5225,8 @@ var livechatTriggerConfigs = {
5225
5225
  output: webhookSpecs.chat_tagged.output
5226
5226
  }
5227
5227
  }
5228
- };
5229
- var livechatTriggerTemplates = {
5228
+ });
5229
+ var livechatTriggerTemplates = () => ({
5230
5230
  [TextLiveChatTriggerNames.ChatEnded]: {
5231
5231
  type: "webhook",
5232
5232
  webhook: {
@@ -5339,7 +5339,7 @@ var livechatTriggerTemplates = {
5339
5339
  }
5340
5340
  }
5341
5341
  }
5342
- };
5342
+ });
5343
5343
 
5344
5344
  // src/views/Flows/Definitions/Mocks/MailChimp/index.ts
5345
5345
  import {
@@ -5530,7 +5530,7 @@ var webhookSpecs2 = {
5530
5530
  }
5531
5531
  }
5532
5532
  };
5533
- var mailchimpTaskConfigs = {
5533
+ var mailchimpTaskConfigs = () => ({
5534
5534
  ["MAILCHIMP_ADD_SUBSCRIBER" /* AddSubscriber */]: {
5535
5535
  key: "MAILCHIMP_ADD_SUBSCRIBER" /* AddSubscriber */,
5536
5536
  type: WorkflowDefinitionTaskType6.http,
@@ -6595,8 +6595,8 @@ var mailchimpTaskConfigs = {
6595
6595
  })
6596
6596
  }
6597
6597
  }
6598
- };
6599
- var mailchimpTaskTemplates = {
6598
+ });
6599
+ var mailchimpTaskTemplates = () => ({
6600
6600
  ["MAILCHIMP_ADD_SUBSCRIBER" /* AddSubscriber */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
6601
6601
  name: "MAILCHIMP_ADD_SUBSCRIBER" /* AddSubscriber */,
6602
6602
  taskReferenceName: "mailchimp_add_contact",
@@ -6907,12 +6907,12 @@ var mailchimpTaskTemplates = {
6907
6907
  })
6908
6908
  })
6909
6909
  })
6910
- };
6910
+ });
6911
6911
  var MailchimpTriggerNames = {
6912
6912
  Subscribed: `${IntegrationNames5.Mailchimp}-${MailchimpEventNames.Subscribed}`,
6913
6913
  Unsubscribed: `${IntegrationNames5.Mailchimp}-${MailchimpEventNames.Unsubscribed}`
6914
6914
  };
6915
- var mailchimpTriggerConfigs = {
6915
+ var mailchimpTriggerConfigs = () => ({
6916
6916
  [MailchimpTriggerNames.Subscribed]: {
6917
6917
  key: MailchimpTriggerNames.Subscribed,
6918
6918
  name: MailchimpEventNames.Subscribed,
@@ -6967,8 +6967,8 @@ var mailchimpTriggerConfigs = {
6967
6967
  output: webhookSpecs2.new_unsubscriber.output
6968
6968
  }
6969
6969
  }
6970
- };
6971
- var mailchimpTriggerTemplates = {
6970
+ });
6971
+ var mailchimpTriggerTemplates = () => ({
6972
6972
  [MailchimpTriggerNames.Subscribed]: {
6973
6973
  type: "webhook",
6974
6974
  webhook: {
@@ -7005,11 +7005,11 @@ var mailchimpTriggerTemplates = {
7005
7005
  }
7006
7006
  }
7007
7007
  }
7008
- };
7008
+ });
7009
7009
 
7010
7010
  // src/views/Flows/Definitions/Mocks/OpenAI/index.ts
7011
7011
  import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType7 } from "@livechat/developer-studio-api";
7012
- var openAiTaskConfigs = {
7012
+ var openAiTaskConfigs = () => ({
7013
7013
  ["OPENAI_EXTRACT_ORDER_REQUEST" /* ExtractOrderRequest */]: {
7014
7014
  key: "OPENAI_EXTRACT_ORDER_REQUEST" /* ExtractOrderRequest */,
7015
7015
  type: WorkflowDefinitionTaskType7.http,
@@ -7250,8 +7250,8 @@ var openAiTaskConfigs = {
7250
7250
  })
7251
7251
  }
7252
7252
  }
7253
- };
7254
- var openAiTaskTemplates = {
7253
+ });
7254
+ var openAiTaskTemplates = () => ({
7255
7255
  ["OPENAI_EXTRACT_ORDER_REQUEST" /* ExtractOrderRequest */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
7256
7256
  name: "OPENAI_EXTRACT_ORDER_REQUEST" /* ExtractOrderRequest */,
7257
7257
  taskReferenceName: "openai_extract_order_request",
@@ -7341,7 +7341,7 @@ var openAiTaskTemplates = {
7341
7341
  })
7342
7342
  })
7343
7343
  })
7344
- };
7344
+ });
7345
7345
 
7346
7346
  // src/views/Flows/Definitions/Mocks/Shopify/index.ts
7347
7347
  import {
@@ -7769,7 +7769,7 @@ var webhookSpecs3 = {
7769
7769
  }
7770
7770
  }
7771
7771
  };
7772
- var shopifyTaskConfigs = {
7772
+ var shopifyTaskConfigs = () => ({
7773
7773
  ["SHOPIFY_CREATE_CUSTOMER" /* CreateCustomer */]: {
7774
7774
  key: "SHOPIFY_CREATE_CUSTOMER" /* CreateCustomer */,
7775
7775
  type: WorkflowDefinitionTaskType8.http,
@@ -7799,9 +7799,7 @@ var shopifyTaskConfigs = {
7799
7799
  ["SHOPIFY_CREATE_ORDER" /* CreateOrder */]: {
7800
7800
  key: "SHOPIFY_CREATE_ORDER" /* CreateOrder */,
7801
7801
  type: WorkflowDefinitionTaskType8.http,
7802
- url: `${getWorkflowsEnv(
7803
- "workflowsApiUr"
7804
- )}/functions/create-shopify-order`,
7802
+ url: `${getWorkflowsEnv("workflowsApiUr")}/functions/create-shopify-order`,
7805
7803
  customization: {
7806
7804
  provider: IntegrationNames6.Shopify,
7807
7805
  product: IntegrationDisplayNames4.Shopify,
@@ -7899,9 +7897,7 @@ var shopifyTaskConfigs = {
7899
7897
  ["SHOPIFY_GET_CUSTOMER" /* GetCustomer */]: {
7900
7898
  key: "SHOPIFY_GET_CUSTOMER" /* GetCustomer */,
7901
7899
  type: WorkflowDefinitionTaskType8.http,
7902
- url: `${getWorkflowsEnv(
7903
- "workflowsApiUr"
7904
- )}/functions/get-shopify-customer`,
7900
+ url: `${getWorkflowsEnv("workflowsApiUr")}/functions/get-shopify-customer`,
7905
7901
  customization: {
7906
7902
  provider: IntegrationNames6.Shopify,
7907
7903
  product: IntegrationDisplayNames4.Shopify,
@@ -8128,9 +8124,7 @@ var shopifyTaskConfigs = {
8128
8124
  ["SHOPIFY_UPDATE_ORDER" /* UpdateOrder */]: {
8129
8125
  type: WorkflowDefinitionTaskType8.http,
8130
8126
  key: "SHOPIFY_UPDATE_ORDER" /* UpdateOrder */,
8131
- url: `${getWorkflowsEnv(
8132
- "workflowsApiUr"
8133
- )}/functions/update-shopify-order`,
8127
+ url: `${getWorkflowsEnv("workflowsApiUr")}/functions/update-shopify-order`,
8134
8128
  customization: {
8135
8129
  provider: IntegrationNames6.Shopify,
8136
8130
  product: IntegrationDisplayNames4.Shopify,
@@ -8225,8 +8219,8 @@ var shopifyTaskConfigs = {
8225
8219
  })
8226
8220
  }
8227
8221
  }
8228
- };
8229
- var shopifyTaskTemplates = {
8222
+ });
8223
+ var shopifyTaskTemplates = () => ({
8230
8224
  ["SHOPIFY_CREATE_CUSTOMER" /* CreateCustomer */]: __spreadProps(__spreadValues({}, workflowHttpTask), {
8231
8225
  name: "SHOPIFY_CREATE_CUSTOMER" /* CreateCustomer */,
8232
8226
  taskReferenceName: "shopify_create_customer",
@@ -8504,11 +8498,11 @@ var shopifyTaskTemplates = {
8504
8498
  })
8505
8499
  })
8506
8500
  })
8507
- };
8501
+ });
8508
8502
  var ShopifyTriggerNames = {
8509
8503
  OrderCreated: `${IntegrationNames6.Shopify}-${ShopifyEventNames.OrderCreated}`
8510
8504
  };
8511
- var shopifyTriggerConfigs = {
8505
+ var shopifyTriggerConfigs = () => ({
8512
8506
  [ShopifyTriggerNames.OrderCreated]: {
8513
8507
  key: ShopifyTriggerNames.OrderCreated,
8514
8508
  name: ShopifyEventNames.OrderCreated,
@@ -8525,8 +8519,8 @@ var shopifyTriggerConfigs = {
8525
8519
  output: webhookSpecs3.new_paid_order.output
8526
8520
  }
8527
8521
  }
8528
- };
8529
- var shopifyTriggerTemplates = {
8522
+ });
8523
+ var shopifyTriggerTemplates = () => ({
8530
8524
  [ShopifyTriggerNames.OrderCreated]: {
8531
8525
  type: "webhook",
8532
8526
  webhook: {
@@ -8542,33 +8536,49 @@ var shopifyTriggerTemplates = {
8542
8536
  }
8543
8537
  }
8544
8538
  }
8545
- };
8539
+ });
8546
8540
 
8547
8541
  // src/views/Flows/Definitions/api.mocks.ts
8548
- var workflowItemConfigs = {
8549
- tasks: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, livechatTaskConfigs), helpdeskTaskConfigs), mailchimpTaskConfigs), shopifyTaskConfigs), hubspotTaskConfigs), bigCommerceTaskConfigs), openAiTaskConfigs), systemTaskConfigs),
8550
- triggers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, livechatTriggerConfigs), mailchimpTriggerConfigs), shopifyTriggerConfigs), hubspotTriggerConfigs), bigcommerceTriggerConfigs), systemTriggerConfigs)
8542
+ var WorkflowItemsConfiguration = class {
8543
+ constructor() {
8544
+ this.configs = getWorkflowItemConfigs();
8545
+ this.templates = getWorkflowItemTemplates();
8546
+ }
8547
+ static get config() {
8548
+ const instance = this._instance || (this._instance = new this());
8549
+ return instance.configs;
8550
+ }
8551
+ static get templates() {
8552
+ const instance = this._instance || (this._instance = new this());
8553
+ return instance.templates;
8554
+ }
8551
8555
  };
8552
- var workflowItemTemplates = {
8556
+ var getWorkflowItemConfigs = () => {
8557
+ return {
8558
+ tasks: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, livechatTaskConfigs()), helpdeskTaskConfigs()), mailchimpTaskConfigs()), shopifyTaskConfigs()), hubspotTaskConfigs()), bigCommerceTaskConfigs()), openAiTaskConfigs()), systemTaskConfigs()),
8559
+ triggers: __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, livechatTriggerConfigs()), mailchimpTriggerConfigs()), shopifyTriggerConfigs()), hubspotTriggerConfigs()), bigcommerceTriggerConfigs()), systemTriggerConfigs())
8560
+ };
8561
+ };
8562
+ var getWorkflowItemTemplates = () => ({
8553
8563
  tasks: {
8554
- livechat: livechatTaskTemplates,
8555
- helpdesk: helpdeskTaskTemplates,
8556
- mailchimp: mailchimpTaskTemplates,
8557
- hubspot: hubspotTaskTemplates,
8558
- bigcommerce: bigCommerceTaskTemplates,
8559
- shopify: shopifyTaskTemplates,
8560
- openai: openAiTaskTemplates,
8561
- system: systemTaskTemplates
8564
+ livechat: livechatTaskTemplates(),
8565
+ helpdesk: helpdeskTaskTemplates(),
8566
+ mailchimp: mailchimpTaskTemplates(),
8567
+ hubspot: hubspotTaskTemplates(),
8568
+ bigcommerce: bigCommerceTaskTemplates(),
8569
+ shopify: shopifyTaskTemplates(),
8570
+ openai: openAiTaskTemplates(),
8571
+ system: systemTaskTemplates()
8562
8572
  },
8563
8573
  triggers: {
8564
- livechat: livechatTriggerTemplates,
8565
- mailchimp: mailchimpTriggerTemplates,
8566
- shopify: shopifyTriggerTemplates,
8567
- hubspot: hubSpotTriggerTemplates,
8568
- bigcommerce: bigcommerceTriggerTemplates,
8569
- system: systemTriggerTemplates
8574
+ livechat: livechatTriggerTemplates(),
8575
+ mailchimp: mailchimpTriggerTemplates(),
8576
+ shopify: shopifyTriggerTemplates(),
8577
+ hubspot: hubSpotTriggerTemplates(),
8578
+ bigcommerce: bigcommerceTriggerTemplates(),
8579
+ system: systemTriggerTemplates()
8570
8580
  }
8571
- };
8581
+ });
8572
8582
 
8573
8583
  // src/views/Flows/Definitions/Common/Builder/config/workflow.ts
8574
8584
  var NEW_WORKFLOW_TEMPLATE = {
@@ -8719,9 +8729,40 @@ var WORKFLOW_TERMINATE_TASK_SCHEMA = {
8719
8729
  }
8720
8730
  }
8721
8731
  };
8722
- var WORKFLOW_SCHEMA = {
8732
+ var WORKFLOW_SCHEMA_DEFS = {
8733
+ $defs: {
8734
+ mailchimp_audience: {
8735
+ "x-ref": {
8736
+ request: {
8737
+ url: "http://${credential.server}.mailchimp.com/api/audience",
8738
+ method: "GET",
8739
+ headers: {
8740
+ authorization: "${credential.token}"
8741
+ },
8742
+ body: {}
8743
+ },
8744
+ displayField: "name",
8745
+ valueField: "id"
8746
+ }
8747
+ },
8748
+ mailchimp_campaign: {
8749
+ "x-ref": {
8750
+ request: {
8751
+ url: "http://${credential.server}.mailchimp.com/api/campaign",
8752
+ method: "GET",
8753
+ headers: {
8754
+ authorization: "${credential.token}"
8755
+ },
8756
+ body: {}
8757
+ },
8758
+ displayField: "name",
8759
+ valueField: "id"
8760
+ }
8761
+ }
8762
+ }
8763
+ };
8764
+ var WORKFLOW_SCHEMA = () => ({
8723
8765
  $schema: "http://json-schema.org/draft-07/schema",
8724
- $id: "http://example.com/example.json",
8725
8766
  type: "object",
8726
8767
  title: "The root schema",
8727
8768
  description: "The root schema comprises the entire JSON document.",
@@ -8867,20 +8908,22 @@ var WORKFLOW_SCHEMA = {
8867
8908
  },
8868
8909
  then: WORKFLOW_HTTP_TASK_SCHEMA()
8869
8910
  },
8870
- ...Object.values(workflowItemConfigs.tasks).map((config4) => {
8871
- var _a, _b;
8872
- return {
8873
- if: {
8874
- properties: {
8875
- type: { const: WorkflowDefinitionTaskType9.http },
8876
- name: { const: config4.key }
8877
- }
8878
- },
8879
- then: WORKFLOW_HTTP_TASK_SCHEMA(config4.key, {
8880
- body: (_b = (_a = config4.specification.input) == null ? void 0 : _a.properties) == null ? void 0 : _b.body
8881
- })
8882
- };
8883
- })
8911
+ ...Object.values(WorkflowItemsConfiguration.config.tasks).map(
8912
+ (config2) => {
8913
+ var _a, _b;
8914
+ return {
8915
+ if: {
8916
+ properties: {
8917
+ type: { const: WorkflowDefinitionTaskType9.http },
8918
+ name: { const: config2.key }
8919
+ }
8920
+ },
8921
+ then: WORKFLOW_HTTP_TASK_SCHEMA(config2.key, {
8922
+ body: (_b = (_a = config2.specification.input) == null ? void 0 : _a.properties) == null ? void 0 : _b.body
8923
+ })
8924
+ };
8925
+ }
8926
+ )
8884
8927
  ]
8885
8928
  }
8886
8929
  },
@@ -8968,92 +9011,65 @@ var WORKFLOW_SCHEMA = {
8968
9011
  description: "This object holds the declaration of your workflow trigger.",
8969
9012
  default: {},
8970
9013
  allOf: [
8971
- ...Object.values(workflowItemConfigs.triggers).map((config4) => {
8972
- var _a, _b;
8973
- if (config4.type === "webhook") {
8974
- return {
8975
- if: {
8976
- properties: {
8977
- type: { const: config4.type }
8978
- }
8979
- },
8980
- then: {
8981
- required: ["type", "webhook"],
8982
- properties: {
8983
- type: { const: "webhook" },
8984
- webhook: {
8985
- if: {
8986
- properties: {
8987
- source: { const: config4.customization.provider }
8988
- }
8989
- },
8990
- then: {
8991
- required: ["source", "event", "headers"],
8992
- properties: {
8993
- source: { const: config4.customization.provider },
8994
- event: {
8995
- if: {
8996
- properties: {
8997
- name: { const: config4.name }
8998
- }
8999
- },
9000
- then: (_a = config4.specification.input) != null ? _a : {}
9014
+ ...Object.values(WorkflowItemsConfiguration.config.triggers).map(
9015
+ (config2) => {
9016
+ var _a, _b;
9017
+ if (config2.type === "webhook") {
9018
+ return {
9019
+ if: {
9020
+ properties: {
9021
+ type: { const: config2.type }
9022
+ }
9023
+ },
9024
+ then: {
9025
+ required: ["type", "webhook"],
9026
+ properties: {
9027
+ type: { const: "webhook" },
9028
+ webhook: {
9029
+ if: {
9030
+ properties: {
9031
+ source: { const: config2.customization.provider }
9032
+ }
9033
+ },
9034
+ then: {
9035
+ required: ["source", "event", "headers"],
9036
+ properties: {
9037
+ source: { const: config2.customization.provider },
9038
+ event: {
9039
+ if: {
9040
+ properties: {
9041
+ name: { const: config2.name }
9042
+ }
9043
+ },
9044
+ then: (_a = config2.specification.input) != null ? _a : {}
9045
+ }
9001
9046
  }
9002
9047
  }
9003
9048
  }
9004
9049
  }
9005
9050
  }
9006
- }
9007
- };
9008
- }
9009
- if (config4.type === "system") {
9010
- return {
9011
- if: {
9012
- properties: {
9013
- type: { const: config4.type },
9014
- name: { const: config4.key }
9015
- }
9016
- },
9017
- then: (_b = config4.specification.input) != null ? _b : {}
9018
- };
9051
+ };
9052
+ }
9053
+ if (config2.type === "system") {
9054
+ return {
9055
+ if: {
9056
+ properties: {
9057
+ type: { const: config2.type },
9058
+ name: { const: config2.key }
9059
+ }
9060
+ },
9061
+ then: (_b = config2.specification.input) != null ? _b : {}
9062
+ };
9063
+ }
9064
+ throw new Error("Invalid trigger type");
9019
9065
  }
9020
- throw new Error("Invalid trigger type");
9021
- })
9066
+ )
9022
9067
  ]
9023
9068
  }
9024
9069
  },
9025
9070
  required: ["definition", "trigger"],
9026
- $defs: {
9027
- mailchimp_audience: {
9028
- "x-ref": {
9029
- request: {
9030
- url: "http://${credential.server}.mailchimp.com/api/audience",
9031
- method: "GET",
9032
- headers: {
9033
- authorization: "${credential.token}"
9034
- },
9035
- body: {}
9036
- },
9037
- displayField: "name",
9038
- valueField: "id"
9039
- }
9040
- },
9041
- mailchimp_campaign: {
9042
- "x-ref": {
9043
- request: {
9044
- url: "http://${credential.server}.mailchimp.com/api/campaign",
9045
- method: "GET",
9046
- headers: {
9047
- authorization: "${credential.token}"
9048
- },
9049
- body: {}
9050
- },
9051
- displayField: "name",
9052
- valueField: "id"
9053
- }
9054
- }
9055
- }
9056
- };
9071
+ $defs: WORKFLOW_SCHEMA_DEFS.$defs
9072
+ });
9057
9073
  var JSON_FILE_NAME = "file:///workflow.json";
9058
9074
  function configureMonaco(monaco) {
9059
9075
  monaco.languages.typescript.javascriptDefaults.setEagerModelSync(true);
@@ -9070,7 +9086,7 @@ function configureMonaco(monaco) {
9070
9086
  // id of the first schema
9071
9087
  fileMatch: [modelUri.toString()],
9072
9088
  // associate with our model
9073
- schema: WORKFLOW_SCHEMA
9089
+ schema: WORKFLOW_SCHEMA()
9074
9090
  }
9075
9091
  ]
9076
9092
  });
@@ -9473,9 +9489,7 @@ function useWorkflowData(workflow) {
9473
9489
  }
9474
9490
 
9475
9491
  // src/views/Flows/Definitions/Common/Builder/Context/state/metadata/framing/utils.ts
9476
- import {
9477
- IntegrationNames as IntegrationNames8
9478
- } from "@livechat/developer-studio-api";
9492
+ import { IntegrationNames as IntegrationNames8 } from "@livechat/developer-studio-api";
9479
9493
 
9480
9494
  // src/views/Flows/Definitions/Common/Builder/config/utils.ts
9481
9495
  import { JSONPath } from "jsonpath-plus";
@@ -9696,7 +9710,7 @@ var workflowBuilderUtils = {
9696
9710
  return result;
9697
9711
  },
9698
9712
  getTaskConfig(task2) {
9699
- return workflowItemConfigs.tasks[task2.name];
9713
+ return WorkflowItemsConfiguration.config.tasks[task2.name];
9700
9714
  },
9701
9715
  getTaskConfigByReference(value) {
9702
9716
  const segments = value.split(".");
@@ -9704,7 +9718,7 @@ var workflowBuilderUtils = {
9704
9718
  return;
9705
9719
  }
9706
9720
  const referenceName = segments[0].split("_").slice(0, -1).join("_");
9707
- const task2 = Object.values(workflowItemTemplates.tasks).flatMap((x) => Object.values(x)).find((task3) => task3.taskReferenceName === referenceName);
9721
+ const task2 = Object.values(WorkflowItemsConfiguration.templates).flatMap((x) => Object.values(x)).find((task3) => task3.taskReferenceName === referenceName);
9708
9722
  if (!task2) {
9709
9723
  return;
9710
9724
  }
@@ -9712,9 +9726,9 @@ var workflowBuilderUtils = {
9712
9726
  },
9713
9727
  getTriggerConfig(trigger) {
9714
9728
  if (trigger.type === "webhook" && trigger.webhook) {
9715
- return workflowItemConfigs.triggers[`${trigger.webhook.source}-${trigger.webhook.event.name}`];
9729
+ return WorkflowItemsConfiguration.config.triggers[`${trigger.webhook.source}-${trigger.webhook.event.name}`];
9716
9730
  }
9717
- const triggers = Object.values(workflowItemConfigs.triggers);
9731
+ const triggers = Object.values(WorkflowItemsConfiguration.config.triggers);
9718
9732
  switch (trigger.type) {
9719
9733
  case "recurring":
9720
9734
  return triggers.find((x) => x.key === "scheduled" /* Scheduled */);
@@ -9735,10 +9749,10 @@ var workflowBuilderUtils = {
9735
9749
  }
9736
9750
  };
9737
9751
  }
9738
- const config4 = workflowBuilderUtils.getTriggerConfig({
9752
+ const config2 = workflowBuilderUtils.getTriggerConfig({
9739
9753
  type: "manual_only"
9740
9754
  });
9741
- return config4;
9755
+ return config2;
9742
9756
  },
9743
9757
  getItemConfig(item) {
9744
9758
  var _a;
@@ -10055,9 +10069,7 @@ var useUpdateOrganizationProducts = () => {
10055
10069
  // src/views/Flows/Definitions/Common/Builder/Context/state/metadata/validation/utils.ts
10056
10070
  import Ajv from "ajv";
10057
10071
  import AjvWithErrors from "ajv-errors";
10058
- import {
10059
- IntegrationNames as IntegrationNames9
10060
- } from "@livechat/developer-studio-api";
10072
+ import { IntegrationNames as IntegrationNames9 } from "@livechat/developer-studio-api";
10061
10073
  var ajv = AjvWithErrors(
10062
10074
  new Ajv({
10063
10075
  strict: false,
@@ -10106,7 +10118,7 @@ var getWorkflowValidationErrors = (validationErrors) => {
10106
10118
  return errors;
10107
10119
  };
10108
10120
  var getSchemaError = (workflow, frames) => {
10109
- const validate = ajv.compile(WORKFLOW_SCHEMA);
10121
+ const validate = ajv.compile(WORKFLOW_SCHEMA());
10110
10122
  const resolved = __spreadProps(__spreadValues({}, workflow), {
10111
10123
  definition: __spreadProps(__spreadValues({}, workflow.definition), {
10112
10124
  tasks: workflow.definition.tasks.map(
@@ -10135,7 +10147,7 @@ var getTasksErrors = (workflow, frames, products) => {
10135
10147
  var _a;
10136
10148
  const globalFrame = frames.global;
10137
10149
  const frame = frames.tasks[task2.taskReferenceName];
10138
- const config4 = (_a = frame.__meta) == null ? void 0 : _a.config;
10150
+ const config2 = (_a = frame.__meta) == null ? void 0 : _a.config;
10139
10151
  const resolvingErrors = workflowBuilderUtils.getMatchesInObject(task2).map((match2) => {
10140
10152
  const segments = match2.rawValue.split(".");
10141
10153
  const resolved = workflowBuilderUtils.resolveTextByContext(
@@ -10205,10 +10217,10 @@ var getTasksErrors = (workflow, frames, products) => {
10205
10217
  params: {}
10206
10218
  };
10207
10219
  });
10208
- const activationError = config4 && config4.customization.provider.startsWith(IntegrationNames9.Text) && !products.find(({ product }) => product === config4.customization.product) ? {
10220
+ const activationError = config2 && config2.customization.provider.startsWith(IntegrationNames9.Text) && !products.find(({ product }) => product === config2.customization.product) ? {
10209
10221
  instancePath: `/definition/tasks/${index}`,
10210
10222
  keyword: "activation",
10211
- message: `${config4.customization.product} not activated`,
10223
+ message: `${config2.customization.product} not activated`,
10212
10224
  params: {}
10213
10225
  } : void 0;
10214
10226
  return [
@@ -10221,7 +10233,7 @@ var getTasksErrors = (workflow, frames, products) => {
10221
10233
  var getTriggerErrors = (workflow, frames, products) => {
10222
10234
  var _a;
10223
10235
  const frame = frames.trigger;
10224
- const config4 = (_a = frame == null ? void 0 : frame.__meta) == null ? void 0 : _a.config;
10236
+ const config2 = (_a = frame == null ? void 0 : frame.__meta) == null ? void 0 : _a.config;
10225
10237
  const resolvingErrors = workflowBuilderUtils.getMatchesInObject(workflow.trigger).map((match2) => {
10226
10238
  const segments = match2.rawValue.split(".");
10227
10239
  const resolved = workflowBuilderUtils.resolveTextByContext(
@@ -10269,13 +10281,12 @@ var getTriggerErrors = (workflow, frames, products) => {
10269
10281
  params: {}
10270
10282
  };
10271
10283
  });
10272
- const activationError = config4 && config4.customization.provider.startsWith(IntegrationNames9.Text) && !products.find(({ product }) => product === config4.customization.product) ? {
10284
+ const activationError = config2 && config2.customization.provider.startsWith(IntegrationNames9.Text) && !products.find(({ product }) => product === config2.customization.product) ? {
10273
10285
  instancePath: `/trigger`,
10274
10286
  keyword: "activation",
10275
- message: `${config4.customization.product} not activated`,
10287
+ message: `${config2.customization.product} not activated`,
10276
10288
  params: {}
10277
10289
  } : void 0;
10278
- console.log("activationError: ", activationError);
10279
10290
  return [
10280
10291
  ...resolvingErrors,
10281
10292
  ...connectionErrors,
@@ -10446,11 +10457,12 @@ function WorkflowContextProviderBase({
10446
10457
  updaters: { setWorkflow, setAction, setSelection }
10447
10458
  } = useWorkflowState(workflow, options2);
10448
10459
  const autosaveStateRef = useRef2(state);
10449
- const autosaveWorkflow = useRef2(
10460
+ const autosaveWorkflowRef = useRef2(
10450
10461
  debounce(() => __async(this, null, function* () {
10451
10462
  yield save(true);
10452
10463
  }), 500)
10453
- ).current;
10464
+ );
10465
+ const autosaveWorkflow = autosaveWorkflowRef.current;
10454
10466
  useEffect2(() => {
10455
10467
  return () => {
10456
10468
  autosaveWorkflow.cancel();
@@ -10544,16 +10556,16 @@ function WorkflowContextProviderBase({
10544
10556
  const replaceWorkflow = useCallback2(
10545
10557
  (workflow2) => {
10546
10558
  setWorkflow(workflow2);
10547
- autosaveWorkflow();
10559
+ autosaveWorkflowRef.current();
10548
10560
  },
10549
- [autosaveWorkflow, setWorkflow]
10561
+ [autosaveWorkflowRef, setWorkflow]
10550
10562
  );
10551
10563
  const changeWorkflow = useCallback2(
10552
10564
  (change) => {
10553
10565
  setWorkflow((prevState) => applyChange(prevState, change(prevState)));
10554
- autosaveWorkflow();
10566
+ autosaveWorkflowRef.current();
10555
10567
  },
10556
- [autosaveWorkflow, setWorkflow]
10568
+ [autosaveWorkflowRef, setWorkflow]
10557
10569
  );
10558
10570
  const goToAddTrigger = useCallback2(() => {
10559
10571
  navigate(
@@ -12704,10 +12716,10 @@ import { Row as Row6 } from "@livechat/developer-studio-ui-react";
12704
12716
  function convertToTreeNode(obj, meta, nodeName, path) {
12705
12717
  var _a, _b, _c, _d, _e, _f, _g;
12706
12718
  const index = (_a = obj.__meta) == null ? void 0 : _a.index;
12707
- const config4 = (_b = obj.__meta) == null ? void 0 : _b.config;
12719
+ const config2 = (_b = obj.__meta) == null ? void 0 : _b.config;
12708
12720
  const properties = (_c = obj.__meta) == null ? void 0 : _c.properties;
12709
12721
  const currentSpec = meta.specification;
12710
- const customization = config4 == null ? void 0 : config4.customization;
12722
+ const customization = config2 == null ? void 0 : config2.customization;
12711
12723
  const node2 = meta.dummy ? {
12712
12724
  type: typeof obj,
12713
12725
  name: nodeName,
@@ -12725,7 +12737,7 @@ function convertToTreeNode(obj, meta, nodeName, path) {
12725
12737
  path: `${path != null ? path : ""}`,
12726
12738
  relativePath: meta.baseRelativePath && path && path.startsWith(meta.baseRelativePath) ? path.replace(`${meta.baseRelativePath}.`, "") : "",
12727
12739
  children: [],
12728
- canAddChildren: (_g = config4 == null ? void 0 : config4.specification) == null ? void 0 : _g.additionalProperties,
12740
+ canAddChildren: (_g = config2 == null ? void 0 : config2.specification) == null ? void 0 : _g.additionalProperties,
12729
12741
  __meta: {
12730
12742
  source: {
12731
12743
  index: index != null ? index : meta.index,
@@ -12926,6 +12938,7 @@ function CustomTagsPicker({
12926
12938
 
12927
12939
  // src/views/Flows/Definitions/Common/Builder/Editors/Visual/Forms/Schema/overrides/Fields/CustomTags/TagsInput/Input.tsx
12928
12940
  import { useCallback as useCallback5, useEffect as useEffect4, useRef as useRef5 } from "react";
12941
+ import debounce3 from "lodash.debounce";
12929
12942
  import { Tooltip as Tooltip3 } from "@livechat/design-system-react-components";
12930
12943
 
12931
12944
  // src/views/Flows/Definitions/Common/Builder/Editors/Visual/Forms/Schema/overrides/Fields/CustomTags/TagsInput/Tag/Icon.tsx
@@ -13206,64 +13219,64 @@ function TagifyWrapper({
13206
13219
  };
13207
13220
  }, []);
13208
13221
  useEffect3(() => {
13209
- tagify.current.off("change", onChange).on("change", onChange);
13222
+ tagify.current.off("change").on("change", onChange);
13210
13223
  }, [onChange]);
13211
13224
  useEffect3(() => {
13212
- tagify.current.off("input", onInput).on("input", onInput);
13225
+ tagify.current.off("input").on("input", onInput);
13213
13226
  }, [onInput]);
13214
13227
  useEffect3(() => {
13215
- tagify.current.off("add", onAdd).on("add", onAdd);
13228
+ tagify.current.off("add").on("add", onAdd);
13216
13229
  }, [onAdd]);
13217
13230
  useEffect3(() => {
13218
- tagify.current.off("remove", onRemove).on("remove", onRemove);
13231
+ tagify.current.off("remove").on("remove", onRemove);
13219
13232
  }, [onRemove]);
13220
13233
  useEffect3(() => {
13221
- tagify.current.off("invalid", onInvalid).on("invalid", onInvalid);
13234
+ tagify.current.off("invalid").on("invalid", onInvalid);
13222
13235
  }, [onInvalid]);
13223
13236
  useEffect3(() => {
13224
- tagify.current.off("keydown", onKeydown).on("keydown", onKeydown);
13237
+ tagify.current.off("keydown").on("keydown", onKeydown);
13225
13238
  }, [onKeydown]);
13226
13239
  useEffect3(() => {
13227
- tagify.current.off("focus", onFocus).on("focus", onFocus);
13240
+ tagify.current.off("focus").on("focus", onFocus);
13228
13241
  }, [onFocus]);
13229
13242
  useEffect3(() => {
13230
- tagify.current.off("blur", onBlur).on("blur", onBlur);
13243
+ tagify.current.off("blur").on("blur", onBlur);
13231
13244
  }, [onBlur]);
13232
13245
  useEffect3(() => {
13233
- tagify.current.off("click", onClick).on("click", onClick);
13246
+ tagify.current.off("click").on("click", onClick);
13234
13247
  }, [onClick]);
13235
13248
  useEffect3(() => {
13236
- tagify.current.off("edit:input", onEditInput).on("edit:input", onEditInput);
13249
+ tagify.current.off("edit:input").on("edit:input", onEditInput);
13237
13250
  }, [onEditInput]);
13238
13251
  useEffect3(() => {
13239
- tagify.current.off("edit:beforeUpdate", onEditBeforeUpdate).on("edit:beforeUpdate", onEditBeforeUpdate);
13252
+ tagify.current.off("edit:beforeUpdate").on("edit:beforeUpdate", onEditBeforeUpdate);
13240
13253
  }, [onEditBeforeUpdate]);
13241
13254
  useEffect3(() => {
13242
- tagify.current.off("edit:updated", onEditUpdated).on("edit:updated", onEditUpdated);
13255
+ tagify.current.off("edit:updated").on("edit:updated", onEditUpdated);
13243
13256
  }, [onEditUpdated]);
13244
13257
  useEffect3(() => {
13245
- tagify.current.off("edit:start", onEditStart).on("edit:start", onEditStart);
13258
+ tagify.current.off("edit:start").on("edit:start", onEditStart);
13246
13259
  }, [onEditStart]);
13247
13260
  useEffect3(() => {
13248
- tagify.current.off("edit:keydown", onEditKeydown).on("edit:keydown", onEditKeydown);
13261
+ tagify.current.off("edit:keydown").on("edit:keydown", onEditKeydown);
13249
13262
  }, [onEditKeydown]);
13250
13263
  useEffect3(() => {
13251
- tagify.current.off("dropdown:show", onDropdownShow).on("dropdown:show", onDropdownShow);
13264
+ tagify.current.off("dropdown:show").on("dropdown:show", onDropdownShow);
13252
13265
  }, [onDropdownShow]);
13253
13266
  useEffect3(() => {
13254
- tagify.current.off("dropdown:hide", onDropdownHide).on("dropdown:hide", onDropdownHide);
13267
+ tagify.current.off("dropdown:hide").on("dropdown:hide", onDropdownHide);
13255
13268
  }, [onDropdownHide]);
13256
13269
  useEffect3(() => {
13257
- tagify.current.off("dropdown:select", onDropdownSelect).on("dropdown:select", onDropdownSelect);
13270
+ tagify.current.off("dropdown:select").on("dropdown:select", onDropdownSelect);
13258
13271
  }, [onDropdownSelect]);
13259
13272
  useEffect3(() => {
13260
- tagify.current.off("dropdown:scroll", onDropdownScroll).on("dropdown:scroll", onDropdownScroll);
13273
+ tagify.current.off("dropdown:scroll").on("dropdown:scroll", onDropdownScroll);
13261
13274
  }, [onDropdownScroll]);
13262
13275
  useEffect3(() => {
13263
- tagify.current.off("dropdown:noMatch", onDropdownNoMatch).on("dropdown:noMatch", onDropdownNoMatch);
13276
+ tagify.current.off("dropdown:noMatch").on("dropdown:noMatch", onDropdownNoMatch);
13264
13277
  }, [onDropdownNoMatch]);
13265
13278
  useEffect3(() => {
13266
- tagify.current.off("dropdown:updated", onDropdownUpdated).on("dropdown:updated", onDropdownUpdated);
13279
+ tagify.current.off("dropdown:updated").on("dropdown:updated", onDropdownUpdated);
13267
13280
  }, [onDropdownUpdated]);
13268
13281
  useEffect3(() => {
13269
13282
  setFocus();
@@ -13353,11 +13366,11 @@ var createTagFromPath = (path, frame) => {
13353
13366
  const relativePath = segments.slice(segments[0] === "workflow" ? 2 : 1).join(".");
13354
13367
  const contentRelativePath = segments.slice(segments[0] === "workflow" ? segments[2] === "body" ? 3 : 2 : 4).join(".");
13355
13368
  const meta = frame ? segments[0] === "workflow" ? segments[1] === "input" ? (_a = frame.workflow.input) == null ? void 0 : _a.__meta : segments[1] === "credentials" ? frame.workflow.credentials.__meta : void 0 : (_b = frame[segments[0]]) == null ? void 0 : _b.__meta : void 0;
13356
- const config4 = workflowBuilderUtils.getItemConfigByReference(path);
13357
- const customization = (_d = (_c = meta == null ? void 0 : meta.config) == null ? void 0 : _c.customization) != null ? _d : config4 == null ? void 0 : config4.customization;
13369
+ const config2 = workflowBuilderUtils.getItemConfigByReference(path);
13370
+ const customization = (_d = (_c = meta == null ? void 0 : meta.config) == null ? void 0 : _c.customization) != null ? _d : config2 == null ? void 0 : config2.customization;
13358
13371
  const specification = (_i = workflowBuilderUtils.extractByPath(
13359
13372
  relativePath.split(".").join(".properties."),
13360
- (_h = (_f = (_e = meta == null ? void 0 : meta.config) == null ? void 0 : _e.specification) == null ? void 0 : _f.properties) != null ? _h : (_g = config4 == null ? void 0 : config4.specification.output) == null ? void 0 : _g.properties
13373
+ (_h = (_f = (_e = meta == null ? void 0 : meta.config) == null ? void 0 : _e.specification) == null ? void 0 : _f.properties) != null ? _h : (_g = config2 == null ? void 0 : config2.specification.output) == null ? void 0 : _g.properties
13361
13374
  )) == null ? void 0 : _i[0];
13362
13375
  const data = specification ? {
13363
13376
  title: (_k = (_j = specification.title) != null ? _j : segments.at(-1)) != null ? _k : "",
@@ -13471,10 +13484,13 @@ function CustomTagsInput({
13471
13484
  },
13472
13485
  [updateAllIcons]
13473
13486
  );
13474
- const handleChange = useCallback5(() => {
13475
- onChange(getCurrentValue());
13476
- updateAllIcons();
13477
- }, [onChange, getCurrentValue, updateAllIcons]);
13487
+ const handleChange = useCallback5(
13488
+ debounce3(() => {
13489
+ onChange(getCurrentValue());
13490
+ updateAllIcons();
13491
+ }, 300),
13492
+ [onChange, getCurrentValue, updateAllIcons]
13493
+ );
13478
13494
  const handleKeyDown = useCallback5(
13479
13495
  (e) => {
13480
13496
  if (e.detail.event.key !== "Backspace") {
@@ -14382,7 +14398,7 @@ function CustomSchemaForm(props) {
14382
14398
  props.onChange(formData);
14383
14399
  },
14384
14400
  readonly: props.readonly,
14385
- schema: __spreadProps(__spreadValues({}, (_a = props.schema) != null ? _a : {}), { $defs: WORKFLOW_SCHEMA.$defs }),
14401
+ schema: __spreadProps(__spreadValues({}, (_a = props.schema) != null ? _a : {}), { $defs: WORKFLOW_SCHEMA_DEFS.$defs }),
14386
14402
  showErrorList: false,
14387
14403
  templates: customTemplates,
14388
14404
  validator,
@@ -14509,7 +14525,7 @@ import {
14509
14525
  DesignToken as DesignToken11,
14510
14526
  RadiusToken as RadiusToken3
14511
14527
  } from "@livechat/design-system-react-components";
14512
- import { Fragment as Fragment8, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
14528
+ import { Fragment as Fragment7, jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
14513
14529
  var Wrapper2 = newStyled.div`
14514
14530
  &:hover {
14515
14531
  cursor: pointer;
@@ -14585,7 +14601,7 @@ function CustomNode({
14585
14601
  id,
14586
14602
  data
14587
14603
  }) {
14588
- return /* @__PURE__ */ jsxs3(Fragment8, { children: [
14604
+ return /* @__PURE__ */ jsxs3(Fragment7, { children: [
14589
14605
  /* @__PURE__ */ jsxs3("div", { className: "custom-node__header", children: [
14590
14606
  "This is a ",
14591
14607
  /* @__PURE__ */ jsx5("strong", { children: "custom node" })
@@ -14918,7 +14934,7 @@ function CustomSchemaFormWrapper({
14918
14934
  preselectedTab,
14919
14935
  tabsMetadata
14920
14936
  }) {
14921
- const spec = workflowBuilderUtils.getItemConfig(data);
14937
+ const spec = useMemo3(() => workflowBuilderUtils.getItemConfig(data), [data]);
14922
14938
  const [selectedTab, setSelectedTab] = useState12(
14923
14939
  preselectedTab != null ? preselectedTab : !spec || spec.specification.input ? "parameters" : spec && spec.customization.provider !== OTHER_TYPES.SYSTEM ? "connection" : void 0
14924
14940
  );
@@ -15309,8 +15325,8 @@ function SwitchNode({
15309
15325
  var _a, _b, _c, _d, _e, _f, _g, _h;
15310
15326
  const sourceNode = nodes.find((node1) => node1.id === (node2 == null ? void 0 : node2.source));
15311
15327
  if (sourceNode) {
15312
- const config4 = workflowBuilderUtils.getTaskConfig(sourceNode.data);
15313
- const output = (_b = (_a = config4.specification.output) == null ? void 0 : _a.properties) == null ? void 0 : _b.output;
15328
+ const config2 = workflowBuilderUtils.getTaskConfig(sourceNode.data);
15329
+ const output = (_b = (_a = config2.specification.output) == null ? void 0 : _a.properties) == null ? void 0 : _b.output;
15314
15330
  const body = isJSONSchema7(output) && isJSONSchema7((_c = output.properties) == null ? void 0 : _c.response) && isJSONSchema7((_e = (_d = output.properties) == null ? void 0 : _d.response.properties) == null ? void 0 : _e.body) ? (_h = (_g = (_f = output.properties) == null ? void 0 : _f.response) == null ? void 0 : _g.properties) == null ? void 0 : _h.body : void 0;
15315
15331
  const inputParameters = (body == null ? void 0 : body.type) === "object" ? body.properties : {};
15316
15332
  const formattedInputParameters = {};
@@ -15910,7 +15926,7 @@ function EditNodeWrapper() {
15910
15926
  if (!data) {
15911
15927
  return /* @__PURE__ */ jsx2(Fragment4, {});
15912
15928
  }
15913
- const config4 = (_b = frame == null ? void 0 : frame.__meta) == null ? void 0 : _b.config;
15929
+ const config2 = (_b = frame == null ? void 0 : frame.__meta) == null ? void 0 : _b.config;
15914
15930
  const readonly = !workflow.draft;
15915
15931
  const contentHandler = () => {
15916
15932
  var _a2, _b2;
@@ -15995,7 +16011,7 @@ function EditNodeWrapper() {
15995
16011
  );
15996
16012
  }
15997
16013
  };
15998
- const revertIconColor = getWorkflowsEnv("isHeadless") && ((config4 == null ? void 0 : config4.customization.icon) === IntegrationNames14.OpenAI || (config4 == null ? void 0 : config4.customization.icon) === IntegrationNames14.BigCommerce);
16014
+ const revertIconColor = getWorkflowsEnv("isHeadless") && ((config2 == null ? void 0 : config2.customization.icon) === IntegrationNames14.OpenAI || (config2 == null ? void 0 : config2.customization.icon) === IntegrationNames14.BigCommerce);
15999
16015
  return /* @__PURE__ */ jsxs2(Wrapper3, { children: [
16000
16016
  /* @__PURE__ */ jsxs2(Row11, { center: true, setRowPadding: "12px 24px", spaceBetween: true, children: [
16001
16017
  /* @__PURE__ */ jsx2(
@@ -16005,13 +16021,13 @@ function EditNodeWrapper() {
16005
16021
  max-width: 80%;
16006
16022
  `,
16007
16023
  children: /* @__PURE__ */ jsxs2(Title6, { children: [
16008
- (config4 == null ? void 0 : config4.customization.product) ? /* @__PURE__ */ jsx2(
16024
+ (config2 == null ? void 0 : config2.customization.product) ? /* @__PURE__ */ jsx2(
16009
16025
  ProductIcon_default,
16010
16026
  {
16011
16027
  center: true,
16012
16028
  disabled: false,
16013
16029
  height: 10,
16014
- product: config4.customization.icon,
16030
+ product: config2.customization.icon,
16015
16031
  revertColors: revertIconColor,
16016
16032
  width: 10
16017
16033
  }
@@ -16028,9 +16044,9 @@ function EditNodeWrapper() {
16028
16044
  /* @__PURE__ */ jsxs2(Column10, { noFlexBasis: true, notPadded: true, children: [
16029
16045
  /* @__PURE__ */ jsxs2("strong", { children: [
16030
16046
  ((_c = frame == null ? void 0 : frame.__meta) == null ? void 0 : _c.index) !== void 0 ? `${frame.__meta.index}. ` : "",
16031
- (_d = config4 == null ? void 0 : config4.customization.displayName) != null ? _d : data.type === NodeTypes.switch ? "Condition" : data.type === NodeTypes.http ? "Custom HTTP" : data.type === NodeTypes.terminate ? "End workflow" : ""
16047
+ (_d = config2 == null ? void 0 : config2.customization.displayName) != null ? _d : data.type === NodeTypes.switch ? "Condition" : data.type === NodeTypes.http ? "Custom HTTP" : data.type === NodeTypes.terminate ? "End workflow" : ""
16032
16048
  ] }),
16033
- (_e = config4 == null ? void 0 : config4.customization.description) != null ? _e : data.type === NodeTypes.switch ? "Conditional execution" : data.type === NodeTypes.http ? "Make an HTTP request" : data.type === NodeTypes.terminate ? "End the workflow" : ""
16049
+ (_e = config2 == null ? void 0 : config2.customization.description) != null ? _e : data.type === NodeTypes.switch ? "Conditional execution" : data.type === NodeTypes.http ? "Make an HTTP request" : data.type === NodeTypes.terminate ? "End the workflow" : ""
16034
16050
  ] })
16035
16051
  ] })
16036
16052
  }
@@ -16931,7 +16947,7 @@ import { useRef as useRef8 } from "react";
16931
16947
 
16932
16948
  // src/views/Flows/Definitions/Common/One/hooks/use-scroll.ts
16933
16949
  import { useCallback as useCallback11, useEffect as useEffect11, useRef as useRef7 } from "react";
16934
- import debounce3 from "lodash.debounce";
16950
+ import debounce4 from "lodash.debounce";
16935
16951
  var useScroll = ({
16936
16952
  oneChatFeedRef,
16937
16953
  groupedEvents,
@@ -16987,7 +17003,7 @@ var useScroll = ({
16987
17003
  currentScrollPosition.current = (_a = container2.scrollTop) != null ? _a : null;
16988
17004
  isScrolledToBottom.current = container2.scrollHeight - container2.scrollTop - container2.clientHeight < 1;
16989
17005
  };
16990
- const debouncedScroll = debounce3(handleScroll, 200);
17006
+ const debouncedScroll = debounce4(handleScroll, 200);
16991
17007
  return {
16992
17008
  handleScroll: debouncedScroll,
16993
17009
  handleScrollToBottom: scrollToBottom
@@ -18435,7 +18451,7 @@ import { useState as useState24 } from "react";
18435
18451
  import { useLocation as useLocation3, useNavigate as useNavigate5 } from "react-router-dom";
18436
18452
  import { Controls as Controls2 } from "reactflow";
18437
18453
  import { SegmentedControl } from "@livechat/design-system-react-components";
18438
- import { Fragment as Fragment15, jsx as jsx9 } from "react/jsx-runtime";
18454
+ import { Fragment as Fragment14, jsx as jsx9 } from "react/jsx-runtime";
18439
18455
  function SwitcherControls({
18440
18456
  isDraft,
18441
18457
  hasRelatedWorkflow,
@@ -18478,7 +18494,7 @@ function SwitcherControls({
18478
18494
  }
18479
18495
  };
18480
18496
  if (!visibility.switcher || !isDraft && !hasRelatedWorkflow) {
18481
- return /* @__PURE__ */ jsx9(Fragment15, {});
18497
+ return /* @__PURE__ */ jsx9(Fragment14, {});
18482
18498
  }
18483
18499
  const handleVersionClick = (id) => {
18484
18500
  if (id === "draft" && isDraft) {
@@ -18577,7 +18593,7 @@ var Edges_default = CustomEdge_default;
18577
18593
 
18578
18594
  // src/views/Flows/Definitions/Common/Builder/Editors/Visual/Diagram/Diagram.tsx
18579
18595
  import "reactflow/dist/style.css";
18580
- import { Fragment as Fragment17, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
18596
+ import { Fragment as Fragment16, jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
18581
18597
  var nodeConfig = {
18582
18598
  [WorkflowDefinitionTaskType14.http]: Node_default2,
18583
18599
  [WorkflowDefinitionTaskType14.forkJoin]: Node_default,
@@ -18666,7 +18682,7 @@ function Diagram({
18666
18682
  if (!workflow.draft && isRawEditorVisible) {
18667
18683
  onRawEditorToggle && onRawEditorToggle();
18668
18684
  }
18669
- return /* @__PURE__ */ jsxs5(Fragment17, { children: [
18685
+ return /* @__PURE__ */ jsxs5(Fragment16, { children: [
18670
18686
  /* @__PURE__ */ jsxs5(
18671
18687
  ReactFlow,
18672
18688
  {
@@ -19162,7 +19178,7 @@ function ExecuteWorkflow({ workflow, onClose }) {
19162
19178
  var Execute_default = ExecuteWorkflow;
19163
19179
 
19164
19180
  // src/views/Flows/Definitions/Edit/Tasks/Add.tsx
19165
- import { useEffect as useEffect15, useState as useState26 } from "react";
19181
+ import { useEffect as useEffect15, useMemo as useMemo5, useState as useState26 } from "react";
19166
19182
  import { NavLink, useLocation as useLocation5, useNavigate as useNavigate8, useParams as useParams2 } from "react-router-dom";
19167
19183
  import {
19168
19184
  Button as Button26,
@@ -19273,117 +19289,148 @@ function AddWorkflowTaskOptions({
19273
19289
  var Options_default = AddWorkflowTaskOptions;
19274
19290
 
19275
19291
  // src/views/Flows/Definitions/Edit/Tasks/Add.tsx
19276
- var config2 = [
19277
- // {
19278
- // name: 'system',
19279
- // displayName: 'System tasks',
19280
- // icon: (
19281
- // <ProductIcon
19282
- // product={OTHER_TYPES.SYSTEM}
19283
- // center={undefined}
19284
- // height={5}
19285
- // width={5}
19286
- // disabled={undefined}
19287
- // />
19288
- // ),
19289
- // values: Object.values(systemTaskConfigs).map((x) => ({
19290
- // key: x.key,
19291
- // name: x.customization.displayName,
19292
- // shortDescription: x.customization.shortDescription,
19293
- // secondaryText: x.customization.description,
19294
- // })),
19295
- // },
19296
- {
19297
- name: PRODUCT_TYPE.LC,
19298
- displayName: PRODUCT_NAMES.livechat,
19299
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: PRODUCT_TYPE.LC, width: 5 }),
19300
- values: Object.values(livechatTaskConfigs).map((x) => ({
19301
- key: x.key,
19302
- name: x.customization.displayName,
19303
- shortDescription: x.customization.shortDescription,
19304
- secondaryText: x.customization.description
19305
- }))
19306
- },
19307
- {
19308
- name: PRODUCT_TYPE.HD,
19309
- displayName: PRODUCT_NAMES.helpdesk,
19310
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { center: true, height: 5, product: PRODUCT_TYPE.HD, width: 5 }),
19311
- values: Object.values(helpdeskTaskConfigs).map((x) => ({
19312
- key: x.key,
19313
- name: x.customization.displayName,
19314
- shortDescription: x.customization.shortDescription,
19315
- secondaryText: x.customization.description
19316
- }))
19317
- },
19318
- {
19319
- name: OTHER_PRODUCT_TYPE.OPENAI,
19320
- displayName: "OpenAI",
19321
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: OTHER_PRODUCT_TYPE.OPENAI, width: 5 }),
19322
- values: Object.values(openAiTaskConfigs).map((x) => ({
19323
- key: x.key,
19324
- name: x.customization.displayName,
19325
- shortDescription: x.customization.shortDescription,
19326
- secondaryText: x.customization.description
19327
- }))
19328
- },
19329
- {
19330
- name: IntegrationNames15.Mailchimp,
19331
- displayName: IntegrationDisplayNames5.Mailchimp,
19332
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: IntegrationNames15.Mailchimp, width: 5 }),
19333
- values: Object.values(mailchimpTaskConfigs).map((x) => ({
19334
- key: x.key,
19335
- name: x.customization.displayName,
19336
- shortDescription: x.customization.shortDescription,
19337
- secondaryText: x.customization.description
19338
- }))
19339
- },
19340
- {
19341
- name: IntegrationNames15.HubSpot,
19342
- displayName: IntegrationDisplayNames5.HubSpot,
19343
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: IntegrationNames15.HubSpot, width: 5 }),
19344
- values: Object.values(hubspotTaskConfigs).map((x) => ({
19345
- key: x.key,
19346
- name: x.customization.displayName,
19347
- shortDescription: x.customization.shortDescription,
19348
- secondaryText: x.customization.description
19349
- }))
19350
- },
19351
- {
19352
- name: IntegrationNames15.BigCommerce,
19353
- displayName: IntegrationDisplayNames5.BigCommerce,
19354
- icon: /* @__PURE__ */ jsx2(
19355
- ProductIcon_default,
19356
- {
19357
- height: 5,
19358
- product: IntegrationNames15.BigCommerce,
19359
- width: 5
19360
- }
19361
- ),
19362
- values: Object.values(bigCommerceTaskConfigs).map((x) => ({
19363
- key: x.key,
19364
- name: x.customization.displayName,
19365
- shortDescription: x.customization.shortDescription,
19366
- secondaryText: x.customization.description
19367
- }))
19368
- },
19369
- {
19370
- name: IntegrationNames15.Shopify,
19371
- displayName: IntegrationDisplayNames5.Shopify,
19372
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: IntegrationNames15.Shopify, width: 5 }),
19373
- values: Object.values(shopifyTaskConfigs).map((x) => ({
19374
- key: x.key,
19375
- name: x.customization.displayName,
19376
- shortDescription: x.customization.shortDescription,
19377
- secondaryText: x.customization.description
19378
- }))
19379
- }
19380
- ];
19381
19292
  function AddWorkflowTask({ basePath, onClose }) {
19382
19293
  const [search, setSearch] = useState26("");
19383
19294
  const location = useLocation5();
19384
19295
  const navigate = useNavigate8();
19385
19296
  const params = useParams2();
19386
19297
  const [state, setState] = useState26();
19298
+ const config2 = useMemo5(
19299
+ () => [
19300
+ // {
19301
+ // name: 'system',
19302
+ // displayName: 'System tasks',
19303
+ // icon: (
19304
+ // <ProductIcon
19305
+ // product={OTHER_TYPES.SYSTEM}
19306
+ // center={undefined}
19307
+ // height={5}
19308
+ // width={5}
19309
+ // disabled={undefined}
19310
+ // />
19311
+ // ),
19312
+ // values: Object.values(systemTaskConfigs()).map((x) => ({
19313
+ // key: x.key,
19314
+ // name: x.customization.displayName,
19315
+ // shortDescription: x.customization.shortDescription,
19316
+ // secondaryText: x.customization.description,
19317
+ // })),
19318
+ // },
19319
+ {
19320
+ name: PRODUCT_TYPE.LC,
19321
+ displayName: PRODUCT_NAMES.livechat,
19322
+ icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: PRODUCT_TYPE.LC, width: 5 }),
19323
+ values: Object.values(livechatTaskConfigs()).map((x) => ({
19324
+ key: x.key,
19325
+ name: x.customization.displayName,
19326
+ shortDescription: x.customization.shortDescription,
19327
+ secondaryText: x.customization.description
19328
+ }))
19329
+ },
19330
+ {
19331
+ name: PRODUCT_TYPE.HD,
19332
+ displayName: PRODUCT_NAMES.helpdesk,
19333
+ icon: /* @__PURE__ */ jsx2(ProductIcon_default, { center: true, height: 5, product: PRODUCT_TYPE.HD, width: 5 }),
19334
+ values: Object.values(helpdeskTaskConfigs()).map((x) => ({
19335
+ key: x.key,
19336
+ name: x.customization.displayName,
19337
+ shortDescription: x.customization.shortDescription,
19338
+ secondaryText: x.customization.description
19339
+ }))
19340
+ },
19341
+ {
19342
+ name: OTHER_PRODUCT_TYPE.OPENAI,
19343
+ displayName: "OpenAI",
19344
+ icon: /* @__PURE__ */ jsx2(
19345
+ ProductIcon_default,
19346
+ {
19347
+ height: 5,
19348
+ product: OTHER_PRODUCT_TYPE.OPENAI,
19349
+ width: 5
19350
+ }
19351
+ ),
19352
+ values: Object.values(openAiTaskConfigs()).map((x) => ({
19353
+ key: x.key,
19354
+ name: x.customization.displayName,
19355
+ shortDescription: x.customization.shortDescription,
19356
+ secondaryText: x.customization.description
19357
+ }))
19358
+ },
19359
+ {
19360
+ name: IntegrationNames15.Mailchimp,
19361
+ displayName: IntegrationDisplayNames5.Mailchimp,
19362
+ icon: /* @__PURE__ */ jsx2(
19363
+ ProductIcon_default,
19364
+ {
19365
+ height: 5,
19366
+ product: IntegrationNames15.Mailchimp,
19367
+ width: 5
19368
+ }
19369
+ ),
19370
+ values: Object.values(mailchimpTaskConfigs()).map((x) => ({
19371
+ key: x.key,
19372
+ name: x.customization.displayName,
19373
+ shortDescription: x.customization.shortDescription,
19374
+ secondaryText: x.customization.description
19375
+ }))
19376
+ },
19377
+ {
19378
+ name: IntegrationNames15.HubSpot,
19379
+ displayName: IntegrationDisplayNames5.HubSpot,
19380
+ icon: /* @__PURE__ */ jsx2(
19381
+ ProductIcon_default,
19382
+ {
19383
+ height: 5,
19384
+ product: IntegrationNames15.HubSpot,
19385
+ width: 5
19386
+ }
19387
+ ),
19388
+ values: Object.values(hubspotTaskConfigs()).map((x) => ({
19389
+ key: x.key,
19390
+ name: x.customization.displayName,
19391
+ shortDescription: x.customization.shortDescription,
19392
+ secondaryText: x.customization.description
19393
+ }))
19394
+ },
19395
+ {
19396
+ name: IntegrationNames15.BigCommerce,
19397
+ displayName: IntegrationDisplayNames5.BigCommerce,
19398
+ icon: /* @__PURE__ */ jsx2(
19399
+ ProductIcon_default,
19400
+ {
19401
+ height: 5,
19402
+ product: IntegrationNames15.BigCommerce,
19403
+ width: 5
19404
+ }
19405
+ ),
19406
+ values: Object.values(bigCommerceTaskConfigs()).map((x) => ({
19407
+ key: x.key,
19408
+ name: x.customization.displayName,
19409
+ shortDescription: x.customization.shortDescription,
19410
+ secondaryText: x.customization.description
19411
+ }))
19412
+ },
19413
+ {
19414
+ name: IntegrationNames15.Shopify,
19415
+ displayName: IntegrationDisplayNames5.Shopify,
19416
+ icon: /* @__PURE__ */ jsx2(
19417
+ ProductIcon_default,
19418
+ {
19419
+ height: 5,
19420
+ product: IntegrationNames15.Shopify,
19421
+ width: 5
19422
+ }
19423
+ ),
19424
+ values: Object.values(shopifyTaskConfigs()).map((x) => ({
19425
+ key: x.key,
19426
+ name: x.customization.displayName,
19427
+ shortDescription: x.customization.shortDescription,
19428
+ secondaryText: x.customization.description
19429
+ }))
19430
+ }
19431
+ ],
19432
+ []
19433
+ );
19387
19434
  const {
19388
19435
  addTask,
19389
19436
  state: { workflow }
@@ -19400,7 +19447,8 @@ function AddWorkflowTask({ basePath, onClose }) {
19400
19447
  state: location.state
19401
19448
  });
19402
19449
  }
19403
- const tasks = params.service ? workflowItemTemplates.tasks[params.service] : void 0;
19450
+ const templates = WorkflowItemsConfiguration.templates;
19451
+ const tasks = params.service ? templates.tasks[params.service] : void 0;
19404
19452
  const task2 = params.task && tasks ? tasks[params.task] : void 0;
19405
19453
  const suggestions = workflowBuilderUtils.stringifyToObjectKeyArray(
19406
19454
  (_d = location.state.frame) != null ? _d : {},
@@ -19614,7 +19662,7 @@ function AddWorkflowTask({ basePath, onClose }) {
19614
19662
  var Add_default = AddWorkflowTask;
19615
19663
 
19616
19664
  // src/views/Flows/Definitions/Edit/Triggers/Add.tsx
19617
- import { useEffect as useEffect16, useState as useState27 } from "react";
19665
+ import { useEffect as useEffect16, useMemo as useMemo6, useState as useState27 } from "react";
19618
19666
  import { NavLink as NavLink2, useLocation as useLocation6, useNavigate as useNavigate9, useParams as useParams3 } from "react-router-dom";
19619
19667
  import {
19620
19668
  Button as Button27,
@@ -19725,86 +19773,110 @@ function AddWorkflowTriggerOptions({
19725
19773
  var Options_default2 = AddWorkflowTriggerOptions;
19726
19774
 
19727
19775
  // src/views/Flows/Definitions/Edit/Triggers/Add.tsx
19728
- var config3 = [
19729
- {
19730
- name: OTHER_TYPES.SYSTEM,
19731
- displayName: "General",
19732
- icon: /* @__PURE__ */ jsx2(
19733
- ProductIcon_default,
19776
+ function AddWorkflowTrigger({ basePath, onClose }) {
19777
+ const [search, setSearch] = useState27("");
19778
+ const config2 = useMemo6(
19779
+ () => [
19734
19780
  {
19735
- center: void 0,
19736
- disabled: void 0,
19737
- height: 5,
19738
- product: OTHER_TYPES.SYSTEM,
19739
- width: 5
19740
- }
19741
- ),
19742
- values: Object.values(systemTriggerConfigs).map((x) => ({
19743
- key: x.key,
19744
- name: x.customization.displayName,
19745
- secondaryText: x.customization.description
19746
- }))
19747
- },
19748
- {
19749
- name: PRODUCT_TYPE.LC,
19750
- displayName: PRODUCT_NAMES.livechat,
19751
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: PRODUCT_TYPE.LC, width: 5 }),
19752
- values: Object.values(livechatTriggerConfigs).map((x) => ({
19753
- key: x.key,
19754
- name: x.customization.displayName,
19755
- secondaryText: x.customization.description
19756
- }))
19757
- },
19758
- {
19759
- name: IntegrationNames16.Mailchimp,
19760
- displayName: IntegrationDisplayNames6.Mailchimp,
19761
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: IntegrationNames16.Mailchimp, width: 5 }),
19762
- values: Object.values(mailchimpTriggerConfigs).map((x) => ({
19763
- key: x.key,
19764
- name: x.customization.displayName,
19765
- secondaryText: x.customization.description
19766
- }))
19767
- },
19768
- {
19769
- name: IntegrationNames16.Shopify,
19770
- displayName: IntegrationDisplayNames6.Shopify,
19771
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: IntegrationNames16.Shopify, width: 5 }),
19772
- values: Object.values(shopifyTriggerConfigs).map((x) => ({
19773
- key: x.key,
19774
- name: x.customization.displayName,
19775
- secondaryText: x.customization.description
19776
- }))
19777
- },
19778
- {
19779
- name: IntegrationNames16.HubSpot,
19780
- displayName: IntegrationDisplayNames6.HubSpot,
19781
- icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: IntegrationNames16.HubSpot, width: 5 }),
19782
- values: Object.values(hubspotTriggerConfigs).map((x) => ({
19783
- key: x.key,
19784
- name: x.customization.displayName,
19785
- secondaryText: x.customization.description
19786
- }))
19787
- },
19788
- {
19789
- name: IntegrationNames16.BigCommerce,
19790
- displayName: IntegrationDisplayNames6.BigCommerce,
19791
- icon: /* @__PURE__ */ jsx2(
19792
- ProductIcon_default,
19781
+ name: OTHER_TYPES.SYSTEM,
19782
+ displayName: "General",
19783
+ icon: /* @__PURE__ */ jsx2(
19784
+ ProductIcon_default,
19785
+ {
19786
+ center: void 0,
19787
+ disabled: void 0,
19788
+ height: 5,
19789
+ product: OTHER_TYPES.SYSTEM,
19790
+ width: 5
19791
+ }
19792
+ ),
19793
+ values: Object.values(systemTriggerConfigs()).map((x) => ({
19794
+ key: x.key,
19795
+ name: x.customization.displayName,
19796
+ secondaryText: x.customization.description
19797
+ }))
19798
+ },
19799
+ {
19800
+ name: PRODUCT_TYPE.LC,
19801
+ displayName: PRODUCT_NAMES.livechat,
19802
+ icon: /* @__PURE__ */ jsx2(ProductIcon_default, { height: 5, product: PRODUCT_TYPE.LC, width: 5 }),
19803
+ values: Object.values(livechatTriggerConfigs()).map((x) => ({
19804
+ key: x.key,
19805
+ name: x.customization.displayName,
19806
+ secondaryText: x.customization.description
19807
+ }))
19808
+ },
19809
+ {
19810
+ name: IntegrationNames16.Mailchimp,
19811
+ displayName: IntegrationDisplayNames6.Mailchimp,
19812
+ icon: /* @__PURE__ */ jsx2(
19813
+ ProductIcon_default,
19814
+ {
19815
+ height: 5,
19816
+ product: IntegrationNames16.Mailchimp,
19817
+ width: 5
19818
+ }
19819
+ ),
19820
+ values: Object.values(mailchimpTriggerConfigs()).map((x) => ({
19821
+ key: x.key,
19822
+ name: x.customization.displayName,
19823
+ secondaryText: x.customization.description
19824
+ }))
19825
+ },
19826
+ {
19827
+ name: IntegrationNames16.Shopify,
19828
+ displayName: IntegrationDisplayNames6.Shopify,
19829
+ icon: /* @__PURE__ */ jsx2(
19830
+ ProductIcon_default,
19831
+ {
19832
+ height: 5,
19833
+ product: IntegrationNames16.Shopify,
19834
+ width: 5
19835
+ }
19836
+ ),
19837
+ values: Object.values(shopifyTriggerConfigs()).map((x) => ({
19838
+ key: x.key,
19839
+ name: x.customization.displayName,
19840
+ secondaryText: x.customization.description
19841
+ }))
19842
+ },
19843
+ {
19844
+ name: IntegrationNames16.HubSpot,
19845
+ displayName: IntegrationDisplayNames6.HubSpot,
19846
+ icon: /* @__PURE__ */ jsx2(
19847
+ ProductIcon_default,
19848
+ {
19849
+ height: 5,
19850
+ product: IntegrationNames16.HubSpot,
19851
+ width: 5
19852
+ }
19853
+ ),
19854
+ values: Object.values(hubspotTriggerConfigs()).map((x) => ({
19855
+ key: x.key,
19856
+ name: x.customization.displayName,
19857
+ secondaryText: x.customization.description
19858
+ }))
19859
+ },
19793
19860
  {
19794
- height: 5,
19795
- product: IntegrationNames16.BigCommerce,
19796
- width: 5
19861
+ name: IntegrationNames16.BigCommerce,
19862
+ displayName: IntegrationDisplayNames6.BigCommerce,
19863
+ icon: /* @__PURE__ */ jsx2(
19864
+ ProductIcon_default,
19865
+ {
19866
+ height: 5,
19867
+ product: IntegrationNames16.BigCommerce,
19868
+ width: 5
19869
+ }
19870
+ ),
19871
+ values: Object.values(bigcommerceTriggerConfigs()).map((x) => ({
19872
+ key: x.key,
19873
+ name: x.customization.displayName,
19874
+ secondaryText: x.customization.description
19875
+ }))
19797
19876
  }
19798
- ),
19799
- values: Object.values(bigcommerceTriggerConfigs).map((x) => ({
19800
- key: x.key,
19801
- name: x.customization.displayName,
19802
- secondaryText: x.customization.description
19803
- }))
19804
- }
19805
- ];
19806
- function AddWorkflowTrigger({ basePath, onClose }) {
19807
- const [search, setSearch] = useState27("");
19877
+ ],
19878
+ []
19879
+ );
19808
19880
  const location = useLocation6();
19809
19881
  const navigate = useNavigate9();
19810
19882
  const params = useParams3();
@@ -19817,10 +19889,11 @@ function AddWorkflowTrigger({ basePath, onClose }) {
19817
19889
  useEffect16(() => {
19818
19890
  var _a, _b, _c;
19819
19891
  if (!params.trigger) {
19820
- const firstTrigger = (_c = (_b = (_a = config3.find((el) => el.name === params.service)) == null ? void 0 : _a.values.sort((a, b) => a.name.localeCompare(b.name))) == null ? void 0 : _b[0]) == null ? void 0 : _c.key;
19892
+ const firstTrigger = (_c = (_b = (_a = config2.find((el) => el.name === params.service)) == null ? void 0 : _a.values.sort((a, b) => a.name.localeCompare(b.name))) == null ? void 0 : _b[0]) == null ? void 0 : _c.key;
19821
19893
  navigate(`${basePath}/${params.service}/${firstTrigger}`);
19822
19894
  }
19823
- const triggers = params.service ? workflowItemTemplates.triggers[params.service] : void 0;
19895
+ const templates = WorkflowItemsConfiguration.templates;
19896
+ const triggers = params.service ? templates.triggers[params.service] : void 0;
19824
19897
  const trigger = params.trigger && triggers ? triggers[params.trigger] : void 0;
19825
19898
  setState({ trigger });
19826
19899
  }, [basePath, navigate, params.service, params.trigger]);
@@ -19889,7 +19962,7 @@ function AddWorkflowTrigger({ basePath, onClose }) {
19889
19962
  )
19890
19963
  }
19891
19964
  ),
19892
- config3.map(({ name, displayName, icon: icon2, values }) => {
19965
+ config2.map(({ name, displayName, icon: icon2, values }) => {
19893
19966
  const revertIconColor = getWorkflowsEnv("isHeadless") && (name === IntegrationNames16.OpenAI || name === IntegrationNames16.BigCommerce);
19894
19967
  if (search) {
19895
19968
  if (values.some(
@@ -19965,7 +20038,7 @@ function AddWorkflowTrigger({ basePath, onClose }) {
19965
20038
  `,
19966
20039
  setColumnPadding: "0 20px 0 16px",
19967
20040
  width: 10,
19968
- children: params.service ? config3.map(({ name, displayName, values, icon: icon2 }) => {
20041
+ children: params.service ? config2.map(({ name, displayName, values, icon: icon2 }) => {
19969
20042
  var _a;
19970
20043
  if (((_a = params.service) == null ? void 0 : _a.toLowerCase()) === name.toLowerCase()) {
19971
20044
  const options2 = values.map(({ key, name: name2, secondaryText }) => ({
@@ -20439,6 +20512,7 @@ var Edit_default2 = EditWorkflow;
20439
20512
  import { Route as Route4, Routes as Routes4 } from "react-router-dom";
20440
20513
 
20441
20514
  // src/views/Flows/Templates/Common/Modals/Preview/index.tsx
20515
+ import { useMemo as useMemo7 } from "react";
20442
20516
  import { useParams as useParams5 } from "react-router-dom";
20443
20517
 
20444
20518
  // src/views/Flows/Templates/api.mocks.tsx
@@ -20454,7 +20528,7 @@ import {
20454
20528
  IntegrationNames as IntegrationNames17,
20455
20529
  TextLivechatEventNames as TextLivechatEventNames2
20456
20530
  } from "@livechat/developer-studio-api";
20457
- var flowTemplates = [
20531
+ var getFlowTemplates = () => [
20458
20532
  {
20459
20533
  id: "1",
20460
20534
  name: "Create HelpDesk tickets with chat summaries when a chat ends",
@@ -22326,6 +22400,7 @@ function WorkflowTemplatePreview({
22326
22400
  workflow,
22327
22401
  onClose
22328
22402
  }) {
22403
+ const flowTemplates = useMemo7(() => getFlowTemplates(), []);
22329
22404
  const params = useParams5();
22330
22405
  const template = flowTemplates.find((t) => t.id === params.template);
22331
22406
  if (!workflow) {
@@ -22367,7 +22442,7 @@ import { useNavigate as useNavigate15 } from "react-router-dom";
22367
22442
  import { Modal as Modal9, ModalHeader as ModalHeader4 } from "@livechat/design-system-react-components";
22368
22443
 
22369
22444
  // src/views/Flows/Definitions/List/Home/Home.tsx
22370
- import { useState as useState31 } from "react";
22445
+ import { useMemo as useMemo8, useState as useState31 } from "react";
22371
22446
  import { FiletypeOther, OneColored } from "@livechat/design-system-icons";
22372
22447
  import {
22373
22448
  DesignToken as DesignToken41,
@@ -22643,6 +22718,7 @@ var Grid = newStyled.div`
22643
22718
  function WorkflowsHome({ isOnModal, basePath }) {
22644
22719
  const [product, setProduct] = useState31("All");
22645
22720
  const [category, setCategory] = useState31("All");
22721
+ const flowTemplates = useMemo8(() => getFlowTemplates(), []);
22646
22722
  const filters = [
22647
22723
  (template) => product === "All" || template.products.includes(product),
22648
22724
  (template) => category === "All" || template.category.includes(category)
@@ -22680,13 +22756,7 @@ function WorkflowsHome({ isOnModal, basePath }) {
22680
22756
  notPadded: true,
22681
22757
  notPaddedOnMobile: true,
22682
22758
  children: [
22683
- /* @__PURE__ */ jsx2(
22684
- Scratch_default,
22685
- {
22686
- icon: FiletypeOther,
22687
- title: "Empty workflow"
22688
- }
22689
- ),
22759
+ /* @__PURE__ */ jsx2(Scratch_default, { icon: FiletypeOther, title: "Empty workflow" }),
22690
22760
  /* @__PURE__ */ jsx2(
22691
22761
  Scratch_default,
22692
22762
  {