@livechat/platform-workflows 0.0.89 → 0.0.90
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +837 -633
- package/dist/index.mjs +645 -556
- package/package.json +9 -4
package/dist/index.mjs
CHANGED
|
@@ -1,78 +1,13 @@
|
|
|
1
1
|
"use client"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
12
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
|
-
var __spreadValues = (a, b) => {
|
|
14
|
-
for (var prop in b || (b = {}))
|
|
15
|
-
if (__hasOwnProp.call(b, prop))
|
|
16
|
-
__defNormalProp(a, prop, b[prop]);
|
|
17
|
-
if (__getOwnPropSymbols)
|
|
18
|
-
for (var prop of __getOwnPropSymbols(b)) {
|
|
19
|
-
if (__propIsEnum.call(b, prop))
|
|
20
|
-
__defNormalProp(a, prop, b[prop]);
|
|
21
|
-
}
|
|
22
|
-
return a;
|
|
23
|
-
};
|
|
24
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
-
var __objRest = (source, exclude) => {
|
|
26
|
-
var target = {};
|
|
27
|
-
for (var prop in source)
|
|
28
|
-
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
-
target[prop] = source[prop];
|
|
30
|
-
if (source != null && __getOwnPropSymbols)
|
|
31
|
-
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
-
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
-
target[prop] = source[prop];
|
|
34
|
-
}
|
|
35
|
-
return target;
|
|
36
|
-
};
|
|
37
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
38
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
39
|
-
};
|
|
40
|
-
var __copyProps = (to, from2, except, desc) => {
|
|
41
|
-
if (from2 && typeof from2 === "object" || typeof from2 === "function") {
|
|
42
|
-
for (let key of __getOwnPropNames(from2))
|
|
43
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
-
__defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
|
|
45
|
-
}
|
|
46
|
-
return to;
|
|
47
|
-
};
|
|
48
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
49
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
50
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
51
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
52
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
53
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
54
|
-
mod
|
|
55
|
-
));
|
|
56
|
-
var __async = (__this, __arguments, generator) => {
|
|
57
|
-
return new Promise((resolve, reject) => {
|
|
58
|
-
var fulfilled = (value) => {
|
|
59
|
-
try {
|
|
60
|
-
step(generator.next(value));
|
|
61
|
-
} catch (e) {
|
|
62
|
-
reject(e);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
var rejected = (value) => {
|
|
66
|
-
try {
|
|
67
|
-
step(generator.throw(value));
|
|
68
|
-
} catch (e) {
|
|
69
|
-
reject(e);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
73
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
74
|
-
});
|
|
75
|
-
};
|
|
2
|
+
import {
|
|
3
|
+
WORKFLOWS_TEST_SELECTORS,
|
|
4
|
+
__async,
|
|
5
|
+
__commonJS,
|
|
6
|
+
__objRest,
|
|
7
|
+
__spreadProps,
|
|
8
|
+
__spreadValues,
|
|
9
|
+
__toESM
|
|
10
|
+
} from "./chunk-Q53XLSIX.mjs";
|
|
76
11
|
|
|
77
12
|
// ../../../node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js
|
|
78
13
|
var require_react_is_production_min = __commonJS({
|
|
@@ -2063,7 +1998,7 @@ var useDeleteWorkflow = () => {
|
|
|
2063
1998
|
);
|
|
2064
1999
|
}),
|
|
2065
2000
|
{
|
|
2066
|
-
onSuccess: (
|
|
2001
|
+
onSuccess: (_2, workflow) => {
|
|
2067
2002
|
queryClient.removeQueries(queryKeys.workflow.get(workflow.id));
|
|
2068
2003
|
if (workflow.related_workflow_id) {
|
|
2069
2004
|
queryClient.setQueryData(
|
|
@@ -2092,7 +2027,7 @@ var usePublishWorkflowDraft = () => {
|
|
|
2092
2027
|
return { id: data.id };
|
|
2093
2028
|
}),
|
|
2094
2029
|
{
|
|
2095
|
-
onSuccess: (
|
|
2030
|
+
onSuccess: (_2, draft) => __async(void 0, null, function* () {
|
|
2096
2031
|
if (draft.related_workflow_id) {
|
|
2097
2032
|
const workflow = yield api2.integrations.text.platform.workflow.workflows.getWorkflow(
|
|
2098
2033
|
draft.related_workflow_id
|
|
@@ -2129,7 +2064,7 @@ var useActivateWorkflow = () => {
|
|
|
2129
2064
|
);
|
|
2130
2065
|
}),
|
|
2131
2066
|
{
|
|
2132
|
-
onSuccess: (
|
|
2067
|
+
onSuccess: (_2, { id }) => {
|
|
2133
2068
|
queryClient.setQueryData(
|
|
2134
2069
|
queryKeys.workflow.get(id),
|
|
2135
2070
|
(workflow) => workflow ? __spreadProps(__spreadValues({}, workflow), { active: true }) : workflow
|
|
@@ -2300,17 +2235,17 @@ function Waitlist({ image }) {
|
|
|
2300
2235
|
var Waitlist_default = Waitlist;
|
|
2301
2236
|
|
|
2302
2237
|
// src/views/Workflows/index.tsx
|
|
2303
|
-
import { useEffect as
|
|
2304
|
-
import { Navigate as Navigate2, Route as Route6, Routes as Routes6, useNavigate as
|
|
2238
|
+
import { useEffect as useEffect21 } from "react";
|
|
2239
|
+
import { Navigate as Navigate2, Route as Route6, Routes as Routes6, useNavigate as useNavigate22 } from "react-router-dom";
|
|
2305
2240
|
import { Loader as Loader6 } from "@livechat/developer-studio-ui-react";
|
|
2306
2241
|
|
|
2307
2242
|
// src/views/Workflows/Creator/index.tsx
|
|
2308
2243
|
import {
|
|
2309
2244
|
Route as Route3,
|
|
2310
2245
|
Routes as Routes3,
|
|
2311
|
-
useLocation as
|
|
2312
|
-
useNavigate as
|
|
2313
|
-
useParams as
|
|
2246
|
+
useLocation as useLocation6,
|
|
2247
|
+
useNavigate as useNavigate14,
|
|
2248
|
+
useParams as useParams5
|
|
2314
2249
|
} from "react-router-dom";
|
|
2315
2250
|
import {
|
|
2316
2251
|
Loader as Loader3,
|
|
@@ -2348,7 +2283,7 @@ var WORKFLOW_TRIGGER_OUTPUT_SCHEMA = (body) => ({
|
|
|
2348
2283
|
}
|
|
2349
2284
|
});
|
|
2350
2285
|
var WORKFLOW_HTTP_TASK_SCHEMA = (name = "http", overrides) => {
|
|
2351
|
-
var _a, _b;
|
|
2286
|
+
var _a, _b, _c;
|
|
2352
2287
|
return {
|
|
2353
2288
|
required: ["type", "name", "inputParameters"],
|
|
2354
2289
|
properties: {
|
|
@@ -2367,7 +2302,7 @@ var WORKFLOW_HTTP_TASK_SCHEMA = (name = "http", overrides) => {
|
|
|
2367
2302
|
(overrides == null ? void 0 : overrides.body) ? "body" : void 0
|
|
2368
2303
|
].filter(Boolean),
|
|
2369
2304
|
properties: {
|
|
2370
|
-
uri: {
|
|
2305
|
+
uri: (_a = overrides == null ? void 0 : overrides.uri) != null ? _a : {
|
|
2371
2306
|
type: "string",
|
|
2372
2307
|
title: "URI"
|
|
2373
2308
|
},
|
|
@@ -2376,7 +2311,7 @@ var WORKFLOW_HTTP_TASK_SCHEMA = (name = "http", overrides) => {
|
|
|
2376
2311
|
title: "Method",
|
|
2377
2312
|
enum: ["GET", "POST", "PATCH", "PUT", "DELETE"]
|
|
2378
2313
|
},
|
|
2379
|
-
headers: (
|
|
2314
|
+
headers: (_b = overrides == null ? void 0 : overrides.headers) != null ? _b : {
|
|
2380
2315
|
type: "object",
|
|
2381
2316
|
title: "Headers",
|
|
2382
2317
|
properties: {},
|
|
@@ -2384,7 +2319,7 @@ var WORKFLOW_HTTP_TASK_SCHEMA = (name = "http", overrides) => {
|
|
|
2384
2319
|
type: "string"
|
|
2385
2320
|
}
|
|
2386
2321
|
},
|
|
2387
|
-
body: (
|
|
2322
|
+
body: (_c = overrides == null ? void 0 : overrides.body) != null ? _c : {
|
|
2388
2323
|
type: "object",
|
|
2389
2324
|
title: "Body",
|
|
2390
2325
|
properties: {},
|
|
@@ -2409,10 +2344,19 @@ var WORKFLOW_HTTP_TASK_SCHEMA = (name = "http", overrides) => {
|
|
|
2409
2344
|
};
|
|
2410
2345
|
var WORKFLOW_HTTP_TASK_INPUT_SCHEMA = (body, query) => ({
|
|
2411
2346
|
type: "object",
|
|
2412
|
-
required: [
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2347
|
+
required: [
|
|
2348
|
+
"uri",
|
|
2349
|
+
body ? "body" : void 0,
|
|
2350
|
+
query ? "query" : void 0
|
|
2351
|
+
].filter(Boolean),
|
|
2352
|
+
properties: __spreadValues(__spreadValues({
|
|
2353
|
+
uri: query ? {
|
|
2354
|
+
type: "string",
|
|
2355
|
+
queryParams: query
|
|
2356
|
+
} : {
|
|
2357
|
+
type: "string"
|
|
2358
|
+
}
|
|
2359
|
+
}, query ? {
|
|
2416
2360
|
query
|
|
2417
2361
|
} : {}), body ? {
|
|
2418
2362
|
body
|
|
@@ -4972,7 +4916,7 @@ var webhookSpecs2 = {
|
|
|
4972
4916
|
required: [],
|
|
4973
4917
|
properties: {
|
|
4974
4918
|
targetAgentId: {
|
|
4975
|
-
|
|
4919
|
+
$ref: "#/$defs/livechat_agent",
|
|
4976
4920
|
title: "Target Agent email"
|
|
4977
4921
|
}
|
|
4978
4922
|
}
|
|
@@ -6335,12 +6279,9 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6335
6279
|
specification: {
|
|
6336
6280
|
input: WORKFLOW_HTTP_TASK_INPUT_SCHEMA({
|
|
6337
6281
|
type: "object",
|
|
6338
|
-
required: ["list_id", "
|
|
6282
|
+
required: ["list_id", "email", "first_name", "last_name"],
|
|
6339
6283
|
properties: {
|
|
6340
6284
|
list_id: {
|
|
6341
|
-
type: "string",
|
|
6342
|
-
title: "Mailchimp audience ID",
|
|
6343
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6344
6285
|
$ref: "#/$defs/mailchimp_audience"
|
|
6345
6286
|
},
|
|
6346
6287
|
email: {
|
|
@@ -6392,9 +6333,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6392
6333
|
required: ["list_id"],
|
|
6393
6334
|
properties: {
|
|
6394
6335
|
list_id: {
|
|
6395
|
-
type: "string",
|
|
6396
|
-
title: "Mailchimp audience ID",
|
|
6397
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6398
6336
|
$ref: "#/$defs/mailchimp_audience"
|
|
6399
6337
|
}
|
|
6400
6338
|
}
|
|
@@ -6428,10 +6366,7 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6428
6366
|
required: ["campaign_id"],
|
|
6429
6367
|
properties: {
|
|
6430
6368
|
campaign_id: {
|
|
6431
|
-
|
|
6432
|
-
title: "Campaign ID",
|
|
6433
|
-
description: `The unique ID for the campaign. You'll find it by going to the Campaigns page in Mailchimp and selecting View Email from the drop-down list for the campaign. The URL indicates the campaign ID by the prefix "id=".`
|
|
6434
|
-
// $ref: '#/$defs/mailchimp_campaign',
|
|
6369
|
+
$ref: "#/$defs/mailchimp_campaign"
|
|
6435
6370
|
}
|
|
6436
6371
|
}
|
|
6437
6372
|
}),
|
|
@@ -6457,12 +6392,9 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6457
6392
|
specification: {
|
|
6458
6393
|
input: WORKFLOW_HTTP_TASK_INPUT_SCHEMA({
|
|
6459
6394
|
type: "object",
|
|
6460
|
-
required: ["list_id", "
|
|
6395
|
+
required: ["list_id", "email", "first_name", "last_name"],
|
|
6461
6396
|
properties: {
|
|
6462
6397
|
list_id: {
|
|
6463
|
-
type: "string",
|
|
6464
|
-
title: "Mailchimp audience ID",
|
|
6465
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6466
6398
|
$ref: "#/$defs/mailchimp_audience"
|
|
6467
6399
|
},
|
|
6468
6400
|
email: {
|
|
@@ -6506,12 +6438,9 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6506
6438
|
specification: {
|
|
6507
6439
|
input: WORKFLOW_HTTP_TASK_INPUT_SCHEMA({
|
|
6508
6440
|
type: "object",
|
|
6509
|
-
required: ["list_id", "
|
|
6441
|
+
required: ["list_id", "email", "first_name", "last_name"],
|
|
6510
6442
|
properties: {
|
|
6511
6443
|
list_id: {
|
|
6512
|
-
type: "string",
|
|
6513
|
-
title: "Mailchimp audience ID",
|
|
6514
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6515
6444
|
$ref: "#/$defs/mailchimp_audience"
|
|
6516
6445
|
},
|
|
6517
6446
|
email: {
|
|
@@ -6558,9 +6487,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6558
6487
|
required: ["list_id", "email"],
|
|
6559
6488
|
properties: {
|
|
6560
6489
|
list_id: {
|
|
6561
|
-
type: "string",
|
|
6562
|
-
title: "Mailchimp audience ID",
|
|
6563
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6564
6490
|
$ref: "#/$defs/mailchimp_audience"
|
|
6565
6491
|
},
|
|
6566
6492
|
email: {
|
|
@@ -6594,9 +6520,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6594
6520
|
required: ["list_id", "email"],
|
|
6595
6521
|
properties: {
|
|
6596
6522
|
list_id: {
|
|
6597
|
-
type: "string",
|
|
6598
|
-
title: "Mailchimp audience ID",
|
|
6599
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6600
6523
|
$ref: "#/$defs/mailchimp_audience"
|
|
6601
6524
|
},
|
|
6602
6525
|
email: {
|
|
@@ -6630,9 +6553,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6630
6553
|
required: ["list_id", "email", "tag"],
|
|
6631
6554
|
properties: {
|
|
6632
6555
|
list_id: {
|
|
6633
|
-
type: "string",
|
|
6634
|
-
title: "Mailchimp audience ID",
|
|
6635
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6636
6556
|
$ref: "#/$defs/mailchimp_audience"
|
|
6637
6557
|
},
|
|
6638
6558
|
email: {
|
|
@@ -6671,9 +6591,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6671
6591
|
required: ["list_id", "email", "name"],
|
|
6672
6592
|
properties: {
|
|
6673
6593
|
list_id: {
|
|
6674
|
-
type: "string",
|
|
6675
|
-
title: "Mailchimp audience ID",
|
|
6676
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6677
6594
|
$ref: "#/$defs/mailchimp_audience"
|
|
6678
6595
|
},
|
|
6679
6596
|
email: {
|
|
@@ -6728,9 +6645,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6728
6645
|
required: ["list_id", "email", "note"],
|
|
6729
6646
|
properties: {
|
|
6730
6647
|
list_id: {
|
|
6731
|
-
type: "string",
|
|
6732
|
-
title: "Mailchimp audience ID",
|
|
6733
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6734
6648
|
$ref: "#/$defs/mailchimp_audience"
|
|
6735
6649
|
},
|
|
6736
6650
|
email: {
|
|
@@ -6769,9 +6683,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6769
6683
|
required: ["list_id", "email", "tag"],
|
|
6770
6684
|
properties: {
|
|
6771
6685
|
list_id: {
|
|
6772
|
-
type: "string",
|
|
6773
|
-
title: "Mailchimp audience ID",
|
|
6774
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6775
6686
|
$ref: "#/$defs/mailchimp_audience"
|
|
6776
6687
|
},
|
|
6777
6688
|
email: {
|
|
@@ -6809,9 +6720,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6809
6720
|
required: ["list_id", "email"],
|
|
6810
6721
|
properties: {
|
|
6811
6722
|
list_id: {
|
|
6812
|
-
type: "string",
|
|
6813
|
-
title: "Mailchimp audience ID",
|
|
6814
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6815
6723
|
$ref: "#/$defs/mailchimp_audience"
|
|
6816
6724
|
},
|
|
6817
6725
|
email: {
|
|
@@ -6875,9 +6783,6 @@ var mailchimpTaskConfigs = () => ({
|
|
|
6875
6783
|
required: ["list_id", "email"],
|
|
6876
6784
|
properties: {
|
|
6877
6785
|
list_id: {
|
|
6878
|
-
type: "string",
|
|
6879
|
-
title: "Mailchimp audience ID",
|
|
6880
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
6881
6786
|
$ref: "#/$defs/mailchimp_audience"
|
|
6882
6787
|
},
|
|
6883
6788
|
email: {
|
|
@@ -7051,10 +6956,8 @@ var mailchimpTaskConfigs = () => ({
|
|
|
7051
6956
|
required: ["list_id", "query"],
|
|
7052
6957
|
properties: {
|
|
7053
6958
|
list_id: {
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
7057
|
-
$ref: "#/$defs/mailchimp_audience"
|
|
6959
|
+
$ref: "#/$defs/mailchimp_audience",
|
|
6960
|
+
minLength: 1
|
|
7058
6961
|
},
|
|
7059
6962
|
query: {
|
|
7060
6963
|
type: "string",
|
|
@@ -7228,10 +7131,7 @@ var mailchimpTaskConfigs = () => ({
|
|
|
7228
7131
|
required: ["campaign_id"],
|
|
7229
7132
|
properties: {
|
|
7230
7133
|
campaign_id: {
|
|
7231
|
-
|
|
7232
|
-
title: "Campaign ID",
|
|
7233
|
-
description: `The unique ID for the campaign. You'll find it by going to the Campaigns page in Mailchimp and selecting View Email from the drop-down list for the campaign. The URL indicates the campaign ID by the prefix "id=".`
|
|
7234
|
-
//$ref: '#/$defs/mailchimp_campaign'
|
|
7134
|
+
$ref: "#/$defs/mailchimp_campaign"
|
|
7235
7135
|
}
|
|
7236
7136
|
}
|
|
7237
7137
|
}),
|
|
@@ -9463,7 +9363,7 @@ var WORKFLOW_SCHEMA_DEFS = {
|
|
|
9463
9363
|
},
|
|
9464
9364
|
...Object.values(WorkflowSpecification.config.tasks).map(
|
|
9465
9365
|
(config2) => {
|
|
9466
|
-
var _a, _b;
|
|
9366
|
+
var _a, _b, _c, _d;
|
|
9467
9367
|
return {
|
|
9468
9368
|
if: {
|
|
9469
9369
|
properties: {
|
|
@@ -9472,7 +9372,8 @@ var WORKFLOW_SCHEMA_DEFS = {
|
|
|
9472
9372
|
}
|
|
9473
9373
|
},
|
|
9474
9374
|
then: WORKFLOW_HTTP_TASK_SCHEMA(config2.key, {
|
|
9475
|
-
|
|
9375
|
+
uri: (_b = (_a = config2.specification.input) == null ? void 0 : _a.properties) == null ? void 0 : _b.uri,
|
|
9376
|
+
body: (_d = (_c = config2.specification.input) == null ? void 0 : _c.properties) == null ? void 0 : _d.body
|
|
9476
9377
|
})
|
|
9477
9378
|
};
|
|
9478
9379
|
}
|
|
@@ -9499,6 +9400,9 @@ var WORKFLOW_SCHEMA_DEFS = {
|
|
|
9499
9400
|
}),
|
|
9500
9401
|
$defs: {
|
|
9501
9402
|
mailchimp_audience: {
|
|
9403
|
+
type: "string",
|
|
9404
|
+
title: "Mailchimp audience ID",
|
|
9405
|
+
description: "The unique ID of your audience. <a href='https://mailchimp.com/help/find-audience-id/' target='_blank' rel='noreferrer nofollow'>Here's<a/> how to find it.",
|
|
9502
9406
|
"x-ref": {
|
|
9503
9407
|
provider: "mailchimp",
|
|
9504
9408
|
product: "mailchimp",
|
|
@@ -9508,13 +9412,17 @@ var WORKFLOW_SCHEMA_DEFS = {
|
|
|
9508
9412
|
}
|
|
9509
9413
|
},
|
|
9510
9414
|
mailchimp_campaign: {
|
|
9511
|
-
"
|
|
9512
|
-
|
|
9513
|
-
|
|
9514
|
-
|
|
9515
|
-
|
|
9516
|
-
|
|
9517
|
-
|
|
9415
|
+
type: "string",
|
|
9416
|
+
title: "Campaign ID",
|
|
9417
|
+
description: `The unique ID for the campaign. You'll find it by going to the Campaigns page in Mailchimp and selecting View Email from the drop-down list for the campaign. The URL indicates the campaign ID by the prefix "id=".`
|
|
9418
|
+
// TODO WD: it not ready yet, but WIP on BE side
|
|
9419
|
+
// 'x-ref': {
|
|
9420
|
+
// provider: 'mailchimp',
|
|
9421
|
+
// product: 'mailchimp',
|
|
9422
|
+
// name: 'campaign',
|
|
9423
|
+
// displayField: 'name',
|
|
9424
|
+
// valueField: 'id'
|
|
9425
|
+
// }
|
|
9518
9426
|
},
|
|
9519
9427
|
helpdesk_ticket: {
|
|
9520
9428
|
title: "Ticket ID",
|
|
@@ -9546,7 +9454,7 @@ var WORKFLOW_SCHEMA_DEFS = {
|
|
|
9546
9454
|
product: "helpdesk",
|
|
9547
9455
|
name: "agent",
|
|
9548
9456
|
displayField: "email",
|
|
9549
|
-
valueField: "
|
|
9457
|
+
valueField: "ID"
|
|
9550
9458
|
}
|
|
9551
9459
|
},
|
|
9552
9460
|
livechat_chat_id: {
|
|
@@ -12657,8 +12565,8 @@ var getWorkflowTemplates = () => [
|
|
|
12657
12565
|
];
|
|
12658
12566
|
|
|
12659
12567
|
// src/views/Workflows/Creator/Modals/AddTask/Modal.tsx
|
|
12660
|
-
import { useEffect as
|
|
12661
|
-
import { NavLink, useLocation, useNavigate as
|
|
12568
|
+
import { useEffect as useEffect5, useMemo as useMemo4, useState as useState5 } from "react";
|
|
12569
|
+
import { NavLink, useLocation as useLocation2, useNavigate as useNavigate4, useParams as useParams2 } from "react-router-dom";
|
|
12662
12570
|
import {
|
|
12663
12571
|
Button as Button2,
|
|
12664
12572
|
DesignToken as DesignToken4,
|
|
@@ -13138,13 +13046,13 @@ var ProductIcon_default = ProductIcon;
|
|
|
13138
13046
|
// src/views/Workflows/Creator/Provider/index.tsx
|
|
13139
13047
|
import {
|
|
13140
13048
|
createContext as createContext4,
|
|
13141
|
-
useCallback as
|
|
13049
|
+
useCallback as useCallback4,
|
|
13142
13050
|
useContext as useContext6,
|
|
13143
|
-
useEffect as
|
|
13144
|
-
useRef as
|
|
13051
|
+
useEffect as useEffect4,
|
|
13052
|
+
useRef as useRef3,
|
|
13145
13053
|
useState as useState4
|
|
13146
13054
|
} from "react";
|
|
13147
|
-
import { useNavigate as
|
|
13055
|
+
import { useNavigate as useNavigate3 } from "react-router-dom";
|
|
13148
13056
|
import { ReactFlowProvider, useReactFlow } from "reactflow";
|
|
13149
13057
|
import debounce from "lodash.debounce";
|
|
13150
13058
|
import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType12 } from "@livechat/developer-studio-api";
|
|
@@ -13384,15 +13292,36 @@ var DEFAULT_NODE_HEIGHT = {
|
|
|
13384
13292
|
default: 65
|
|
13385
13293
|
};
|
|
13386
13294
|
|
|
13295
|
+
// src/views/Workflows/Creator/Provider/navigation/hooks.ts
|
|
13296
|
+
import { useCallback, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
13297
|
+
import { useLocation, useNavigate as useNavigate2, useParams } from "react-router-dom";
|
|
13298
|
+
function useReplaceWorkflowIdInUrl() {
|
|
13299
|
+
const navigate = useNavigate2();
|
|
13300
|
+
const location = useLocation();
|
|
13301
|
+
const { id } = useParams();
|
|
13302
|
+
const latestPathRef = useRef2(location.pathname);
|
|
13303
|
+
useEffect2(() => {
|
|
13304
|
+
latestPathRef.current = location.pathname;
|
|
13305
|
+
}, [location.pathname]);
|
|
13306
|
+
return useCallback(
|
|
13307
|
+
(newId) => {
|
|
13308
|
+
if (!id) return;
|
|
13309
|
+
const latestPath = latestPathRef.current.replace(`/${id}`, `/${newId}`);
|
|
13310
|
+
navigate(latestPath, { replace: true });
|
|
13311
|
+
},
|
|
13312
|
+
[navigate, id]
|
|
13313
|
+
);
|
|
13314
|
+
}
|
|
13315
|
+
|
|
13387
13316
|
// src/views/Workflows/Creator/Provider/state/data/hooks.ts
|
|
13388
|
-
import { useCallback, useEffect as
|
|
13317
|
+
import { useCallback as useCallback2, useEffect as useEffect3, useState as useState3 } from "react";
|
|
13389
13318
|
function useWorkflowData(workflow) {
|
|
13390
13319
|
const [actions, setActions] = useState3({});
|
|
13391
13320
|
const [selection, setSelection] = useState3();
|
|
13392
13321
|
const [pendingWorkflow, setPendingWorkflow] = useState3(
|
|
13393
13322
|
() => JSON.parse(JSON.stringify(workflow))
|
|
13394
13323
|
);
|
|
13395
|
-
const setAction =
|
|
13324
|
+
const setAction = useCallback2(
|
|
13396
13325
|
(action, value) => {
|
|
13397
13326
|
setActions((prevState) => __spreadProps(__spreadValues({}, prevState), {
|
|
13398
13327
|
[action]: value
|
|
@@ -13400,10 +13329,10 @@ function useWorkflowData(workflow) {
|
|
|
13400
13329
|
},
|
|
13401
13330
|
[]
|
|
13402
13331
|
);
|
|
13403
|
-
|
|
13332
|
+
useEffect3(() => {
|
|
13404
13333
|
setPendingWorkflow(JSON.parse(JSON.stringify(workflow)));
|
|
13405
13334
|
setSelection((prevState) => {
|
|
13406
|
-
if ((prevState == null ? void 0 : prevState.kind) === "trigger") {
|
|
13335
|
+
if ((prevState == null ? void 0 : prevState.kind) === "trigger" && !workflow.trigger.type) {
|
|
13407
13336
|
return void 0;
|
|
13408
13337
|
}
|
|
13409
13338
|
if ((prevState == null ? void 0 : prevState.kind) === "task") {
|
|
@@ -13690,51 +13619,9 @@ var getWorkflowContexts = (workflow, external) => {
|
|
|
13690
13619
|
};
|
|
13691
13620
|
|
|
13692
13621
|
// src/views/Workflows/Creator/Provider/state/metadata/hooks.ts
|
|
13693
|
-
import { useMemo as
|
|
13622
|
+
import { useMemo as useMemo3 } from "react";
|
|
13694
13623
|
import { useFetchIntegrationCredentialsQuery } from "@livechat/platform-integrations";
|
|
13695
13624
|
|
|
13696
|
-
// src/hooks/user.ts
|
|
13697
|
-
import { useMutation as useMutation2, useQuery as useQuery3, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
13698
|
-
import { api as api3 } from "@livechat/developer-studio-api";
|
|
13699
|
-
var userQueryKeys = {
|
|
13700
|
-
accounts: {
|
|
13701
|
-
account: {
|
|
13702
|
-
getInfo: ["accounts.account.getInfo"]
|
|
13703
|
-
},
|
|
13704
|
-
products: {
|
|
13705
|
-
getOrganizationProducts: ["accounts.products.getOrganizationProducts"]
|
|
13706
|
-
}
|
|
13707
|
-
},
|
|
13708
|
-
dps: {
|
|
13709
|
-
getUser: ["dps.getUser"],
|
|
13710
|
-
getUserIntegrations: ["dps.getUserIntegrations"]
|
|
13711
|
-
}
|
|
13712
|
-
};
|
|
13713
|
-
var useFetchOrganizationProducts = () => {
|
|
13714
|
-
var _b;
|
|
13715
|
-
const _a = useQuery3(
|
|
13716
|
-
userQueryKeys.accounts.products.getOrganizationProducts,
|
|
13717
|
-
() => api3.platform.accounts.products.getOrganizationProducts()
|
|
13718
|
-
), { data, isLoading } = _a, rest = __objRest(_a, ["data", "isLoading"]);
|
|
13719
|
-
return __spreadValues({ data: (_b = data == null ? void 0 : data.data) != null ? _b : [], isLoading }, rest);
|
|
13720
|
-
};
|
|
13721
|
-
var useUpdateOrganizationProducts = () => {
|
|
13722
|
-
const queryClient = useQueryClient2();
|
|
13723
|
-
const { mutateAsync: updateOrganizationProducts, isLoading } = useMutation2(
|
|
13724
|
-
({ productName }) => api3.platform.accounts.products.updateOrganizationProducts({
|
|
13725
|
-
product: productName
|
|
13726
|
-
}),
|
|
13727
|
-
{
|
|
13728
|
-
onSuccess: (_) => {
|
|
13729
|
-
void queryClient.refetchQueries({
|
|
13730
|
-
queryKey: userQueryKeys.accounts.products.getOrganizationProducts
|
|
13731
|
-
});
|
|
13732
|
-
}
|
|
13733
|
-
}
|
|
13734
|
-
);
|
|
13735
|
-
return { updateOrganizationProducts, isLoading };
|
|
13736
|
-
};
|
|
13737
|
-
|
|
13738
13625
|
// src/views/Workflows/Creator/Provider/state/metadata/utils.ts
|
|
13739
13626
|
import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType11 } from "@livechat/developer-studio-api";
|
|
13740
13627
|
var flattenTasks = (tasks) => (Array.isArray(tasks) ? tasks : Object.values(tasks)).flatMap((task2) => {
|
|
@@ -13751,17 +13638,61 @@ var flattenTasks = (tasks) => (Array.isArray(tasks) ? tasks : Object.values(task
|
|
|
13751
13638
|
});
|
|
13752
13639
|
|
|
13753
13640
|
// src/views/Workflows/Creator/Provider/state/metadata/validation/utils.ts
|
|
13754
|
-
import Ajv from "ajv";
|
|
13641
|
+
import Ajv, { _ } from "ajv";
|
|
13755
13642
|
import AjvWithErrors from "ajv-errors";
|
|
13756
13643
|
import { IntegrationNames as IntegrationNames12 } from "@livechat/developer-studio-api";
|
|
13757
|
-
var
|
|
13644
|
+
var keywords = {
|
|
13645
|
+
urlWithQueryParams: {
|
|
13646
|
+
keyword: "queryParams",
|
|
13647
|
+
type: "string",
|
|
13648
|
+
schemaType: "object",
|
|
13649
|
+
metaSchema: {
|
|
13650
|
+
type: "object",
|
|
13651
|
+
properties: {
|
|
13652
|
+
queryParams: {
|
|
13653
|
+
type: "object"
|
|
13654
|
+
}
|
|
13655
|
+
}
|
|
13656
|
+
},
|
|
13657
|
+
error: {
|
|
13658
|
+
message: () => `This field cannot be empty`,
|
|
13659
|
+
params: (cxt) => _`{ param: ${cxt.params.param} }`
|
|
13660
|
+
},
|
|
13661
|
+
code(cxt) {
|
|
13662
|
+
const { data, schema } = cxt;
|
|
13663
|
+
cxt.gen.if(
|
|
13664
|
+
_`typeof ${data} === "string" && ${data}.includes("?")`,
|
|
13665
|
+
() => {
|
|
13666
|
+
const params = _`Object.fromEntries(new URL(${data}).searchParams.entries())`;
|
|
13667
|
+
for (const param of Object.keys(schema.properties || {})) {
|
|
13668
|
+
cxt.gen.if(
|
|
13669
|
+
_`!(${param} in ${params}) || ${params}[${param}].length <= 0`,
|
|
13670
|
+
() => {
|
|
13671
|
+
cxt.error(
|
|
13672
|
+
true,
|
|
13673
|
+
{ param },
|
|
13674
|
+
{
|
|
13675
|
+
instancePath: param
|
|
13676
|
+
}
|
|
13677
|
+
);
|
|
13678
|
+
}
|
|
13679
|
+
);
|
|
13680
|
+
}
|
|
13681
|
+
},
|
|
13682
|
+
() => {
|
|
13683
|
+
cxt.error(true, { param: "URL" });
|
|
13684
|
+
}
|
|
13685
|
+
);
|
|
13686
|
+
}
|
|
13687
|
+
}
|
|
13688
|
+
};
|
|
13689
|
+
var getValidator = () => AjvWithErrors(
|
|
13758
13690
|
new Ajv({
|
|
13759
13691
|
strict: false,
|
|
13760
13692
|
allErrors: true
|
|
13761
|
-
})
|
|
13762
|
-
);
|
|
13763
|
-
var validateSchema = (workflow, frames) => {
|
|
13764
|
-
const validate = ajv.compile(WORKFLOW_SCHEMA());
|
|
13693
|
+
}).addKeyword(keywords.urlWithQueryParams)
|
|
13694
|
+
).compile(WORKFLOW_SCHEMA());
|
|
13695
|
+
var validateSchema = (workflow, frames, validateFunction) => {
|
|
13765
13696
|
const resolved = __spreadProps(__spreadValues({}, workflow), {
|
|
13766
13697
|
definition: __spreadProps(__spreadValues({}, workflow.definition), {
|
|
13767
13698
|
tasks: workflow.definition.tasks.map(
|
|
@@ -13782,8 +13713,8 @@ var validateSchema = (workflow, frames) => {
|
|
|
13782
13713
|
}
|
|
13783
13714
|
)
|
|
13784
13715
|
});
|
|
13785
|
-
|
|
13786
|
-
return
|
|
13716
|
+
validateFunction(resolved);
|
|
13717
|
+
return validateFunction.errors || [];
|
|
13787
13718
|
};
|
|
13788
13719
|
var validateTasks = (workflow, frames, products) => {
|
|
13789
13720
|
function taskCompiler(task2, baseInstancePath) {
|
|
@@ -14093,11 +14024,11 @@ function flattenErrorSchema(workflow, schema) {
|
|
|
14093
14024
|
}).filter(([, value]) => Boolean(value))
|
|
14094
14025
|
);
|
|
14095
14026
|
}
|
|
14096
|
-
var getWorkflowValidation = (workflow, internal, external) => {
|
|
14027
|
+
var getWorkflowValidation = (workflow, internal, external, validator3) => {
|
|
14097
14028
|
const rawErrors = [
|
|
14098
14029
|
...validateTrigger(workflow, internal.frames, external.products),
|
|
14099
14030
|
...validateTasks(workflow, internal.frames, external.products),
|
|
14100
|
-
...validateSchema(workflow, internal.frames)
|
|
14031
|
+
...validateSchema(workflow, internal.frames, validator3)
|
|
14101
14032
|
].filter(
|
|
14102
14033
|
(rawError) => Boolean(rawError)
|
|
14103
14034
|
).map((rawError) => {
|
|
@@ -14151,11 +14082,74 @@ var getWorkflowValidation = (workflow, internal, external) => {
|
|
|
14151
14082
|
};
|
|
14152
14083
|
};
|
|
14153
14084
|
|
|
14085
|
+
// src/views/Workflows/Creator/Provider/state/metadata/validation/hooks.ts
|
|
14086
|
+
import { useCallback as useCallback3, useMemo as useMemo2 } from "react";
|
|
14087
|
+
|
|
14088
|
+
// src/hooks/user.ts
|
|
14089
|
+
import { useMutation as useMutation2, useQuery as useQuery3, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
14090
|
+
import { api as api3 } from "@livechat/developer-studio-api";
|
|
14091
|
+
var userQueryKeys = {
|
|
14092
|
+
accounts: {
|
|
14093
|
+
account: {
|
|
14094
|
+
getInfo: ["accounts.account.getInfo"]
|
|
14095
|
+
},
|
|
14096
|
+
products: {
|
|
14097
|
+
getOrganizationProducts: ["accounts.products.getOrganizationProducts"]
|
|
14098
|
+
}
|
|
14099
|
+
},
|
|
14100
|
+
dps: {
|
|
14101
|
+
getUser: ["dps.getUser"],
|
|
14102
|
+
getUserIntegrations: ["dps.getUserIntegrations"]
|
|
14103
|
+
}
|
|
14104
|
+
};
|
|
14105
|
+
var useFetchOrganizationProducts = () => {
|
|
14106
|
+
var _b;
|
|
14107
|
+
const _a = useQuery3(
|
|
14108
|
+
userQueryKeys.accounts.products.getOrganizationProducts,
|
|
14109
|
+
() => api3.platform.accounts.products.getOrganizationProducts()
|
|
14110
|
+
), { data, isLoading } = _a, rest = __objRest(_a, ["data", "isLoading"]);
|
|
14111
|
+
return __spreadValues({ data: (_b = data == null ? void 0 : data.data) != null ? _b : [], isLoading }, rest);
|
|
14112
|
+
};
|
|
14113
|
+
var useUpdateOrganizationProducts = () => {
|
|
14114
|
+
const queryClient = useQueryClient2();
|
|
14115
|
+
const { mutateAsync: updateOrganizationProducts, isLoading } = useMutation2(
|
|
14116
|
+
({ productName }) => api3.platform.accounts.products.updateOrganizationProducts({
|
|
14117
|
+
product: productName
|
|
14118
|
+
}),
|
|
14119
|
+
{
|
|
14120
|
+
onSuccess: (_2) => {
|
|
14121
|
+
void queryClient.refetchQueries({
|
|
14122
|
+
queryKey: userQueryKeys.accounts.products.getOrganizationProducts
|
|
14123
|
+
});
|
|
14124
|
+
}
|
|
14125
|
+
}
|
|
14126
|
+
);
|
|
14127
|
+
return { updateOrganizationProducts, isLoading };
|
|
14128
|
+
};
|
|
14129
|
+
|
|
14130
|
+
// src/views/Workflows/Creator/Provider/state/metadata/validation/hooks.ts
|
|
14131
|
+
function useWorkflowValidator() {
|
|
14132
|
+
const organizationProducts = useFetchOrganizationProducts();
|
|
14133
|
+
const validator3 = useMemo2(getValidator, []);
|
|
14134
|
+
const validate = useCallback3(
|
|
14135
|
+
(workflow, internal) => getWorkflowValidation(
|
|
14136
|
+
workflow,
|
|
14137
|
+
internal,
|
|
14138
|
+
{
|
|
14139
|
+
products: organizationProducts.data
|
|
14140
|
+
},
|
|
14141
|
+
validator3
|
|
14142
|
+
),
|
|
14143
|
+
[validator3, organizationProducts.data]
|
|
14144
|
+
);
|
|
14145
|
+
return validate;
|
|
14146
|
+
}
|
|
14147
|
+
|
|
14154
14148
|
// src/views/Workflows/Creator/Provider/state/metadata/hooks.ts
|
|
14155
14149
|
function useWorkflowMetadata(workflow) {
|
|
14156
14150
|
const credentialsQuery = useFetchIntegrationCredentialsQuery();
|
|
14157
|
-
const
|
|
14158
|
-
const metadata =
|
|
14151
|
+
const validator3 = useWorkflowValidator();
|
|
14152
|
+
const metadata = useMemo3(() => {
|
|
14159
14153
|
var _a;
|
|
14160
14154
|
const elements = {
|
|
14161
14155
|
trigger: workflow.trigger,
|
|
@@ -14169,19 +14163,13 @@ function useWorkflowMetadata(workflow) {
|
|
|
14169
14163
|
const frames = getWorkflowContexts(workflow, {
|
|
14170
14164
|
credentials: (_a = credentialsQuery.data) != null ? _a : []
|
|
14171
14165
|
});
|
|
14172
|
-
const validation =
|
|
14173
|
-
workflow,
|
|
14174
|
-
{ frames },
|
|
14175
|
-
{
|
|
14176
|
-
products: organizationProducts.data
|
|
14177
|
-
}
|
|
14178
|
-
);
|
|
14166
|
+
const validation = validator3(workflow, { frames });
|
|
14179
14167
|
return {
|
|
14180
14168
|
elements,
|
|
14181
14169
|
frames,
|
|
14182
14170
|
validation
|
|
14183
14171
|
};
|
|
14184
|
-
}, [workflow, credentialsQuery.data
|
|
14172
|
+
}, [validator3, workflow, credentialsQuery.data]);
|
|
14185
14173
|
return {
|
|
14186
14174
|
metadata
|
|
14187
14175
|
};
|
|
@@ -14278,8 +14266,9 @@ function WorkflowCreatorProviderBase({
|
|
|
14278
14266
|
}) {
|
|
14279
14267
|
var _a, _b;
|
|
14280
14268
|
const { fitView } = useReactFlow();
|
|
14281
|
-
const navigate =
|
|
14269
|
+
const navigate = useNavigate3();
|
|
14282
14270
|
const notifications = useNotificationContext2();
|
|
14271
|
+
const replaceWorkflowId = useReplaceWorkflowIdInUrl();
|
|
14283
14272
|
const createWorkflowAction = useCreateWorkflow();
|
|
14284
14273
|
const createWorkflowDraftAction = useCreateWorkflowDraft();
|
|
14285
14274
|
const updateWorkflowAction = useUpdateWorkflow();
|
|
@@ -14290,22 +14279,22 @@ function WorkflowCreatorProviderBase({
|
|
|
14290
14279
|
state,
|
|
14291
14280
|
updaters: { setWorkflow, setAction, setSelection }
|
|
14292
14281
|
} = useWorkflowState(workflow, options);
|
|
14293
|
-
const autosaveStateRef =
|
|
14294
|
-
const autosaveWorkflowRef =
|
|
14282
|
+
const autosaveStateRef = useRef3(state);
|
|
14283
|
+
const autosaveWorkflowRef = useRef3(
|
|
14295
14284
|
debounce(() => __async(this, null, function* () {
|
|
14296
14285
|
yield save(true);
|
|
14297
14286
|
}), 500)
|
|
14298
14287
|
);
|
|
14299
14288
|
const autosaveWorkflow = autosaveWorkflowRef.current;
|
|
14300
|
-
|
|
14289
|
+
useEffect4(() => {
|
|
14301
14290
|
return () => {
|
|
14302
14291
|
autosaveWorkflow.cancel();
|
|
14303
14292
|
};
|
|
14304
14293
|
}, [autosaveWorkflow]);
|
|
14305
|
-
|
|
14294
|
+
useEffect4(() => {
|
|
14306
14295
|
autosaveStateRef.current = state;
|
|
14307
14296
|
}, [state]);
|
|
14308
|
-
const focus =
|
|
14297
|
+
const focus = useCallback4(
|
|
14309
14298
|
(identifier2) => {
|
|
14310
14299
|
setTimeout(
|
|
14311
14300
|
() => fitView(
|
|
@@ -14326,7 +14315,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14326
14315
|
},
|
|
14327
14316
|
[fitView]
|
|
14328
14317
|
);
|
|
14329
|
-
const toggle =
|
|
14318
|
+
const toggle = useCallback4(
|
|
14330
14319
|
(params) => {
|
|
14331
14320
|
setTimeout(() => {
|
|
14332
14321
|
setSelection(() => {
|
|
@@ -14350,7 +14339,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14350
14339
|
},
|
|
14351
14340
|
[focus, setSelection]
|
|
14352
14341
|
);
|
|
14353
|
-
const validate =
|
|
14342
|
+
const validate = useCallback4(() => {
|
|
14354
14343
|
var _a2;
|
|
14355
14344
|
const state2 = autosaveStateRef.current;
|
|
14356
14345
|
if (((_a2 = options == null ? void 0 : options.validation) == null ? void 0 : _a2.strategy) !== "non-blocking" && !state2.metadata.validation.isValid) {
|
|
@@ -14381,21 +14370,21 @@ function WorkflowCreatorProviderBase({
|
|
|
14381
14370
|
}
|
|
14382
14371
|
return true;
|
|
14383
14372
|
}, [(_a = options == null ? void 0 : options.validation) == null ? void 0 : _a.strategy, toggle]);
|
|
14384
|
-
const replaceWorkflow =
|
|
14373
|
+
const replaceWorkflow = useCallback4(
|
|
14385
14374
|
(workflow2) => {
|
|
14386
14375
|
setWorkflow(workflow2);
|
|
14387
14376
|
void autosaveWorkflowRef.current();
|
|
14388
14377
|
},
|
|
14389
14378
|
[autosaveWorkflowRef, setWorkflow]
|
|
14390
14379
|
);
|
|
14391
|
-
const changeWorkflow =
|
|
14380
|
+
const changeWorkflow = useCallback4(
|
|
14392
14381
|
(change) => {
|
|
14393
14382
|
setWorkflow((prevState) => applyChange(prevState, change(prevState)));
|
|
14394
14383
|
void autosaveWorkflowRef.current();
|
|
14395
14384
|
},
|
|
14396
14385
|
[autosaveWorkflowRef, setWorkflow]
|
|
14397
14386
|
);
|
|
14398
|
-
const goToAddTrigger =
|
|
14387
|
+
const goToAddTrigger = useCallback4(() => {
|
|
14399
14388
|
navigate(
|
|
14400
14389
|
`${basePath}/trigger/${OTHER_TYPES.SYSTEM}/${"manual" /* Manual */}`,
|
|
14401
14390
|
{
|
|
@@ -14405,7 +14394,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14405
14394
|
}
|
|
14406
14395
|
);
|
|
14407
14396
|
}, [basePath, navigate]);
|
|
14408
|
-
const addTrigger =
|
|
14397
|
+
const addTrigger = useCallback4(
|
|
14409
14398
|
(trigger) => {
|
|
14410
14399
|
changeWorkflow(() => ({
|
|
14411
14400
|
trigger
|
|
@@ -14419,7 +14408,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14419
14408
|
},
|
|
14420
14409
|
[changeWorkflow, toggle]
|
|
14421
14410
|
);
|
|
14422
|
-
const updateTrigger =
|
|
14411
|
+
const updateTrigger = useCallback4(
|
|
14423
14412
|
(trigger) => {
|
|
14424
14413
|
changeWorkflow(() => ({
|
|
14425
14414
|
trigger
|
|
@@ -14427,7 +14416,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14427
14416
|
},
|
|
14428
14417
|
[changeWorkflow]
|
|
14429
14418
|
);
|
|
14430
|
-
const removeTrigger =
|
|
14419
|
+
const removeTrigger = useCallback4(() => {
|
|
14431
14420
|
var _a2;
|
|
14432
14421
|
const state2 = autosaveStateRef.current;
|
|
14433
14422
|
replaceWorkflow(__spreadProps(__spreadValues({}, state2.workflow), {
|
|
@@ -14437,7 +14426,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14437
14426
|
toggle();
|
|
14438
14427
|
}
|
|
14439
14428
|
}, [replaceWorkflow, toggle]);
|
|
14440
|
-
const goToAddTask =
|
|
14429
|
+
const goToAddTask = useCallback4(
|
|
14441
14430
|
(taskReference, parentTaskReference) => {
|
|
14442
14431
|
navigate(`${basePath}/add`, {
|
|
14443
14432
|
state: {
|
|
@@ -14449,7 +14438,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14449
14438
|
},
|
|
14450
14439
|
[state.metadata.frames, navigate, basePath]
|
|
14451
14440
|
);
|
|
14452
|
-
const addTask =
|
|
14441
|
+
const addTask = useCallback4(
|
|
14453
14442
|
(task2, targetTaskReference, parentTaskReference) => {
|
|
14454
14443
|
var _a2;
|
|
14455
14444
|
const existingTasks = Object.values(state.metadata.elements.tasks).filter((x) => x.taskReferenceName.includes(task2.taskReferenceName)).sort((a, b) => {
|
|
@@ -14558,7 +14547,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14558
14547
|
},
|
|
14559
14548
|
[state.workflow.definition.tasks, changeWorkflow, toggle]
|
|
14560
14549
|
);
|
|
14561
|
-
const updateTask =
|
|
14550
|
+
const updateTask = useCallback4(
|
|
14562
14551
|
(targetTaskReferenceName, targetTask) => {
|
|
14563
14552
|
changeWorkflow((workflow2) => ({
|
|
14564
14553
|
definition: {
|
|
@@ -14575,7 +14564,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14575
14564
|
},
|
|
14576
14565
|
[changeWorkflow]
|
|
14577
14566
|
);
|
|
14578
|
-
const removeTask =
|
|
14567
|
+
const removeTask = useCallback4(
|
|
14579
14568
|
(targetTaskReferenceName) => {
|
|
14580
14569
|
var _a2;
|
|
14581
14570
|
changeWorkflow((workflow2) => ({
|
|
@@ -14596,7 +14585,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14596
14585
|
},
|
|
14597
14586
|
[(_b = state.selection) == null ? void 0 : _b.id, changeWorkflow, toggle]
|
|
14598
14587
|
);
|
|
14599
|
-
const save =
|
|
14588
|
+
const save = useCallback4(
|
|
14600
14589
|
(silent) => __async(this, null, function* () {
|
|
14601
14590
|
const state2 = autosaveStateRef.current;
|
|
14602
14591
|
if (!state2.workflow.draft && !validate()) {
|
|
@@ -14625,7 +14614,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14625
14614
|
"Workflow has been created successfully"
|
|
14626
14615
|
);
|
|
14627
14616
|
}
|
|
14628
|
-
|
|
14617
|
+
replaceWorkflowId(workflowId);
|
|
14629
14618
|
}
|
|
14630
14619
|
} finally {
|
|
14631
14620
|
setAction("isSaving", false);
|
|
@@ -14635,13 +14624,13 @@ function WorkflowCreatorProviderBase({
|
|
|
14635
14624
|
createWorkflowAction,
|
|
14636
14625
|
updateWorkflowAction,
|
|
14637
14626
|
notifications,
|
|
14627
|
+
replaceWorkflowId,
|
|
14638
14628
|
validate,
|
|
14639
|
-
navigate,
|
|
14640
14629
|
setWorkflow,
|
|
14641
14630
|
setAction
|
|
14642
14631
|
]
|
|
14643
14632
|
);
|
|
14644
|
-
const activate =
|
|
14633
|
+
const activate = useCallback4(() => __async(this, null, function* () {
|
|
14645
14634
|
const state2 = autosaveStateRef.current;
|
|
14646
14635
|
if (state2.workflow.draft) {
|
|
14647
14636
|
return;
|
|
@@ -14665,7 +14654,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14665
14654
|
setAction("isActivating", false);
|
|
14666
14655
|
}
|
|
14667
14656
|
}), [activateWorkflowAction, notifications, validate, setWorkflow, setAction]);
|
|
14668
|
-
const remove =
|
|
14657
|
+
const remove = useCallback4(() => __async(this, null, function* () {
|
|
14669
14658
|
const state2 = autosaveStateRef.current;
|
|
14670
14659
|
setAction("isRemoving", true);
|
|
14671
14660
|
try {
|
|
@@ -14684,7 +14673,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14684
14673
|
setAction("isRemoving", false);
|
|
14685
14674
|
}
|
|
14686
14675
|
}), [setAction, navigate, notifications, deleteWorkflowAction]);
|
|
14687
|
-
const createDraft =
|
|
14676
|
+
const createDraft = useCallback4(
|
|
14688
14677
|
(options2) => __async(this, null, function* () {
|
|
14689
14678
|
const state2 = autosaveStateRef.current;
|
|
14690
14679
|
if (state2.workflow.draft) {
|
|
@@ -14722,7 +14711,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14722
14711
|
setAction
|
|
14723
14712
|
]
|
|
14724
14713
|
);
|
|
14725
|
-
const publishDraft =
|
|
14714
|
+
const publishDraft = useCallback4(
|
|
14726
14715
|
(options2) => __async(this, null, function* () {
|
|
14727
14716
|
var _a2;
|
|
14728
14717
|
const state2 = autosaveStateRef.current;
|
|
@@ -14767,7 +14756,7 @@ function WorkflowCreatorProviderBase({
|
|
|
14767
14756
|
createWorkflowAction
|
|
14768
14757
|
]
|
|
14769
14758
|
);
|
|
14770
|
-
const discardDraft =
|
|
14759
|
+
const discardDraft = useCallback4(() => __async(this, null, function* () {
|
|
14771
14760
|
const state2 = autosaveStateRef.current;
|
|
14772
14761
|
setAction("isDiscarding", true);
|
|
14773
14762
|
try {
|
|
@@ -14874,7 +14863,16 @@ var itemOptionCss = (active) => css`
|
|
|
14874
14863
|
`;
|
|
14875
14864
|
function ItemOption({ option, onClick, active }) {
|
|
14876
14865
|
return /* @__PURE__ */ jsx4("div", { css: itemOptionCss(active), onClick, children: /* @__PURE__ */ jsxs2(Column2, { setColumnPadding: "0", width: 6, children: [
|
|
14877
|
-
/* @__PURE__ */ jsx4(
|
|
14866
|
+
/* @__PURE__ */ jsx4(
|
|
14867
|
+
Text2,
|
|
14868
|
+
{
|
|
14869
|
+
noMargin: true,
|
|
14870
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTask.taskCard(
|
|
14871
|
+
option.key
|
|
14872
|
+
),
|
|
14873
|
+
children: option.name
|
|
14874
|
+
}
|
|
14875
|
+
),
|
|
14878
14876
|
/* @__PURE__ */ jsx4(
|
|
14879
14877
|
Text2,
|
|
14880
14878
|
{
|
|
@@ -14937,11 +14935,11 @@ var Options_default = AddWorkflowTaskOptions;
|
|
|
14937
14935
|
function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
14938
14936
|
var _a;
|
|
14939
14937
|
const [search, setSearch] = useState5("");
|
|
14940
|
-
const location =
|
|
14941
|
-
const navigate =
|
|
14942
|
-
const params =
|
|
14938
|
+
const location = useLocation2();
|
|
14939
|
+
const navigate = useNavigate4();
|
|
14940
|
+
const params = useParams2();
|
|
14943
14941
|
const [state, setState] = useState5();
|
|
14944
|
-
const config2 =
|
|
14942
|
+
const config2 = useMemo4(
|
|
14945
14943
|
() => [
|
|
14946
14944
|
// {
|
|
14947
14945
|
// name: "system",
|
|
@@ -15101,7 +15099,7 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
15101
15099
|
const amplitudeWorkflowsJourney = workflowsBlockAmplitudeJourneyFactory(
|
|
15102
15100
|
user == null ? void 0 : user.meta.email
|
|
15103
15101
|
);
|
|
15104
|
-
|
|
15102
|
+
useEffect5(() => {
|
|
15105
15103
|
var _a2, _b, _c, _d, _e, _f, _g;
|
|
15106
15104
|
if (!params.task) {
|
|
15107
15105
|
const service = (_a2 = params.service) != null ? _a2 : "livechat";
|
|
@@ -15181,12 +15179,14 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
15181
15179
|
handleAddTask(state == null ? void 0 : state.task);
|
|
15182
15180
|
},
|
|
15183
15181
|
size: "medium",
|
|
15182
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTask.saveButton,
|
|
15184
15183
|
children: "Add task"
|
|
15185
15184
|
}
|
|
15186
15185
|
)
|
|
15187
15186
|
] }),
|
|
15188
15187
|
heading: /* @__PURE__ */ jsx4(ModalHeader, { title: "Add task" }),
|
|
15189
15188
|
onClose,
|
|
15189
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTask.wrapper,
|
|
15190
15190
|
children: /* @__PURE__ */ jsxs2(Row2, { notPadded: true, children: [
|
|
15191
15191
|
/* @__PURE__ */ jsxs2(
|
|
15192
15192
|
Column3,
|
|
@@ -15275,7 +15275,16 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
15275
15275
|
end: false,
|
|
15276
15276
|
state: location.state,
|
|
15277
15277
|
to: `${basePath}/${name}`,
|
|
15278
|
-
children: /* @__PURE__ */ jsx4(
|
|
15278
|
+
children: /* @__PURE__ */ jsx4(
|
|
15279
|
+
Text3,
|
|
15280
|
+
{
|
|
15281
|
+
size: "md",
|
|
15282
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTask.taskCategoryButton(
|
|
15283
|
+
name
|
|
15284
|
+
),
|
|
15285
|
+
children: displayName
|
|
15286
|
+
}
|
|
15287
|
+
)
|
|
15279
15288
|
}
|
|
15280
15289
|
)
|
|
15281
15290
|
]
|
|
@@ -15328,8 +15337,8 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
15328
15337
|
var Modal_default = AddWorkflowTaskModal;
|
|
15329
15338
|
|
|
15330
15339
|
// src/views/Workflows/Creator/Modals/AddTrigger/Modal.tsx
|
|
15331
|
-
import { useEffect as
|
|
15332
|
-
import { NavLink as NavLink2, useLocation as
|
|
15340
|
+
import { useEffect as useEffect6, useMemo as useMemo5, useState as useState6 } from "react";
|
|
15341
|
+
import { NavLink as NavLink2, useLocation as useLocation3, useNavigate as useNavigate5, useParams as useParams3 } from "react-router-dom";
|
|
15333
15342
|
import {
|
|
15334
15343
|
Button as Button3,
|
|
15335
15344
|
DesignToken as DesignToken6,
|
|
@@ -15380,7 +15389,17 @@ var itemOptionCss2 = (active) => css`
|
|
|
15380
15389
|
`;
|
|
15381
15390
|
function ItemOption2({ option, onClick, active }) {
|
|
15382
15391
|
return /* @__PURE__ */ jsx4("div", { css: itemOptionCss2(active), onClick, children: /* @__PURE__ */ jsxs2(Column4, { setColumnPadding: "0", width: 6, children: [
|
|
15383
|
-
/* @__PURE__ */ jsx4(
|
|
15392
|
+
/* @__PURE__ */ jsx4(
|
|
15393
|
+
Text4,
|
|
15394
|
+
{
|
|
15395
|
+
bold: true,
|
|
15396
|
+
noMargin: true,
|
|
15397
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTrigger.triggerCard(
|
|
15398
|
+
option.key
|
|
15399
|
+
),
|
|
15400
|
+
children: option.name
|
|
15401
|
+
}
|
|
15402
|
+
),
|
|
15384
15403
|
/* @__PURE__ */ jsx4(
|
|
15385
15404
|
Text4,
|
|
15386
15405
|
{
|
|
@@ -15445,7 +15464,7 @@ function AddWorkflowTriggerModal({
|
|
|
15445
15464
|
onClose
|
|
15446
15465
|
}) {
|
|
15447
15466
|
const [search, setSearch] = useState6("");
|
|
15448
|
-
const config2 =
|
|
15467
|
+
const config2 = useMemo5(
|
|
15449
15468
|
() => [
|
|
15450
15469
|
{
|
|
15451
15470
|
name: OTHER_TYPES.SYSTEM,
|
|
@@ -15571,16 +15590,16 @@ function AddWorkflowTriggerModal({
|
|
|
15571
15590
|
],
|
|
15572
15591
|
[]
|
|
15573
15592
|
);
|
|
15574
|
-
const location =
|
|
15575
|
-
const navigate =
|
|
15576
|
-
const params =
|
|
15593
|
+
const location = useLocation3();
|
|
15594
|
+
const navigate = useNavigate5();
|
|
15595
|
+
const params = useParams3();
|
|
15577
15596
|
const [state, setState] = useState6();
|
|
15578
15597
|
const { addTrigger } = useWorkflowCreator();
|
|
15579
15598
|
const { user } = useUserContext4();
|
|
15580
15599
|
const amplitudeWorkflowsJourney = workflowsBlockAmplitudeJourneyFactory(
|
|
15581
15600
|
user == null ? void 0 : user.meta.email
|
|
15582
15601
|
);
|
|
15583
|
-
|
|
15602
|
+
useEffect6(() => {
|
|
15584
15603
|
var _a, _b;
|
|
15585
15604
|
if (!params.trigger) {
|
|
15586
15605
|
const firstTrigger = (_b = (_a = config2.find((el) => el.name === params.service)) == null ? void 0 : _a.values.sort((a, b) => a.name.localeCompare(b.name))[0]) == null ? void 0 : _b.key;
|
|
@@ -15619,12 +15638,14 @@ function AddWorkflowTriggerModal({
|
|
|
15619
15638
|
handleAddTrigger(state == null ? void 0 : state.trigger);
|
|
15620
15639
|
},
|
|
15621
15640
|
size: "medium",
|
|
15641
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTrigger.saveButton,
|
|
15622
15642
|
children: "Add trigger"
|
|
15623
15643
|
}
|
|
15624
15644
|
)
|
|
15625
15645
|
] }),
|
|
15626
15646
|
heading: /* @__PURE__ */ jsx4(ModalHeader2, { title: "Add trigger" }),
|
|
15627
15647
|
onClose,
|
|
15648
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTrigger.wrapper,
|
|
15628
15649
|
children: /* @__PURE__ */ jsxs2(Row3, { notPadded: true, children: [
|
|
15629
15650
|
/* @__PURE__ */ jsxs2(
|
|
15630
15651
|
Column5,
|
|
@@ -15713,7 +15734,16 @@ function AddWorkflowTriggerModal({
|
|
|
15713
15734
|
end: false,
|
|
15714
15735
|
state: location.state,
|
|
15715
15736
|
to: `${basePath}/${name}`,
|
|
15716
|
-
children: /* @__PURE__ */ jsx4(
|
|
15737
|
+
children: /* @__PURE__ */ jsx4(
|
|
15738
|
+
Text5,
|
|
15739
|
+
{
|
|
15740
|
+
size: "md",
|
|
15741
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.addTrigger.triggerCategoryButton(
|
|
15742
|
+
name
|
|
15743
|
+
),
|
|
15744
|
+
children: displayName
|
|
15745
|
+
}
|
|
15746
|
+
)
|
|
15717
15747
|
}
|
|
15718
15748
|
)
|
|
15719
15749
|
]
|
|
@@ -15840,7 +15870,7 @@ function DeleteWorkflowModal({
|
|
|
15840
15870
|
}
|
|
15841
15871
|
|
|
15842
15872
|
// src/views/Workflows/Creator/Modals/Edit/Modal.tsx
|
|
15843
|
-
import { useNavigate as
|
|
15873
|
+
import { useNavigate as useNavigate6 } from "react-router-dom";
|
|
15844
15874
|
import { Error as Error3 } from "@livechat/design-system-icons";
|
|
15845
15875
|
import {
|
|
15846
15876
|
Button as Button5,
|
|
@@ -15854,7 +15884,7 @@ import {
|
|
|
15854
15884
|
} from "@livechat/developer-studio-ui-react";
|
|
15855
15885
|
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
15856
15886
|
function EditWorkflowModal({ onClose }) {
|
|
15857
|
-
const navigate =
|
|
15887
|
+
const navigate = useNavigate6();
|
|
15858
15888
|
const {
|
|
15859
15889
|
state: {
|
|
15860
15890
|
workflow,
|
|
@@ -15911,7 +15941,7 @@ function EditWorkflowModal({ onClose }) {
|
|
|
15911
15941
|
}
|
|
15912
15942
|
|
|
15913
15943
|
// src/views/Workflows/Creator/Modals/Execute/Modal.tsx
|
|
15914
|
-
import { useCallback as
|
|
15944
|
+
import { useCallback as useCallback5 } from "react";
|
|
15915
15945
|
import { Field, Form } from "react-final-form";
|
|
15916
15946
|
import validator from "validator";
|
|
15917
15947
|
import {
|
|
@@ -15929,7 +15959,7 @@ function ExecuteWorkflowModal({
|
|
|
15929
15959
|
onClose
|
|
15930
15960
|
}) {
|
|
15931
15961
|
const executeMutation = useExecuteWorkflow();
|
|
15932
|
-
const onSubmit =
|
|
15962
|
+
const onSubmit = useCallback5(
|
|
15933
15963
|
(data) => __async(this, null, function* () {
|
|
15934
15964
|
yield executeMutation.mutateAsync({
|
|
15935
15965
|
workflow,
|
|
@@ -16011,8 +16041,8 @@ function ExecuteWorkflowModal({
|
|
|
16011
16041
|
var Modal_default3 = ExecuteWorkflowModal;
|
|
16012
16042
|
|
|
16013
16043
|
// src/views/Workflows/Creator/Modals/Preview/Modal.tsx
|
|
16014
|
-
import { useCallback as
|
|
16015
|
-
import { useNavigate as
|
|
16044
|
+
import { useCallback as useCallback16 } from "react";
|
|
16045
|
+
import { useNavigate as useNavigate10 } from "react-router-dom";
|
|
16016
16046
|
|
|
16017
16047
|
// ../../../node_modules/.pnpm/@emotion+styled@11.14.0_@emotion+react@11.14.0_@types+react@18.3.18_react@18.3.1__@types+react@18.3.18_react@18.3.1/node_modules/@emotion/styled/base/dist/emotion-styled-base.esm.js
|
|
16018
16048
|
import * as React4 from "react";
|
|
@@ -16322,7 +16352,7 @@ import {
|
|
|
16322
16352
|
import { Row as Row11 } from "@livechat/developer-studio-ui-react";
|
|
16323
16353
|
|
|
16324
16354
|
// src/views/Workflows/Creator/Builder/Diagram.tsx
|
|
16325
|
-
import { useCallback as
|
|
16355
|
+
import { useCallback as useCallback15, useEffect as useEffect18 } from "react";
|
|
16326
16356
|
import ReactFlow, {
|
|
16327
16357
|
addEdge,
|
|
16328
16358
|
Background,
|
|
@@ -16362,6 +16392,7 @@ function AddTaskNode(node2) {
|
|
|
16362
16392
|
node2.data.parentTaskReference
|
|
16363
16393
|
);
|
|
16364
16394
|
},
|
|
16395
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.builder.nodes.add.task.button,
|
|
16365
16396
|
children: workflow.definition.tasks.length > 0 ? "" : "Add task"
|
|
16366
16397
|
}
|
|
16367
16398
|
),
|
|
@@ -16388,6 +16419,7 @@ function AddTriggerNode(node2) {
|
|
|
16388
16419
|
onClick: () => {
|
|
16389
16420
|
goToAddTrigger();
|
|
16390
16421
|
},
|
|
16422
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.builder.nodes.add.trigger.button,
|
|
16391
16423
|
children: "Add trigger"
|
|
16392
16424
|
}
|
|
16393
16425
|
),
|
|
@@ -16495,7 +16527,7 @@ import SchemaForm from "@rjsf/core";
|
|
|
16495
16527
|
import validator2 from "@rjsf/validator-ajv8";
|
|
16496
16528
|
|
|
16497
16529
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomString/Field.tsx
|
|
16498
|
-
import { useEffect as
|
|
16530
|
+
import { useCallback as useCallback9, useEffect as useEffect10, useMemo as useMemo7, useState as useState12 } from "react";
|
|
16499
16531
|
import { getDefaultRegistry } from "@rjsf/core";
|
|
16500
16532
|
import { MoreHoriz } from "@livechat/design-system-icons";
|
|
16501
16533
|
import {
|
|
@@ -16509,7 +16541,7 @@ import { Intro as Intro2, Row as Row7 } from "@livechat/developer-studio-ui-reac
|
|
|
16509
16541
|
import { useFetchIntegrationResourceQuery } from "@livechat/platform-integrations";
|
|
16510
16542
|
|
|
16511
16543
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomTags/Field.tsx
|
|
16512
|
-
import { useRef as
|
|
16544
|
+
import { useRef as useRef6, useState as useState10 } from "react";
|
|
16513
16545
|
import { useOnClickOutside } from "@livechat/developer-studio-ui-react";
|
|
16514
16546
|
|
|
16515
16547
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomTags/TagsPicker/Picker.tsx
|
|
@@ -16952,7 +16984,7 @@ function CustomTagsPicker({
|
|
|
16952
16984
|
}
|
|
16953
16985
|
|
|
16954
16986
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomTags/TagsInput/Input.tsx
|
|
16955
|
-
import { useCallback as
|
|
16987
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useRef as useRef5 } from "react";
|
|
16956
16988
|
import debounce3 from "lodash.debounce";
|
|
16957
16989
|
import { Tooltip as Tooltip3 } from "@livechat/design-system-react-components";
|
|
16958
16990
|
|
|
@@ -17003,7 +17035,7 @@ function CustomTagTemplate(tagData, { settings: _s }) {
|
|
|
17003
17035
|
}
|
|
17004
17036
|
|
|
17005
17037
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomTags/TagsInput/Tag/Tooltip.tsx
|
|
17006
|
-
import { useCallback as
|
|
17038
|
+
import { useCallback as useCallback6, useState as useState9 } from "react";
|
|
17007
17039
|
import debounce2 from "lodash.debounce";
|
|
17008
17040
|
import {
|
|
17009
17041
|
DesignToken as DesignToken10,
|
|
@@ -17022,8 +17054,8 @@ var useCustomTagsInputTagTooltipData = () => {
|
|
|
17022
17054
|
visible: false
|
|
17023
17055
|
}
|
|
17024
17056
|
);
|
|
17025
|
-
const setTooltipDataDebounced =
|
|
17026
|
-
const showTagTooltip =
|
|
17057
|
+
const setTooltipDataDebounced = useCallback6(debounce2(setTooltipData, 50), []);
|
|
17058
|
+
const showTagTooltip = useCallback6(
|
|
17027
17059
|
(tag, tagElement) => {
|
|
17028
17060
|
const rect = tagElement.getBoundingClientRect();
|
|
17029
17061
|
const tooltipPosition = {
|
|
@@ -17038,7 +17070,7 @@ var useCustomTagsInputTagTooltipData = () => {
|
|
|
17038
17070
|
},
|
|
17039
17071
|
[setTooltipDataDebounced]
|
|
17040
17072
|
);
|
|
17041
|
-
const hideTagTooltip =
|
|
17073
|
+
const hideTagTooltip = useCallback6(() => {
|
|
17042
17074
|
setTooltipDataDebounced({
|
|
17043
17075
|
visible: false
|
|
17044
17076
|
});
|
|
@@ -17107,10 +17139,10 @@ function CustomTagsInputTagTooltip({
|
|
|
17107
17139
|
}
|
|
17108
17140
|
|
|
17109
17141
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomTags/TagsInput/Tags.tsx
|
|
17110
|
-
import { memo as memo3, useCallback as
|
|
17142
|
+
import { memo as memo3, useCallback as useCallback7, useEffect as useEffect7, useMemo as useMemo6, useRef as useRef4 } from "react";
|
|
17111
17143
|
import Tagify from "@yaireo/tagify";
|
|
17112
17144
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
17113
|
-
var noop = (
|
|
17145
|
+
var noop = (_2) => _2;
|
|
17114
17146
|
var isSameDeep = (a, b) => {
|
|
17115
17147
|
const trans = (x) => typeof x === "string" ? x : JSON.stringify(x);
|
|
17116
17148
|
return trans(a) === trans(b);
|
|
@@ -17191,12 +17223,12 @@ function TagifyWrapper({
|
|
|
17191
17223
|
defaultValue,
|
|
17192
17224
|
showDropdown
|
|
17193
17225
|
}) {
|
|
17194
|
-
const mountedRef =
|
|
17195
|
-
const inputElmRef =
|
|
17196
|
-
const tagify =
|
|
17197
|
-
const lastClassNameRef =
|
|
17226
|
+
const mountedRef = useRef4();
|
|
17227
|
+
const inputElmRef = useRef4(null);
|
|
17228
|
+
const tagify = useRef4();
|
|
17229
|
+
const lastClassNameRef = useRef4();
|
|
17198
17230
|
const _value = defaultValue || value;
|
|
17199
|
-
const inputAttrs =
|
|
17231
|
+
const inputAttrs = useMemo6(
|
|
17200
17232
|
() => ({
|
|
17201
17233
|
ref: inputElmRef,
|
|
17202
17234
|
name,
|
|
@@ -17209,10 +17241,10 @@ function TagifyWrapper({
|
|
|
17209
17241
|
}),
|
|
17210
17242
|
[]
|
|
17211
17243
|
);
|
|
17212
|
-
const setFocus =
|
|
17244
|
+
const setFocus = useCallback7(() => {
|
|
17213
17245
|
autoFocus && tagify.current.DOM.input.focus();
|
|
17214
17246
|
}, [tagify]);
|
|
17215
|
-
|
|
17247
|
+
useEffect7(() => {
|
|
17216
17248
|
templatesToString(settings2.templates);
|
|
17217
17249
|
settings2.userInput = userInput;
|
|
17218
17250
|
if (InputMode === "textarea") settings2.mode = "mix";
|
|
@@ -17230,70 +17262,70 @@ function TagifyWrapper({
|
|
|
17230
17262
|
t.destroy();
|
|
17231
17263
|
};
|
|
17232
17264
|
}, []);
|
|
17233
|
-
|
|
17265
|
+
useEffect7(() => {
|
|
17234
17266
|
tagify.current.off("change").on("change", onChange);
|
|
17235
17267
|
}, [onChange]);
|
|
17236
|
-
|
|
17268
|
+
useEffect7(() => {
|
|
17237
17269
|
tagify.current.off("input").on("input", onInput);
|
|
17238
17270
|
}, [onInput]);
|
|
17239
|
-
|
|
17271
|
+
useEffect7(() => {
|
|
17240
17272
|
tagify.current.off("add").on("add", onAdd);
|
|
17241
17273
|
}, [onAdd]);
|
|
17242
|
-
|
|
17274
|
+
useEffect7(() => {
|
|
17243
17275
|
tagify.current.off("remove").on("remove", onRemove);
|
|
17244
17276
|
}, [onRemove]);
|
|
17245
|
-
|
|
17277
|
+
useEffect7(() => {
|
|
17246
17278
|
tagify.current.off("invalid").on("invalid", onInvalid);
|
|
17247
17279
|
}, [onInvalid]);
|
|
17248
|
-
|
|
17280
|
+
useEffect7(() => {
|
|
17249
17281
|
tagify.current.off("keydown").on("keydown", onKeydown);
|
|
17250
17282
|
}, [onKeydown]);
|
|
17251
|
-
|
|
17283
|
+
useEffect7(() => {
|
|
17252
17284
|
tagify.current.off("focus").on("focus", onFocus);
|
|
17253
17285
|
}, [onFocus]);
|
|
17254
|
-
|
|
17286
|
+
useEffect7(() => {
|
|
17255
17287
|
tagify.current.off("blur").on("blur", onBlur);
|
|
17256
17288
|
}, [onBlur]);
|
|
17257
|
-
|
|
17289
|
+
useEffect7(() => {
|
|
17258
17290
|
tagify.current.off("click").on("click", onClick);
|
|
17259
17291
|
}, [onClick]);
|
|
17260
|
-
|
|
17292
|
+
useEffect7(() => {
|
|
17261
17293
|
tagify.current.off("edit:input").on("edit:input", onEditInput);
|
|
17262
17294
|
}, [onEditInput]);
|
|
17263
|
-
|
|
17295
|
+
useEffect7(() => {
|
|
17264
17296
|
tagify.current.off("edit:beforeUpdate").on("edit:beforeUpdate", onEditBeforeUpdate);
|
|
17265
17297
|
}, [onEditBeforeUpdate]);
|
|
17266
|
-
|
|
17298
|
+
useEffect7(() => {
|
|
17267
17299
|
tagify.current.off("edit:updated").on("edit:updated", onEditUpdated);
|
|
17268
17300
|
}, [onEditUpdated]);
|
|
17269
|
-
|
|
17301
|
+
useEffect7(() => {
|
|
17270
17302
|
tagify.current.off("edit:start").on("edit:start", onEditStart);
|
|
17271
17303
|
}, [onEditStart]);
|
|
17272
|
-
|
|
17304
|
+
useEffect7(() => {
|
|
17273
17305
|
tagify.current.off("edit:keydown").on("edit:keydown", onEditKeydown);
|
|
17274
17306
|
}, [onEditKeydown]);
|
|
17275
|
-
|
|
17307
|
+
useEffect7(() => {
|
|
17276
17308
|
tagify.current.off("dropdown:show").on("dropdown:show", onDropdownShow);
|
|
17277
17309
|
}, [onDropdownShow]);
|
|
17278
|
-
|
|
17310
|
+
useEffect7(() => {
|
|
17279
17311
|
tagify.current.off("dropdown:hide").on("dropdown:hide", onDropdownHide);
|
|
17280
17312
|
}, [onDropdownHide]);
|
|
17281
|
-
|
|
17313
|
+
useEffect7(() => {
|
|
17282
17314
|
tagify.current.off("dropdown:select").on("dropdown:select", onDropdownSelect);
|
|
17283
17315
|
}, [onDropdownSelect]);
|
|
17284
|
-
|
|
17316
|
+
useEffect7(() => {
|
|
17285
17317
|
tagify.current.off("dropdown:scroll").on("dropdown:scroll", onDropdownScroll);
|
|
17286
17318
|
}, [onDropdownScroll]);
|
|
17287
|
-
|
|
17319
|
+
useEffect7(() => {
|
|
17288
17320
|
tagify.current.off("dropdown:noMatch").on("dropdown:noMatch", onDropdownNoMatch);
|
|
17289
17321
|
}, [onDropdownNoMatch]);
|
|
17290
|
-
|
|
17322
|
+
useEffect7(() => {
|
|
17291
17323
|
tagify.current.off("dropdown:updated").on("dropdown:updated", onDropdownUpdated);
|
|
17292
17324
|
}, [onDropdownUpdated]);
|
|
17293
|
-
|
|
17325
|
+
useEffect7(() => {
|
|
17294
17326
|
setFocus();
|
|
17295
17327
|
}, [autoFocus]);
|
|
17296
|
-
|
|
17328
|
+
useEffect7(() => {
|
|
17297
17329
|
if (mountedRef.current) {
|
|
17298
17330
|
tagify.current.settings.whitelist.length = 0;
|
|
17299
17331
|
(whitelist == null ? void 0 : whitelist.length) && tagify.current.settings.whitelist.push(
|
|
@@ -17301,13 +17333,13 @@ function TagifyWrapper({
|
|
|
17301
17333
|
);
|
|
17302
17334
|
}
|
|
17303
17335
|
}, [whitelist]);
|
|
17304
|
-
|
|
17336
|
+
useEffect7(() => {
|
|
17305
17337
|
const currentValue = tagify.current.getInputValue();
|
|
17306
17338
|
if (mountedRef.current && !isSameDeep(value, currentValue)) {
|
|
17307
17339
|
tagify.current.loadOriginalValues(value);
|
|
17308
17340
|
}
|
|
17309
17341
|
}, [value]);
|
|
17310
|
-
|
|
17342
|
+
useEffect7(() => {
|
|
17311
17343
|
if (mountedRef.current) {
|
|
17312
17344
|
const { added, removed } = compareStrings(
|
|
17313
17345
|
lastClassNameRef.current,
|
|
@@ -17322,33 +17354,33 @@ function TagifyWrapper({
|
|
|
17322
17354
|
}
|
|
17323
17355
|
lastClassNameRef.current = className;
|
|
17324
17356
|
}, [className]);
|
|
17325
|
-
|
|
17357
|
+
useEffect7(() => {
|
|
17326
17358
|
if (mountedRef.current) {
|
|
17327
17359
|
tagify.current.loading(loading);
|
|
17328
17360
|
}
|
|
17329
17361
|
}, [loading]);
|
|
17330
|
-
|
|
17362
|
+
useEffect7(() => {
|
|
17331
17363
|
if (mountedRef.current) {
|
|
17332
17364
|
tagify.current.setReadonly(readOnly != null ? readOnly : false);
|
|
17333
17365
|
}
|
|
17334
17366
|
}, [readOnly]);
|
|
17335
|
-
|
|
17367
|
+
useEffect7(() => {
|
|
17336
17368
|
if (mountedRef.current) {
|
|
17337
17369
|
tagify.current.setDisabled(disabled != null ? disabled : false);
|
|
17338
17370
|
}
|
|
17339
17371
|
}, [disabled]);
|
|
17340
|
-
|
|
17372
|
+
useEffect7(() => {
|
|
17341
17373
|
if (mountedRef.current) {
|
|
17342
17374
|
const current = tagify.current;
|
|
17343
17375
|
current.userInput = userInput;
|
|
17344
17376
|
}
|
|
17345
17377
|
}, [userInput]);
|
|
17346
|
-
|
|
17378
|
+
useEffect7(() => {
|
|
17347
17379
|
if (mountedRef.current) {
|
|
17348
17380
|
tagify.current.setPlaceholder(placeholder2);
|
|
17349
17381
|
}
|
|
17350
17382
|
}, [placeholder2]);
|
|
17351
|
-
|
|
17383
|
+
useEffect7(() => {
|
|
17352
17384
|
const t = tagify.current;
|
|
17353
17385
|
if (mountedRef.current) {
|
|
17354
17386
|
if (showDropdown) {
|
|
@@ -17359,7 +17391,7 @@ function TagifyWrapper({
|
|
|
17359
17391
|
}
|
|
17360
17392
|
}
|
|
17361
17393
|
}, [showDropdown]);
|
|
17362
|
-
|
|
17394
|
+
useEffect7(() => {
|
|
17363
17395
|
mountedRef.current = true;
|
|
17364
17396
|
}, []);
|
|
17365
17397
|
return (
|
|
@@ -17471,23 +17503,23 @@ function CustomTagsInput({
|
|
|
17471
17503
|
renderPicker,
|
|
17472
17504
|
renderPickerTrigger
|
|
17473
17505
|
}) {
|
|
17474
|
-
const tagifyRef =
|
|
17506
|
+
const tagifyRef = useRef5();
|
|
17475
17507
|
const [tooltipData, { showTagTooltip, hideTagTooltip }] = useCustomTagsInputTagTooltipData();
|
|
17476
|
-
const updateAllIcons =
|
|
17508
|
+
const updateAllIcons = useCallback8(() => {
|
|
17477
17509
|
const tagify = tagifyRef.current;
|
|
17478
17510
|
if (!tagify) {
|
|
17479
17511
|
return;
|
|
17480
17512
|
}
|
|
17481
17513
|
tagify.value.forEach(updateCustomTagsInputTagIcon);
|
|
17482
17514
|
}, []);
|
|
17483
|
-
const getCurrentValue =
|
|
17515
|
+
const getCurrentValue = useCallback8(() => {
|
|
17484
17516
|
const tagify = tagifyRef.current;
|
|
17485
17517
|
if (!tagify) {
|
|
17486
17518
|
return "";
|
|
17487
17519
|
}
|
|
17488
17520
|
return tagify.getMixedTagsAsString().replace(trim2 ? /\s+/g : /\r\n$/, "").replaceAll("[[", "${").replaceAll("]]", "}").replaceAll("\u200B", "").replaceAll("\xA0", "");
|
|
17489
17521
|
}, [trim2]);
|
|
17490
|
-
const setCurrentValue =
|
|
17522
|
+
const setCurrentValue = useCallback8(
|
|
17491
17523
|
(value2, frame) => {
|
|
17492
17524
|
const tagify = tagifyRef.current;
|
|
17493
17525
|
if (!tagify) {
|
|
@@ -17498,14 +17530,14 @@ function CustomTagsInput({
|
|
|
17498
17530
|
},
|
|
17499
17531
|
[updateAllIcons]
|
|
17500
17532
|
);
|
|
17501
|
-
const handleChange =
|
|
17533
|
+
const handleChange = useCallback8(
|
|
17502
17534
|
debounce3(() => {
|
|
17503
17535
|
onChange(getCurrentValue());
|
|
17504
17536
|
updateAllIcons();
|
|
17505
17537
|
}, 300),
|
|
17506
17538
|
[onChange, getCurrentValue, updateAllIcons]
|
|
17507
17539
|
);
|
|
17508
|
-
const handleKeyDown =
|
|
17540
|
+
const handleKeyDown = useCallback8(
|
|
17509
17541
|
(e) => {
|
|
17510
17542
|
if (e.detail.event.key !== "Backspace") {
|
|
17511
17543
|
return;
|
|
@@ -17516,7 +17548,7 @@ function CustomTagsInput({
|
|
|
17516
17548
|
},
|
|
17517
17549
|
[handleChange]
|
|
17518
17550
|
);
|
|
17519
|
-
const addTag =
|
|
17551
|
+
const addTag = useCallback8(
|
|
17520
17552
|
(tag) => {
|
|
17521
17553
|
const tagify = tagifyRef.current;
|
|
17522
17554
|
if (!tagify) {
|
|
@@ -17532,7 +17564,7 @@ function CustomTagsInput({
|
|
|
17532
17564
|
},
|
|
17533
17565
|
[trim2, onPickerToggle]
|
|
17534
17566
|
);
|
|
17535
|
-
|
|
17567
|
+
useEffect8(() => {
|
|
17536
17568
|
const tagify = tagifyRef.current;
|
|
17537
17569
|
if (!tagify) {
|
|
17538
17570
|
return;
|
|
@@ -17558,7 +17590,7 @@ function CustomTagsInput({
|
|
|
17558
17590
|
showTagTooltip,
|
|
17559
17591
|
hideTagTooltip
|
|
17560
17592
|
]);
|
|
17561
|
-
|
|
17593
|
+
useEffect8(() => {
|
|
17562
17594
|
const tagify = tagifyRef.current;
|
|
17563
17595
|
if (!tagify) {
|
|
17564
17596
|
return;
|
|
@@ -17609,9 +17641,7 @@ function CustomTagsInput({
|
|
|
17609
17641
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomTags/TagsPicker/Trigger.tsx
|
|
17610
17642
|
import { Add as Add4 } from "@livechat/design-system-icons";
|
|
17611
17643
|
import { Button as Button10, Icon as Icon8 } from "@livechat/design-system-react-components";
|
|
17612
|
-
function CustomTagsPickerTrigger({
|
|
17613
|
-
onClick
|
|
17614
|
-
}) {
|
|
17644
|
+
function CustomTagsPickerTrigger({ onClick }) {
|
|
17615
17645
|
return /* @__PURE__ */ jsx4(
|
|
17616
17646
|
Button10,
|
|
17617
17647
|
{
|
|
@@ -17624,7 +17654,6 @@ function CustomTagsPickerTrigger({
|
|
|
17624
17654
|
min-height: 28px;
|
|
17625
17655
|
width: 28px;
|
|
17626
17656
|
min-width: 28px;
|
|
17627
|
-
z-index: 1000;
|
|
17628
17657
|
`,
|
|
17629
17658
|
icon: /* @__PURE__ */ jsx4(Icon8, { source: Add4 }),
|
|
17630
17659
|
kind: "plain",
|
|
@@ -17646,7 +17675,7 @@ function CustomTagsField({
|
|
|
17646
17675
|
wrapperCss: wrapperCss3,
|
|
17647
17676
|
onChange
|
|
17648
17677
|
}) {
|
|
17649
|
-
const wrapperRef =
|
|
17678
|
+
const wrapperRef = useRef6(null);
|
|
17650
17679
|
const [isPickerVisible, setIsPickerVisible] = useState10(false);
|
|
17651
17680
|
useOnClickOutside(wrapperRef, () => {
|
|
17652
17681
|
setIsPickerVisible(false);
|
|
@@ -17714,7 +17743,7 @@ function DynamicCustomStringField(props) {
|
|
|
17714
17743
|
}
|
|
17715
17744
|
|
|
17716
17745
|
// src/views/Workflows/Creator/Builder/Forms/Schema/overrides/Fields/CustomString/Modes/Predefined.tsx
|
|
17717
|
-
import { useEffect as
|
|
17746
|
+
import { useEffect as useEffect9, useState as useState11 } from "react";
|
|
17718
17747
|
import { DesignToken as DesignToken11, Picker } from "@livechat/design-system-react-components";
|
|
17719
17748
|
var pickerCustomStyles = (readonly) => css`
|
|
17720
17749
|
flex: 1;
|
|
@@ -17729,11 +17758,11 @@ function PredefinedCustomStringField(props) {
|
|
|
17729
17758
|
const { resourceQuery, onChange, schema } = props;
|
|
17730
17759
|
const resourceConfig = schema["x-ref"];
|
|
17731
17760
|
const [pickerOptions, setPickerOptions] = useState11([]);
|
|
17732
|
-
|
|
17761
|
+
useEffect9(() => {
|
|
17733
17762
|
var _a2, _b;
|
|
17734
17763
|
if (!resourceConfig) {
|
|
17735
17764
|
if (resourceQuery.data) {
|
|
17736
|
-
onChange(
|
|
17765
|
+
onChange("");
|
|
17737
17766
|
}
|
|
17738
17767
|
return;
|
|
17739
17768
|
}
|
|
@@ -17765,17 +17794,29 @@ var {
|
|
|
17765
17794
|
fields: { StringField }
|
|
17766
17795
|
} = getDefaultRegistry();
|
|
17767
17796
|
function CustomStringField(props) {
|
|
17768
|
-
var _a;
|
|
17797
|
+
var _a, _b, _c;
|
|
17769
17798
|
const onChange = props.onChange;
|
|
17770
17799
|
const resourceConfig = props.schema["x-ref"];
|
|
17771
17800
|
const resourceQuery = useFetchIntegrationResourceQuery(resourceConfig);
|
|
17801
|
+
const [pristine, setPristine] = useState12(true);
|
|
17772
17802
|
const [isPredefinedMode, setIsPredefinedMode] = useState12(
|
|
17773
17803
|
() => {
|
|
17774
|
-
var _a2,
|
|
17775
|
-
return ((_a2 = resourceQuery.data) == null ? void 0 : _a2.items.some((item) => item.key === props.formData)) || !props.formData && ((
|
|
17804
|
+
var _a2, _b2, _c2;
|
|
17805
|
+
return ((_a2 = resourceQuery.data) == null ? void 0 : _a2.items.some((item) => item.key === props.formData)) || !props.formData && ((_c2 = (_b2 = resourceQuery.data) == null ? void 0 : _b2.items.length) != null ? _c2 : 0) > 0 || void 0;
|
|
17776
17806
|
}
|
|
17777
17807
|
);
|
|
17778
|
-
const
|
|
17808
|
+
const handleChange = useCallback9(
|
|
17809
|
+
(value) => {
|
|
17810
|
+
setPristine(false);
|
|
17811
|
+
if (value !== "") {
|
|
17812
|
+
onChange(value);
|
|
17813
|
+
return;
|
|
17814
|
+
}
|
|
17815
|
+
onChange(props.schema.required ? null : void 0);
|
|
17816
|
+
},
|
|
17817
|
+
[onChange, props.schema.required]
|
|
17818
|
+
);
|
|
17819
|
+
const modeSelectorOptions = useMemo7(
|
|
17779
17820
|
() => [
|
|
17780
17821
|
resourceConfig ? {
|
|
17781
17822
|
key: "predefined",
|
|
@@ -17791,8 +17832,10 @@ function CustomStringField(props) {
|
|
|
17791
17832
|
}
|
|
17792
17833
|
) }),
|
|
17793
17834
|
onClick: () => {
|
|
17794
|
-
|
|
17795
|
-
|
|
17835
|
+
handleChange("");
|
|
17836
|
+
setTimeout(() => {
|
|
17837
|
+
setIsPredefinedMode(true);
|
|
17838
|
+
}, 50);
|
|
17796
17839
|
}
|
|
17797
17840
|
} : void 0,
|
|
17798
17841
|
{
|
|
@@ -17809,28 +17852,47 @@ function CustomStringField(props) {
|
|
|
17809
17852
|
}
|
|
17810
17853
|
) }),
|
|
17811
17854
|
onClick: () => {
|
|
17812
|
-
|
|
17855
|
+
handleChange("");
|
|
17813
17856
|
setTimeout(() => {
|
|
17814
17857
|
setIsPredefinedMode(false);
|
|
17815
|
-
},
|
|
17858
|
+
}, 50);
|
|
17816
17859
|
}
|
|
17817
17860
|
}
|
|
17818
17861
|
].filter(Boolean),
|
|
17819
|
-
[resourceConfig,
|
|
17862
|
+
[resourceConfig, handleChange, setIsPredefinedMode]
|
|
17820
17863
|
);
|
|
17821
|
-
|
|
17822
|
-
var _a2,
|
|
17864
|
+
useEffect10(() => {
|
|
17865
|
+
var _a2, _b2, _c2;
|
|
17866
|
+
if (!pristine && !props.formData) {
|
|
17867
|
+
return;
|
|
17868
|
+
}
|
|
17823
17869
|
setIsPredefinedMode(
|
|
17824
17870
|
((_a2 = resourceQuery.data) == null ? void 0 : _a2.items.some(
|
|
17825
17871
|
(option) => option.key === props.formData
|
|
17826
|
-
)) || !props.formData && ((
|
|
17872
|
+
)) || !props.formData && ((_c2 = (_b2 = resourceQuery.data) == null ? void 0 : _b2.items.length) != null ? _c2 : 0) > 0
|
|
17827
17873
|
);
|
|
17828
|
-
}, [(_a = resourceQuery.data) == null ? void 0 : _a.items, props.formData]);
|
|
17874
|
+
}, [(_a = resourceQuery.data) == null ? void 0 : _a.items, props.formData, pristine]);
|
|
17875
|
+
useEffect10(() => {
|
|
17876
|
+
setPristine(true);
|
|
17877
|
+
}, [(_c = (_b = props.formContext) == null ? void 0 : _b.frame.__meta) == null ? void 0 : _c.index]);
|
|
17829
17878
|
if (props.schema.enum || props.schema.oneOf) {
|
|
17830
17879
|
return /* @__PURE__ */ jsx4(StringField, __spreadValues({}, props));
|
|
17831
17880
|
}
|
|
17832
17881
|
return /* @__PURE__ */ jsxs2(Row7, { gap: `var(${SpacingToken11.Spacing1})`, notPadded: true, children: [
|
|
17833
|
-
|
|
17882
|
+
/* @__PURE__ */ jsx4("br", {}),
|
|
17883
|
+
isPredefinedMode ? /* @__PURE__ */ jsx4(
|
|
17884
|
+
PredefinedCustomStringField,
|
|
17885
|
+
__spreadProps(__spreadValues({}, props), {
|
|
17886
|
+
onChange: handleChange,
|
|
17887
|
+
resourceQuery
|
|
17888
|
+
})
|
|
17889
|
+
) : /* @__PURE__ */ jsx4(
|
|
17890
|
+
DynamicCustomStringField,
|
|
17891
|
+
__spreadProps(__spreadValues({}, props), {
|
|
17892
|
+
onChange: handleChange,
|
|
17893
|
+
resourceQuery
|
|
17894
|
+
})
|
|
17895
|
+
),
|
|
17834
17896
|
modeSelectorOptions.length > 1 && /* @__PURE__ */ jsx4(
|
|
17835
17897
|
ActionMenu,
|
|
17836
17898
|
{
|
|
@@ -17839,9 +17901,9 @@ function CustomStringField(props) {
|
|
|
17839
17901
|
triggerRenderer: /* @__PURE__ */ jsx4(
|
|
17840
17902
|
Button11,
|
|
17841
17903
|
{
|
|
17904
|
+
disabled: props.readonly,
|
|
17842
17905
|
icon: /* @__PURE__ */ jsx4(Icon9, { source: MoreHoriz }),
|
|
17843
|
-
kind: "secondary"
|
|
17844
|
-
disabled: props.readonly
|
|
17906
|
+
kind: "secondary"
|
|
17845
17907
|
}
|
|
17846
17908
|
)
|
|
17847
17909
|
}
|
|
@@ -18940,7 +19002,7 @@ function HttpNodeBase({
|
|
|
18940
19002
|
var Base_default2 = HttpNodeBase;
|
|
18941
19003
|
|
|
18942
19004
|
// src/views/Workflows/Creator/Builder/Forms/Schema/Wrapper.tsx
|
|
18943
|
-
import { useMemo as
|
|
19005
|
+
import { useMemo as useMemo8, useState as useState15 } from "react";
|
|
18944
19006
|
import { Error as Error4 } from "@livechat/design-system-icons";
|
|
18945
19007
|
import {
|
|
18946
19008
|
Icon as Icon15,
|
|
@@ -18959,8 +19021,8 @@ import {
|
|
|
18959
19021
|
} from "@livechat/platform-integrations";
|
|
18960
19022
|
|
|
18961
19023
|
// src/views/Workflows/Creator/Builder/Forms/Schema/integrations/Text/index.tsx
|
|
18962
|
-
import { useCallback as
|
|
18963
|
-
import { useLocation as
|
|
19024
|
+
import { useCallback as useCallback10 } from "react";
|
|
19025
|
+
import { useLocation as useLocation4 } from "react-router-dom";
|
|
18964
19026
|
import { Button as Button15, SpacingToken as SpacingToken17 } from "@livechat/design-system-react-components";
|
|
18965
19027
|
import {
|
|
18966
19028
|
Card,
|
|
@@ -18974,7 +19036,7 @@ import {
|
|
|
18974
19036
|
triggerAccountsAction
|
|
18975
19037
|
} from "@livechat/platform-integrations";
|
|
18976
19038
|
function GlobalAccounts(props) {
|
|
18977
|
-
const { pathname } =
|
|
19039
|
+
const { pathname } = useLocation4();
|
|
18978
19040
|
const notifications = useNotificationContext3();
|
|
18979
19041
|
const { user } = useUserContext7();
|
|
18980
19042
|
const organizationProductsQuery = useFetchOrganizationProducts();
|
|
@@ -18985,7 +19047,7 @@ function GlobalAccounts(props) {
|
|
|
18985
19047
|
const needToBeActivated = organizationProductsQuery.data ? !organizationProductsQuery.data.find(
|
|
18986
19048
|
(product) => product.product === props.product
|
|
18987
19049
|
) : void 0;
|
|
18988
|
-
const refetch =
|
|
19050
|
+
const refetch = useCallback10(() => {
|
|
18989
19051
|
void organizationProductsQuery.refetch();
|
|
18990
19052
|
}, [organizationProductsQuery]);
|
|
18991
19053
|
return /* @__PURE__ */ jsxs2(Column8, { gap: `var(${SpacingToken17.Spacing3})`, notPadded: true, children: [
|
|
@@ -19061,11 +19123,11 @@ function CustomSchemaFormWrapper({
|
|
|
19061
19123
|
preselectedTab,
|
|
19062
19124
|
tabsMetadata
|
|
19063
19125
|
}) {
|
|
19064
|
-
const spec =
|
|
19126
|
+
const spec = useMemo8(() => WorkflowSpecification.getItemConfig(data), [data]);
|
|
19065
19127
|
const [selectedTab, setSelectedTab] = useState15(
|
|
19066
19128
|
preselectedTab != null ? preselectedTab : !spec || spec.specification.input ? "parameters" : spec && spec.customization.provider !== OTHER_TYPES.SYSTEM ? "connection" : void 0
|
|
19067
19129
|
);
|
|
19068
|
-
const tabItems =
|
|
19130
|
+
const tabItems = useMemo8(
|
|
19069
19131
|
() => [
|
|
19070
19132
|
!spec || spec.specification.input ? { id: "parameters", title: "Parameters" } : void 0,
|
|
19071
19133
|
spec && spec.customization.provider !== OTHER_TYPES.SYSTEM ? {
|
|
@@ -19135,7 +19197,7 @@ function HttpNodeForm({
|
|
|
19135
19197
|
onChange,
|
|
19136
19198
|
readonly
|
|
19137
19199
|
}) {
|
|
19138
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
19200
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
19139
19201
|
const spec = (_a = metadata.frame.__meta) == null ? void 0 : _a.config;
|
|
19140
19202
|
if (data.name === "http") {
|
|
19141
19203
|
return /* @__PURE__ */ jsx4(
|
|
@@ -19184,15 +19246,7 @@ function HttpNodeForm({
|
|
|
19184
19246
|
data
|
|
19185
19247
|
}),
|
|
19186
19248
|
formData: queryParams,
|
|
19187
|
-
formErrors: ((_l = (_k = (_j = metadata.errors) == null ? void 0 : _j.inputParameters) == null ? void 0 : _k.http_request) == null ? void 0 : _l.uri) ?
|
|
19188
|
-
Object.entries(queryParams).map((entry) => {
|
|
19189
|
-
var _a2, _b2, _c2;
|
|
19190
|
-
return [
|
|
19191
|
-
entry[0],
|
|
19192
|
-
(_c2 = (_b2 = (_a2 = metadata.errors) == null ? void 0 : _a2.inputParameters) == null ? void 0 : _b2.http_request) == null ? void 0 : _c2.uri
|
|
19193
|
-
];
|
|
19194
|
-
})
|
|
19195
|
-
) : void 0,
|
|
19249
|
+
formErrors: ((_l = (_k = (_j = metadata.errors) == null ? void 0 : _j.inputParameters) == null ? void 0 : _k.http_request) == null ? void 0 : _l.uri) ? (_o = (_n = (_m = metadata.errors) == null ? void 0 : _m.inputParameters) == null ? void 0 : _n.http_request) == null ? void 0 : _o.uri : void 0,
|
|
19196
19250
|
onChange: (formData) => {
|
|
19197
19251
|
onChange(__spreadProps(__spreadValues({}, data), {
|
|
19198
19252
|
inputParameters: __spreadProps(__spreadValues({}, data.inputParameters), {
|
|
@@ -19206,14 +19260,14 @@ function HttpNodeForm({
|
|
|
19206
19260
|
schema: spec.specification.input.properties.query
|
|
19207
19261
|
}
|
|
19208
19262
|
) : void 0,
|
|
19209
|
-
((
|
|
19263
|
+
((_q = (_p = spec == null ? void 0 : spec.specification.input) == null ? void 0 : _p.properties) == null ? void 0 : _q.body) ? /* @__PURE__ */ jsx4(
|
|
19210
19264
|
Form_default,
|
|
19211
19265
|
{
|
|
19212
19266
|
formContext: __spreadProps(__spreadValues({}, metadata), {
|
|
19213
19267
|
data
|
|
19214
19268
|
}),
|
|
19215
19269
|
formData: data.inputParameters.http_request.body,
|
|
19216
|
-
formErrors: (
|
|
19270
|
+
formErrors: (_t = (_s = (_r = metadata.errors) == null ? void 0 : _r.inputParameters) == null ? void 0 : _s.http_request) == null ? void 0 : _t.body,
|
|
19217
19271
|
onChange: (formData) => {
|
|
19218
19272
|
onChange(__spreadProps(__spreadValues({}, data), {
|
|
19219
19273
|
inputParameters: __spreadProps(__spreadValues({}, data.inputParameters), {
|
|
@@ -20170,8 +20224,8 @@ function TriggerNode(node2) {
|
|
|
20170
20224
|
var Node_default6 = memo9(TriggerNode);
|
|
20171
20225
|
|
|
20172
20226
|
// src/views/Workflows/Creator/Builder/Controls/CustomControls.tsx
|
|
20173
|
-
import { useEffect as
|
|
20174
|
-
import { useLocation as
|
|
20227
|
+
import { useEffect as useEffect17 } from "react";
|
|
20228
|
+
import { useLocation as useLocation5, useNavigate as useNavigate8 } from "react-router-dom";
|
|
20175
20229
|
import { ControlButton, Controls, useReactFlow as useReactFlow2 } from "reactflow";
|
|
20176
20230
|
import {
|
|
20177
20231
|
ArrowAutofitWidth,
|
|
@@ -20317,7 +20371,7 @@ function StopGenerateButton() {
|
|
|
20317
20371
|
}
|
|
20318
20372
|
|
|
20319
20373
|
// src/views/Workflows/Common/One/widget/message-box/AskButton.tsx
|
|
20320
|
-
import { useEffect as
|
|
20374
|
+
import { useEffect as useEffect12, useState as useState22 } from "react";
|
|
20321
20375
|
import { useLexicalComposerContext as useLexicalComposerContext3 } from "@lexical/react/LexicalComposerContext";
|
|
20322
20376
|
import {
|
|
20323
20377
|
Button as Button17,
|
|
@@ -20326,7 +20380,7 @@ import {
|
|
|
20326
20380
|
} from "@livechat/design-system-react-components";
|
|
20327
20381
|
|
|
20328
20382
|
// src/views/Workflows/Common/One/hooks/useAboveCharacterLimit.ts
|
|
20329
|
-
import { useEffect as
|
|
20383
|
+
import { useEffect as useEffect11, useState as useState21 } from "react";
|
|
20330
20384
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
20331
20385
|
|
|
20332
20386
|
// src/views/Workflows/Common/One/widget/message-box/constants.ts
|
|
@@ -20336,7 +20390,7 @@ var ONE_CHARACTER_LIMIT = 1e4;
|
|
|
20336
20390
|
var useAboveCharacterLimit = () => {
|
|
20337
20391
|
const [editor] = useLexicalComposerContext();
|
|
20338
20392
|
const [aboveLimit, setAboveLimit] = useState21(0);
|
|
20339
|
-
|
|
20393
|
+
useEffect11(() => {
|
|
20340
20394
|
const registerTextContentListener = editor.registerTextContentListener(
|
|
20341
20395
|
(textContent) => {
|
|
20342
20396
|
setAboveLimit(textContent.length - ONE_CHARACTER_LIMIT);
|
|
@@ -20353,13 +20407,13 @@ var useAboveCharacterLimit = () => {
|
|
|
20353
20407
|
};
|
|
20354
20408
|
|
|
20355
20409
|
// src/views/Workflows/Common/One/hooks/useSendOneMessage.ts
|
|
20356
|
-
import { useCallback as
|
|
20410
|
+
import { useCallback as useCallback11, useContext as useContext8 } from "react";
|
|
20357
20411
|
import { useLexicalComposerContext as useLexicalComposerContext2 } from "@lexical/react/LexicalComposerContext";
|
|
20358
20412
|
import { CLEAR_EDITOR_COMMAND } from "lexical";
|
|
20359
20413
|
var useSendOneMessage = () => {
|
|
20360
20414
|
const [editor] = useLexicalComposerContext2();
|
|
20361
20415
|
const { sendMessage: sendMessage2 } = useContext8(OneMessagesContext);
|
|
20362
|
-
const onSend =
|
|
20416
|
+
const onSend = useCallback11(() => {
|
|
20363
20417
|
var _a;
|
|
20364
20418
|
const messageToSend = (_a = editor.getRootElement()) == null ? void 0 : _a.innerText.trim();
|
|
20365
20419
|
if (!messageToSend) {
|
|
@@ -20378,7 +20432,7 @@ function AskButton() {
|
|
|
20378
20432
|
const isLoading = false;
|
|
20379
20433
|
const { isAboveLimit } = useAboveCharacterLimit();
|
|
20380
20434
|
const handleSend = useSendOneMessage();
|
|
20381
|
-
|
|
20435
|
+
useEffect12(() => {
|
|
20382
20436
|
const registerTextContentListener = editor.registerTextContentListener(
|
|
20383
20437
|
(textContent) => {
|
|
20384
20438
|
setIsDisabled(!textContent);
|
|
@@ -20452,34 +20506,34 @@ import { HistoryPlugin } from "@lexical/react/LexicalHistoryPlugin";
|
|
|
20452
20506
|
import { PlainTextPlugin } from "@lexical/react/LexicalPlainTextPlugin";
|
|
20453
20507
|
|
|
20454
20508
|
// src/views/Workflows/Common/One/widget/message-box/custom-plugins/AutoFocusPlugin.tsx
|
|
20455
|
-
import { useCallback as
|
|
20509
|
+
import { useCallback as useCallback12, useEffect as useEffect13 } from "react";
|
|
20456
20510
|
import { useLexicalComposerContext as useLexicalComposerContext4 } from "@lexical/react/LexicalComposerContext";
|
|
20457
20511
|
function AutoFocusPlugin() {
|
|
20458
20512
|
const [editor] = useLexicalComposerContext4();
|
|
20459
|
-
const handleFocus =
|
|
20513
|
+
const handleFocus = useCallback12(() => {
|
|
20460
20514
|
editor.focus();
|
|
20461
20515
|
}, [editor]);
|
|
20462
|
-
|
|
20516
|
+
useEffect13(() => {
|
|
20463
20517
|
handleFocus();
|
|
20464
20518
|
}, []);
|
|
20465
20519
|
return null;
|
|
20466
20520
|
}
|
|
20467
20521
|
|
|
20468
20522
|
// src/views/Workflows/Common/One/widget/message-box/custom-plugins/EnterDownPlugin.tsx
|
|
20469
|
-
import { useCallback as
|
|
20523
|
+
import { useCallback as useCallback13, useEffect as useEffect14 } from "react";
|
|
20470
20524
|
import { useLexicalComposerContext as useLexicalComposerContext5 } from "@lexical/react/LexicalComposerContext";
|
|
20471
20525
|
import { COMMAND_PRIORITY_LOW, KEY_ENTER_COMMAND } from "lexical";
|
|
20472
20526
|
function EnterDownPlugin({ isCommandMenuVisibleRef }) {
|
|
20473
20527
|
const [editor] = useLexicalComposerContext5();
|
|
20474
20528
|
const isLoading = false;
|
|
20475
20529
|
const handleSendMessage = useSendOneMessage();
|
|
20476
|
-
const onEnterDown =
|
|
20530
|
+
const onEnterDown = useCallback13(() => {
|
|
20477
20531
|
if (isLoading || (isCommandMenuVisibleRef == null ? void 0 : isCommandMenuVisibleRef.current)) {
|
|
20478
20532
|
return;
|
|
20479
20533
|
}
|
|
20480
20534
|
handleSendMessage({ enter: true, messageBox: true });
|
|
20481
20535
|
}, [handleSendMessage, isLoading, isCommandMenuVisibleRef]);
|
|
20482
|
-
|
|
20536
|
+
useEffect14(
|
|
20483
20537
|
() => editor.registerCommand(
|
|
20484
20538
|
KEY_ENTER_COMMAND,
|
|
20485
20539
|
(event) => {
|
|
@@ -20542,10 +20596,10 @@ function OneMessageBox() {
|
|
|
20542
20596
|
}
|
|
20543
20597
|
|
|
20544
20598
|
// src/views/Workflows/Common/One/widget/OneChatFeedContent.tsx
|
|
20545
|
-
import { useRef as
|
|
20599
|
+
import { useRef as useRef8 } from "react";
|
|
20546
20600
|
|
|
20547
20601
|
// src/views/Workflows/Common/One/hooks/useScroll.ts
|
|
20548
|
-
import { useCallback as
|
|
20602
|
+
import { useCallback as useCallback14, useEffect as useEffect15, useRef as useRef7 } from "react";
|
|
20549
20603
|
import debounce4 from "lodash.debounce";
|
|
20550
20604
|
var useScroll = ({
|
|
20551
20605
|
oneChatFeedRef,
|
|
@@ -20553,10 +20607,10 @@ var useScroll = ({
|
|
|
20553
20607
|
additionalEvents
|
|
20554
20608
|
}) => {
|
|
20555
20609
|
const oneScrollPosition = 0;
|
|
20556
|
-
const currentScrollPosition =
|
|
20557
|
-
const isScrolledToBottom =
|
|
20558
|
-
const timeoutRef =
|
|
20559
|
-
const scrollToBottom =
|
|
20610
|
+
const currentScrollPosition = useRef7(null);
|
|
20611
|
+
const isScrolledToBottom = useRef7(true);
|
|
20612
|
+
const timeoutRef = useRef7(null);
|
|
20613
|
+
const scrollToBottom = useCallback14(() => {
|
|
20560
20614
|
if (timeoutRef.current) {
|
|
20561
20615
|
clearTimeout(timeoutRef.current);
|
|
20562
20616
|
}
|
|
@@ -20572,7 +20626,7 @@ var useScroll = ({
|
|
|
20572
20626
|
}
|
|
20573
20627
|
};
|
|
20574
20628
|
}, []);
|
|
20575
|
-
|
|
20629
|
+
useEffect15(() => {
|
|
20576
20630
|
var _a;
|
|
20577
20631
|
if (!oneScrollPosition) {
|
|
20578
20632
|
scrollToBottom();
|
|
@@ -20581,12 +20635,12 @@ var useScroll = ({
|
|
|
20581
20635
|
(_a = oneChatFeedRef.current) == null ? void 0 : _a.scrollTo({ top: oneScrollPosition });
|
|
20582
20636
|
currentScrollPosition.current = oneScrollPosition;
|
|
20583
20637
|
}, []);
|
|
20584
|
-
|
|
20638
|
+
useEffect15(() => {
|
|
20585
20639
|
if (additionalEvents && isScrolledToBottom.current) {
|
|
20586
20640
|
scrollToBottom();
|
|
20587
20641
|
}
|
|
20588
20642
|
}, [scrollToBottom, additionalEvents]);
|
|
20589
|
-
|
|
20643
|
+
useEffect15(() => {
|
|
20590
20644
|
const [lastGroupEvent] = groupedEvents.slice(-1)[0];
|
|
20591
20645
|
const isLastMessageFromAgent = lastGroupEvent.authorType === "agent" /* Agent */;
|
|
20592
20646
|
if (isLastMessageFromAgent || isScrolledToBottom.current) {
|
|
@@ -21155,7 +21209,7 @@ function OneErrorEvent({ eventId }) {
|
|
|
21155
21209
|
}
|
|
21156
21210
|
|
|
21157
21211
|
// src/views/Workflows/Common/One/widget/events/OneImageEvent.tsx
|
|
21158
|
-
import { useEffect as
|
|
21212
|
+
import { useEffect as useEffect16, useState as useState23 } from "react";
|
|
21159
21213
|
|
|
21160
21214
|
// src/views/Workflows/Common/One/components/SkeletonLine.tsx
|
|
21161
21215
|
import { DesignToken as DesignToken26 } from "@livechat/design-system-react-components";
|
|
@@ -21219,7 +21273,7 @@ function SkeletonLine({
|
|
|
21219
21273
|
// src/views/Workflows/Common/One/widget/events/OneImageEvent.tsx
|
|
21220
21274
|
function OneImageEvent({ imageUrl }) {
|
|
21221
21275
|
const [isLoaded, setIsLoaded] = useState23(false);
|
|
21222
|
-
|
|
21276
|
+
useEffect16(() => {
|
|
21223
21277
|
const image = new Image();
|
|
21224
21278
|
image.src = imageUrl;
|
|
21225
21279
|
image.onload = () => {
|
|
@@ -21370,7 +21424,7 @@ var MarkdownEventRenderer = ({ children }) => /* @__PURE__ */ jsx4(
|
|
|
21370
21424
|
);
|
|
21371
21425
|
|
|
21372
21426
|
// src/views/Workflows/Common/One/components/NavigateButton.tsx
|
|
21373
|
-
import { useNavigate as
|
|
21427
|
+
import { useNavigate as useNavigate7 } from "react-router-dom";
|
|
21374
21428
|
import { Add as Add7, ArrowForward, OpenInNew } from "@livechat/design-system-icons";
|
|
21375
21429
|
import {
|
|
21376
21430
|
Button as Button19,
|
|
@@ -21392,7 +21446,7 @@ function NavigateButton({
|
|
|
21392
21446
|
kind,
|
|
21393
21447
|
iconPosition
|
|
21394
21448
|
}) {
|
|
21395
|
-
const navigate =
|
|
21449
|
+
const navigate = useNavigate7();
|
|
21396
21450
|
const handleButtonClick = () => {
|
|
21397
21451
|
if (isExternal) {
|
|
21398
21452
|
window.open(url, "_blank");
|
|
@@ -21824,7 +21878,7 @@ function OneChatFeedContent({
|
|
|
21824
21878
|
updateWorkflow,
|
|
21825
21879
|
previewWorkflow
|
|
21826
21880
|
}) {
|
|
21827
|
-
const oneChatFeedRef =
|
|
21881
|
+
const oneChatFeedRef = useRef8(null);
|
|
21828
21882
|
const { groupedEvents, hasAdditionalEvents } = useOneMessagesContext();
|
|
21829
21883
|
const { handleScroll } = useScroll({
|
|
21830
21884
|
oneChatFeedRef,
|
|
@@ -21919,15 +21973,15 @@ function CustomControls({
|
|
|
21919
21973
|
previewWorkflow
|
|
21920
21974
|
}) {
|
|
21921
21975
|
var _a;
|
|
21922
|
-
const navigate =
|
|
21976
|
+
const navigate = useNavigate8();
|
|
21923
21977
|
const { fitView, zoomIn, zoomOut } = useReactFlow2();
|
|
21924
21978
|
const { toggleOneWidget, isOpen } = useOneWidgetContext();
|
|
21925
21979
|
const {
|
|
21926
21980
|
state: { visibility },
|
|
21927
21981
|
focus
|
|
21928
21982
|
} = useWorkflowCreator();
|
|
21929
|
-
const location =
|
|
21930
|
-
|
|
21983
|
+
const location = useLocation5();
|
|
21984
|
+
useEffect17(() => {
|
|
21931
21985
|
var _a2;
|
|
21932
21986
|
if ((_a2 = location.state) == null ? void 0 : _a2.openOne) {
|
|
21933
21987
|
if (!isOpen) {
|
|
@@ -22033,7 +22087,7 @@ var CustomControls_default = CustomControls;
|
|
|
22033
22087
|
|
|
22034
22088
|
// src/views/Workflows/Creator/Builder/Controls/SwitcherControls.tsx
|
|
22035
22089
|
import { useState as useState26 } from "react";
|
|
22036
|
-
import { useNavigate as
|
|
22090
|
+
import { useNavigate as useNavigate9 } from "react-router-dom";
|
|
22037
22091
|
import { Controls as Controls2 } from "reactflow";
|
|
22038
22092
|
import { SegmentedControl } from "@livechat/design-system-react-components";
|
|
22039
22093
|
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
@@ -22045,7 +22099,7 @@ function SwitcherControls({
|
|
|
22045
22099
|
const [currentView, setCurrentView] = useState26(
|
|
22046
22100
|
isDraft ? "draft" : "published"
|
|
22047
22101
|
);
|
|
22048
|
-
const navigate =
|
|
22102
|
+
const navigate = useNavigate9();
|
|
22049
22103
|
const {
|
|
22050
22104
|
focus,
|
|
22051
22105
|
state: { visibility }
|
|
@@ -22574,13 +22628,13 @@ function WorkflowBuilder() {
|
|
|
22574
22628
|
[]
|
|
22575
22629
|
);
|
|
22576
22630
|
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
22577
|
-
const onConnect =
|
|
22631
|
+
const onConnect = useCallback15(
|
|
22578
22632
|
(params) => {
|
|
22579
22633
|
setEdges((eds) => addEdge(params, eds));
|
|
22580
22634
|
},
|
|
22581
22635
|
[setEdges]
|
|
22582
22636
|
);
|
|
22583
|
-
|
|
22637
|
+
useEffect18(() => {
|
|
22584
22638
|
void (() => __async(this, null, function* () {
|
|
22585
22639
|
const { nodes: nodes2, edges: edges2 } = yield convertWorkflowDefinitionToReactflow(
|
|
22586
22640
|
workflow
|
|
@@ -22712,8 +22766,8 @@ function PreviewWorkflowModal({
|
|
|
22712
22766
|
onApply,
|
|
22713
22767
|
onClose
|
|
22714
22768
|
}) {
|
|
22715
|
-
const navigate =
|
|
22716
|
-
const handleClose =
|
|
22769
|
+
const navigate = useNavigate10();
|
|
22770
|
+
const handleClose = useCallback16(
|
|
22717
22771
|
(target) => {
|
|
22718
22772
|
if (onClose) {
|
|
22719
22773
|
onClose();
|
|
@@ -22727,7 +22781,7 @@ function PreviewWorkflowModal({
|
|
|
22727
22781
|
},
|
|
22728
22782
|
[onClose, navigate]
|
|
22729
22783
|
);
|
|
22730
|
-
const handleApply =
|
|
22784
|
+
const handleApply = useCallback16(() => {
|
|
22731
22785
|
if (onApply) {
|
|
22732
22786
|
onApply();
|
|
22733
22787
|
}
|
|
@@ -22818,39 +22872,56 @@ function PublishWorkflowModal({
|
|
|
22818
22872
|
},
|
|
22819
22873
|
publishDraft
|
|
22820
22874
|
} = useWorkflowCreator();
|
|
22821
|
-
return /* @__PURE__ */ jsx15(
|
|
22822
|
-
|
|
22875
|
+
return /* @__PURE__ */ jsx15(
|
|
22876
|
+
Modal7,
|
|
22823
22877
|
{
|
|
22824
|
-
|
|
22825
|
-
|
|
22826
|
-
|
|
22827
|
-
|
|
22828
|
-
|
|
22829
|
-
kind: "primary",
|
|
22830
|
-
loading: isPublishing,
|
|
22831
|
-
onClick: () => void publishDraft({
|
|
22832
|
-
confirmed: true
|
|
22833
|
-
}),
|
|
22834
|
-
children: "Publish workflow"
|
|
22835
|
-
}
|
|
22836
|
-
)
|
|
22837
|
-
] }),
|
|
22838
|
-
heading: "You are publishing a workflow",
|
|
22839
|
-
icon: /* @__PURE__ */ jsx15(
|
|
22840
|
-
Icon26,
|
|
22878
|
+
heading: true,
|
|
22879
|
+
onClose,
|
|
22880
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.publish.wrapper,
|
|
22881
|
+
children: /* @__PURE__ */ jsx15(
|
|
22882
|
+
ActionModalContent3,
|
|
22841
22883
|
{
|
|
22842
|
-
|
|
22843
|
-
|
|
22844
|
-
|
|
22884
|
+
actions: /* @__PURE__ */ jsxs8(Fragment9, { children: [
|
|
22885
|
+
/* @__PURE__ */ jsx15(
|
|
22886
|
+
Button24,
|
|
22887
|
+
{
|
|
22888
|
+
kind: "secondary",
|
|
22889
|
+
onClick: onClose,
|
|
22890
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.publish.cancelButton,
|
|
22891
|
+
children: "Cancel"
|
|
22892
|
+
}
|
|
22893
|
+
),
|
|
22894
|
+
/* @__PURE__ */ jsx15(
|
|
22895
|
+
Button24,
|
|
22896
|
+
{
|
|
22897
|
+
kind: "primary",
|
|
22898
|
+
loading: isPublishing,
|
|
22899
|
+
onClick: () => void publishDraft({
|
|
22900
|
+
confirmed: true
|
|
22901
|
+
}),
|
|
22902
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.modals.publish.saveButton,
|
|
22903
|
+
children: "Publish workflow"
|
|
22904
|
+
}
|
|
22905
|
+
)
|
|
22906
|
+
] }),
|
|
22907
|
+
heading: "You are publishing a workflow",
|
|
22908
|
+
icon: /* @__PURE__ */ jsx15(
|
|
22909
|
+
Icon26,
|
|
22910
|
+
{
|
|
22911
|
+
customColor: `var(${DesignToken33.ContentBasicDisabled})`,
|
|
22912
|
+
size: "xxlarge",
|
|
22913
|
+
source: Error5
|
|
22914
|
+
}
|
|
22915
|
+
),
|
|
22916
|
+
children: "Once published, this will be the working version of your workflow and will\xA0be\xA0automatically set to active."
|
|
22845
22917
|
}
|
|
22846
|
-
)
|
|
22847
|
-
children: "Once published, this will be the working version of your workflow and will\xA0be\xA0automatically set to active."
|
|
22918
|
+
)
|
|
22848
22919
|
}
|
|
22849
|
-
)
|
|
22920
|
+
);
|
|
22850
22921
|
}
|
|
22851
22922
|
|
|
22852
22923
|
// src/views/Workflows/Creator/View.tsx
|
|
22853
|
-
import { useEffect as
|
|
22924
|
+
import { useEffect as useEffect20 } from "react";
|
|
22854
22925
|
import { Route as Route2, Routes as Routes2 } from "react-router-dom";
|
|
22855
22926
|
import { useReactFlow as useReactFlow3 } from "reactflow";
|
|
22856
22927
|
import {
|
|
@@ -22868,7 +22939,7 @@ var sendMessage = (type) => {
|
|
|
22868
22939
|
import { Navigate, Route, Routes } from "react-router-dom";
|
|
22869
22940
|
|
|
22870
22941
|
// src/views/Workflows/Creator/Panels/Details/Panel.tsx
|
|
22871
|
-
import { useNavigate as
|
|
22942
|
+
import { useNavigate as useNavigate11, useParams as useParams4 } from "react-router-dom";
|
|
22872
22943
|
import { Close as Close3 } from "@livechat/design-system-icons";
|
|
22873
22944
|
import {
|
|
22874
22945
|
Button as Button25,
|
|
@@ -22889,11 +22960,14 @@ import { Row as Row14 } from "@livechat/developer-studio-ui-react";
|
|
|
22889
22960
|
// src/views/Workflows/Creator/Panels/Details/Executions/List.tsx
|
|
22890
22961
|
import { CheckCircle as CheckCircle2, CloseCircle as CloseCircle2 } from "@livechat/design-system-icons";
|
|
22891
22962
|
import {
|
|
22892
|
-
Badge as Badge2,
|
|
22893
22963
|
DesignToken as DesignToken34,
|
|
22894
22964
|
Icon as Icon27,
|
|
22895
|
-
SpacingToken as SpacingToken29
|
|
22965
|
+
SpacingToken as SpacingToken29,
|
|
22966
|
+
Tag as Tag2
|
|
22896
22967
|
} from "@livechat/design-system-react-components";
|
|
22968
|
+
import {
|
|
22969
|
+
WorkflowExecutionStatus
|
|
22970
|
+
} from "@livechat/developer-studio-api";
|
|
22897
22971
|
import { formatUSADate, Row as Row12 } from "@livechat/developer-studio-ui-react";
|
|
22898
22972
|
var tableCss = css`
|
|
22899
22973
|
font-size: 13px;
|
|
@@ -22927,22 +23001,18 @@ function WorkflowExecutionList({
|
|
|
22927
23001
|
/* @__PURE__ */ jsx4("td", { children: formatUSADate(execution.started_at) }),
|
|
22928
23002
|
/* @__PURE__ */ jsx4("td", { children: formatUSADate(execution.ended_at) }),
|
|
22929
23003
|
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(
|
|
22930
|
-
|
|
23004
|
+
Tag2,
|
|
22931
23005
|
{
|
|
22932
|
-
|
|
22933
|
-
|
|
22934
|
-
|
|
22935
|
-
|
|
22936
|
-
|
|
22937
|
-
|
|
22938
|
-
|
|
22939
|
-
|
|
22940
|
-
|
|
22941
|
-
|
|
22942
|
-
}
|
|
22943
|
-
),
|
|
22944
|
-
execution.status
|
|
22945
|
-
] })
|
|
23006
|
+
size: "small",
|
|
23007
|
+
kind: execution.status === WorkflowExecutionStatus.Completed ? "success" : "error",
|
|
23008
|
+
leftNode: /* @__PURE__ */ jsx4(
|
|
23009
|
+
Icon27,
|
|
23010
|
+
{
|
|
23011
|
+
size: "small",
|
|
23012
|
+
source: execution.status === WorkflowExecutionStatus.Completed ? CheckCircle2 : CloseCircle2
|
|
23013
|
+
}
|
|
23014
|
+
),
|
|
23015
|
+
children: execution.status
|
|
22946
23016
|
}
|
|
22947
23017
|
) })
|
|
22948
23018
|
] }, execution.id)) : /* @__PURE__ */ jsx4("tr", { children: /* @__PURE__ */ jsx4("td", { align: "center", colSpan: 4, children: "No executions" }) }) })
|
|
@@ -23048,8 +23118,8 @@ function WorkflowDetailsPanel({
|
|
|
23048
23118
|
onClose
|
|
23049
23119
|
}) {
|
|
23050
23120
|
var _a, _b, _c, _d, _e;
|
|
23051
|
-
const navigate =
|
|
23052
|
-
const { id, tab } =
|
|
23121
|
+
const navigate = useNavigate11();
|
|
23122
|
+
const { id, tab } = useParams4();
|
|
23053
23123
|
const workflowQuery = useFetchWorkflow(id);
|
|
23054
23124
|
const workflowExecutionsQuery = useFetchWorkflowExecutionList(id);
|
|
23055
23125
|
const relatedWorkflowQuery = useFetchWorkflow(
|
|
@@ -23163,8 +23233,8 @@ function WorkflowDetails({
|
|
|
23163
23233
|
}
|
|
23164
23234
|
|
|
23165
23235
|
// src/views/Workflows/Creator/Panels/Editor/Panel.tsx
|
|
23166
|
-
import { useRef as
|
|
23167
|
-
import { useNavigate as
|
|
23236
|
+
import { useRef as useRef9, useState as useState27 } from "react";
|
|
23237
|
+
import { useNavigate as useNavigate12 } from "react-router-dom";
|
|
23168
23238
|
import { Editor } from "@monaco-editor/react";
|
|
23169
23239
|
import { Close as Close4 } from "@livechat/design-system-icons";
|
|
23170
23240
|
import {
|
|
@@ -23195,13 +23265,13 @@ function configureMonaco(monaco) {
|
|
|
23195
23265
|
});
|
|
23196
23266
|
}
|
|
23197
23267
|
function WorkflowEditorPanel({ onClose }) {
|
|
23198
|
-
const navigate =
|
|
23268
|
+
const navigate = useNavigate12();
|
|
23199
23269
|
const {
|
|
23200
23270
|
state: { workflow },
|
|
23201
23271
|
replaceWorkflow,
|
|
23202
23272
|
focus
|
|
23203
23273
|
} = useWorkflowCreator();
|
|
23204
|
-
const editorRef =
|
|
23274
|
+
const editorRef = useRef9();
|
|
23205
23275
|
const [, setIsModified] = useState27(false);
|
|
23206
23276
|
const [, setJsonErrors] = useState27([]);
|
|
23207
23277
|
const filteredWorkflow = {
|
|
@@ -23437,64 +23507,71 @@ function WorkflowElementPanel() {
|
|
|
23437
23507
|
}
|
|
23438
23508
|
};
|
|
23439
23509
|
const revertIconColor = getWorkflowsEnv("isHeadless") && ((config2 == null ? void 0 : config2.customization.provider) === IntegrationNames18.OpenAI || (config2 == null ? void 0 : config2.customization.provider) === IntegrationNames18.BigCommerce);
|
|
23440
|
-
return /* @__PURE__ */ jsxs2(
|
|
23441
|
-
|
|
23442
|
-
|
|
23443
|
-
|
|
23444
|
-
|
|
23445
|
-
|
|
23510
|
+
return /* @__PURE__ */ jsxs2(
|
|
23511
|
+
Wrapper4,
|
|
23512
|
+
{
|
|
23513
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.panels.element.wrapper,
|
|
23514
|
+
children: [
|
|
23515
|
+
" ",
|
|
23516
|
+
/* @__PURE__ */ jsxs2(Row16, { center: true, setRowPadding: "12px 24px", spaceBetween: true, children: [
|
|
23517
|
+
/* @__PURE__ */ jsx4(
|
|
23518
|
+
Header7,
|
|
23519
|
+
{
|
|
23520
|
+
css: css`
|
|
23446
23521
|
max-width: 85%;
|
|
23447
23522
|
`,
|
|
23448
|
-
|
|
23449
|
-
|
|
23450
|
-
|
|
23451
|
-
|
|
23452
|
-
|
|
23453
|
-
|
|
23454
|
-
|
|
23455
|
-
|
|
23456
|
-
|
|
23457
|
-
|
|
23458
|
-
|
|
23459
|
-
|
|
23460
|
-
|
|
23461
|
-
|
|
23462
|
-
|
|
23523
|
+
children: /* @__PURE__ */ jsxs2(Title7, { children: [
|
|
23524
|
+
(config2 == null ? void 0 : config2.customization.product) ? /* @__PURE__ */ jsx4(
|
|
23525
|
+
ProductIcon_default,
|
|
23526
|
+
{
|
|
23527
|
+
center: true,
|
|
23528
|
+
disabled: false,
|
|
23529
|
+
height: 10,
|
|
23530
|
+
product: config2.customization.provider,
|
|
23531
|
+
revertColors: revertIconColor,
|
|
23532
|
+
width: 10
|
|
23533
|
+
}
|
|
23534
|
+
) : /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(
|
|
23535
|
+
Icon30,
|
|
23536
|
+
{
|
|
23537
|
+
css: css`
|
|
23463
23538
|
width: var(${SpacingToken33.Spacing6});
|
|
23464
23539
|
`,
|
|
23465
|
-
|
|
23466
|
-
|
|
23467
|
-
|
|
23468
|
-
|
|
23469
|
-
|
|
23470
|
-
|
|
23471
|
-
|
|
23472
|
-
|
|
23473
|
-
|
|
23474
|
-
|
|
23475
|
-
|
|
23476
|
-
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23480
|
-
|
|
23481
|
-
|
|
23482
|
-
|
|
23483
|
-
|
|
23484
|
-
|
|
23485
|
-
|
|
23486
|
-
|
|
23487
|
-
|
|
23488
|
-
|
|
23489
|
-
|
|
23490
|
-
|
|
23491
|
-
|
|
23540
|
+
size: "xlarge",
|
|
23541
|
+
source: Automation2
|
|
23542
|
+
}
|
|
23543
|
+
) }),
|
|
23544
|
+
/* @__PURE__ */ jsxs2(Column13, { noFlexBasis: true, notPadded: true, children: [
|
|
23545
|
+
/* @__PURE__ */ jsxs2("strong", { children: [
|
|
23546
|
+
((_d = frame == null ? void 0 : frame.__meta) == null ? void 0 : _d.index) !== void 0 ? `${frame.__meta.index}. ` : "",
|
|
23547
|
+
(_e = config2 == null ? void 0 : config2.customization.displayName) != null ? _e : data.type === NodeNames.switch ? "Condition" : data.type === NodeNames.http ? "Custom HTTP" : data.type === NodeNames.terminate ? "End workflow" : ""
|
|
23548
|
+
] }),
|
|
23549
|
+
(_f = config2 == null ? void 0 : config2.customization.description) != null ? _f : data.type === NodeNames.switch ? "Conditional execution" : data.type === NodeNames.http ? "Make an HTTP request" : data.type === NodeNames.terminate ? "End the workflow" : ""
|
|
23550
|
+
] })
|
|
23551
|
+
] })
|
|
23552
|
+
}
|
|
23553
|
+
),
|
|
23554
|
+
/* @__PURE__ */ jsx4(
|
|
23555
|
+
Button27,
|
|
23556
|
+
{
|
|
23557
|
+
kind: "plain",
|
|
23558
|
+
onClick: () => {
|
|
23559
|
+
toggle();
|
|
23560
|
+
},
|
|
23561
|
+
children: /* @__PURE__ */ jsx4(Icon30, { source: Close5 })
|
|
23562
|
+
}
|
|
23563
|
+
)
|
|
23564
|
+
] }),
|
|
23565
|
+
/* @__PURE__ */ jsx4(Row16, { css: formCss, children: contentHandler() })
|
|
23566
|
+
]
|
|
23567
|
+
}
|
|
23568
|
+
);
|
|
23492
23569
|
}
|
|
23493
23570
|
var Panel_default3 = WorkflowElementPanel;
|
|
23494
23571
|
|
|
23495
23572
|
// src/views/Workflows/Creator/Navbar.tsx
|
|
23496
|
-
import { useEffect as
|
|
23497
|
-
import { useNavigate as
|
|
23573
|
+
import { useEffect as useEffect19, useRef as useRef10, useState as useState28 } from "react";
|
|
23574
|
+
import { useNavigate as useNavigate13 } from "react-router-dom";
|
|
23498
23575
|
import { ChevronDown as ChevronDown3, Close as Close6 } from "@livechat/design-system-icons";
|
|
23499
23576
|
import {
|
|
23500
23577
|
ActionMenu as ActionMenu2,
|
|
@@ -23515,7 +23592,7 @@ import {
|
|
|
23515
23592
|
} from "@livechat/developer-studio-ui-react";
|
|
23516
23593
|
function WorkflowCreatorNavbar() {
|
|
23517
23594
|
var _a, _b, _c, _d, _e;
|
|
23518
|
-
const navigate =
|
|
23595
|
+
const navigate = useNavigate13();
|
|
23519
23596
|
const {
|
|
23520
23597
|
state: {
|
|
23521
23598
|
workflow,
|
|
@@ -23528,14 +23605,14 @@ function WorkflowCreatorNavbar() {
|
|
|
23528
23605
|
publishDraft,
|
|
23529
23606
|
toggle
|
|
23530
23607
|
} = useWorkflowCreator();
|
|
23531
|
-
const inputRef =
|
|
23608
|
+
const inputRef = useRef10(null);
|
|
23532
23609
|
const [isNameChanging, setIsNameChanging] = useState28(false);
|
|
23533
23610
|
const [workflowName, setWorkflowName] = useState28(workflow.name);
|
|
23534
23611
|
const { user } = useUserContext8();
|
|
23535
23612
|
const amplitudeWorkflowsJourney = workflowsBlockAmplitudeJourneyFactory(
|
|
23536
23613
|
user == null ? void 0 : user.meta.email
|
|
23537
23614
|
);
|
|
23538
|
-
|
|
23615
|
+
useEffect19(() => {
|
|
23539
23616
|
setWorkflowName(workflow.name);
|
|
23540
23617
|
}, [workflow.name]);
|
|
23541
23618
|
useOnClickOutside2(inputRef, () => {
|
|
@@ -23710,7 +23787,8 @@ function WorkflowCreatorNavbar() {
|
|
|
23710
23787
|
on: workflow.active,
|
|
23711
23788
|
onChange: () => void activate(),
|
|
23712
23789
|
size: "medium",
|
|
23713
|
-
state: isActivating ? "loading" : workflow.draft ? "locked" : "regular"
|
|
23790
|
+
state: isActivating ? "loading" : workflow.draft ? "locked" : "regular",
|
|
23791
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.navbar.activateSwitch
|
|
23714
23792
|
}
|
|
23715
23793
|
),
|
|
23716
23794
|
children: workflow.draft ? "Publish the draft to activate this workflow" : workflow.active ? "Deactivate flow" : "Activate flow"
|
|
@@ -23729,7 +23807,15 @@ function WorkflowCreatorNavbar() {
|
|
|
23729
23807
|
workflow.draft ? !workflow.trigger.type || !workflow.definition.tasks.length ? /* @__PURE__ */ jsxs2(
|
|
23730
23808
|
Tooltip8,
|
|
23731
23809
|
{
|
|
23732
|
-
triggerRenderer: /* @__PURE__ */ jsx4(
|
|
23810
|
+
triggerRenderer: /* @__PURE__ */ jsx4(
|
|
23811
|
+
Button28,
|
|
23812
|
+
{
|
|
23813
|
+
disabled: true,
|
|
23814
|
+
kind: "primary",
|
|
23815
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.navbar.publishButton,
|
|
23816
|
+
children: "Publish"
|
|
23817
|
+
}
|
|
23818
|
+
),
|
|
23733
23819
|
children: [
|
|
23734
23820
|
!workflow.trigger.type && "To publish a workflow, add a trigger.",
|
|
23735
23821
|
!workflow.definition.tasks.length && "To publish a workflow, add at least one task."
|
|
@@ -23747,6 +23833,7 @@ function WorkflowCreatorNavbar() {
|
|
|
23747
23833
|
);
|
|
23748
23834
|
void publishDraft();
|
|
23749
23835
|
},
|
|
23836
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.navbar.publishButton,
|
|
23750
23837
|
children: "Publish"
|
|
23751
23838
|
}
|
|
23752
23839
|
) : /* @__PURE__ */ jsx4(
|
|
@@ -23762,6 +23849,7 @@ function WorkflowCreatorNavbar() {
|
|
|
23762
23849
|
}
|
|
23763
23850
|
void createDraft();
|
|
23764
23851
|
},
|
|
23852
|
+
"data-testid": WORKFLOWS_TEST_SELECTORS.views.workflows.creator.navbar.editButton,
|
|
23765
23853
|
children: "Edit"
|
|
23766
23854
|
}
|
|
23767
23855
|
)
|
|
@@ -23795,7 +23883,7 @@ function WorkflowCreatorView() {
|
|
|
23795
23883
|
focus
|
|
23796
23884
|
} = useWorkflowCreator();
|
|
23797
23885
|
const { fitView } = useReactFlow3();
|
|
23798
|
-
|
|
23886
|
+
useEffect20(() => {
|
|
23799
23887
|
if (getWorkflowsEnv("isLiveChatMode")) {
|
|
23800
23888
|
sendMessage("closeSideNav" /* CloseSideNav */);
|
|
23801
23889
|
const timeoutId = setTimeout(() => {
|
|
@@ -23839,9 +23927,9 @@ var View_default = WorkflowCreatorView;
|
|
|
23839
23927
|
// src/views/Workflows/Creator/index.tsx
|
|
23840
23928
|
function WorkflowCreator() {
|
|
23841
23929
|
var _a, _b, _c;
|
|
23842
|
-
const location =
|
|
23843
|
-
const { id } =
|
|
23844
|
-
const navigate =
|
|
23930
|
+
const location = useLocation6();
|
|
23931
|
+
const { id } = useParams5();
|
|
23932
|
+
const navigate = useNavigate14();
|
|
23845
23933
|
const workflowQuery = useFetchWorkflow(id === "new" ? void 0 : id);
|
|
23846
23934
|
const credentialsQuery = useFetchIntegrationCredentialsQuery2();
|
|
23847
23935
|
const organizationProducts = useFetchOrganizationProducts2();
|
|
@@ -23980,12 +24068,12 @@ import { Row as Row27 } from "@livechat/developer-studio-ui-react";
|
|
|
23980
24068
|
import { Route as Route4, Routes as Routes4 } from "react-router-dom";
|
|
23981
24069
|
|
|
23982
24070
|
// src/views/Workflows/List/Modals/PreviewTemplate/index.tsx
|
|
23983
|
-
import { useMemo as
|
|
23984
|
-
import { useParams as
|
|
24071
|
+
import { useMemo as useMemo9 } from "react";
|
|
24072
|
+
import { useParams as useParams6 } from "react-router-dom";
|
|
23985
24073
|
|
|
23986
24074
|
// src/views/Workflows/List/Modals/PreviewTemplate/Modal.tsx
|
|
23987
|
-
import { useCallback as
|
|
23988
|
-
import { useNavigate as
|
|
24075
|
+
import { useCallback as useCallback17 } from "react";
|
|
24076
|
+
import { useNavigate as useNavigate15 } from "react-router-dom";
|
|
23989
24077
|
import { ArrowBackFilled } from "@livechat/design-system-icons";
|
|
23990
24078
|
import {
|
|
23991
24079
|
Button as Button29,
|
|
@@ -23996,7 +24084,7 @@ import {
|
|
|
23996
24084
|
ModalHeader as ModalHeader5,
|
|
23997
24085
|
RadiusToken as RadiusToken19,
|
|
23998
24086
|
SpacingToken as SpacingToken37,
|
|
23999
|
-
Tag as
|
|
24087
|
+
Tag as Tag3,
|
|
24000
24088
|
Text as Text19
|
|
24001
24089
|
} from "@livechat/design-system-react-components";
|
|
24002
24090
|
import {
|
|
@@ -24092,7 +24180,7 @@ function WorkflowTemplatePreviewModal({
|
|
|
24092
24180
|
template,
|
|
24093
24181
|
onClose
|
|
24094
24182
|
}) {
|
|
24095
|
-
const navigate =
|
|
24183
|
+
const navigate = useNavigate15();
|
|
24096
24184
|
const {
|
|
24097
24185
|
save,
|
|
24098
24186
|
state: {
|
|
@@ -24103,7 +24191,7 @@ function WorkflowTemplatePreviewModal({
|
|
|
24103
24191
|
const amplitudeWorkflowsJourney = workflowsBlockAmplitudeJourneyFactory(
|
|
24104
24192
|
user == null ? void 0 : user.meta.email
|
|
24105
24193
|
);
|
|
24106
|
-
const handleClose =
|
|
24194
|
+
const handleClose = useCallback17(
|
|
24107
24195
|
(target) => {
|
|
24108
24196
|
if (onClose) {
|
|
24109
24197
|
onClose();
|
|
@@ -24122,7 +24210,7 @@ function WorkflowTemplatePreviewModal({
|
|
|
24122
24210
|
return products.map((product, i) => {
|
|
24123
24211
|
const icon2 = templateIcons[i];
|
|
24124
24212
|
return /* @__PURE__ */ jsx4(
|
|
24125
|
-
|
|
24213
|
+
Tag3,
|
|
24126
24214
|
{
|
|
24127
24215
|
leftNode: /* @__PURE__ */ jsx4(ProductIcon_default, { height: 4, product: icon2, width: 4 }),
|
|
24128
24216
|
size: "small",
|
|
@@ -24249,8 +24337,8 @@ function WorkflowTemplatePreview({
|
|
|
24249
24337
|
workflow,
|
|
24250
24338
|
onClose
|
|
24251
24339
|
}) {
|
|
24252
|
-
const flowTemplates =
|
|
24253
|
-
const params =
|
|
24340
|
+
const flowTemplates = useMemo9(() => getWorkflowTemplates(), []);
|
|
24341
|
+
const params = useParams6();
|
|
24254
24342
|
const template = flowTemplates.find((t) => t.id === params.template);
|
|
24255
24343
|
const targetWorkflow = workflow || (template == null ? void 0 : template.workflow);
|
|
24256
24344
|
if (!template) {
|
|
@@ -24281,12 +24369,12 @@ function WorkflowTemplatePreview({
|
|
|
24281
24369
|
var PreviewTemplate_default = WorkflowTemplatePreview;
|
|
24282
24370
|
|
|
24283
24371
|
// src/views/Workflows/List/Modals/Create/Modal.tsx
|
|
24284
|
-
import { useCallback as
|
|
24285
|
-
import { useNavigate as
|
|
24372
|
+
import { useCallback as useCallback20 } from "react";
|
|
24373
|
+
import { useNavigate as useNavigate18 } from "react-router-dom";
|
|
24286
24374
|
import { Modal as Modal9, ModalHeader as ModalHeader6 } from "@livechat/design-system-react-components";
|
|
24287
24375
|
|
|
24288
24376
|
// src/views/Workflows/List/Home/Home.tsx
|
|
24289
|
-
import { useMemo as
|
|
24377
|
+
import { useMemo as useMemo10, useState as useState31 } from "react";
|
|
24290
24378
|
import { FiletypeOther, OneColored } from "@livechat/design-system-icons";
|
|
24291
24379
|
import {
|
|
24292
24380
|
DesignToken as DesignToken43,
|
|
@@ -24296,7 +24384,7 @@ import {
|
|
|
24296
24384
|
import { Column as Column17, Intro as Intro3, Row as Row24 } from "@livechat/developer-studio-ui-react";
|
|
24297
24385
|
|
|
24298
24386
|
// src/views/Workflows/List/Modals/TemplateList/Filters/Category.tsx
|
|
24299
|
-
import { useCallback as
|
|
24387
|
+
import { useCallback as useCallback18, useState as useState29 } from "react";
|
|
24300
24388
|
import {
|
|
24301
24389
|
ChatDots as ChatDots2,
|
|
24302
24390
|
CurrencyDollar as CurrencyDollar2,
|
|
@@ -24319,7 +24407,7 @@ function WorkflowTemplatesCategoryFilter({
|
|
|
24319
24407
|
}) {
|
|
24320
24408
|
var _a;
|
|
24321
24409
|
const [isVisible, setIsVisible] = useState29(false);
|
|
24322
|
-
const getItem =
|
|
24410
|
+
const getItem = useCallback18(
|
|
24323
24411
|
(key, category, icon2) => ({
|
|
24324
24412
|
key,
|
|
24325
24413
|
element: /* @__PURE__ */ jsxs2(Row20, { gap: `var(${SpacingToken38.Spacing1});`, notPadded: true, children: [
|
|
@@ -24374,7 +24462,7 @@ function WorkflowTemplatesCategoryFilter({
|
|
|
24374
24462
|
var Category_default = WorkflowTemplatesCategoryFilter;
|
|
24375
24463
|
|
|
24376
24464
|
// src/views/Workflows/List/Modals/TemplateList/Filters/Product.tsx
|
|
24377
|
-
import { useCallback as
|
|
24465
|
+
import { useCallback as useCallback19, useState as useState30 } from "react";
|
|
24378
24466
|
import {
|
|
24379
24467
|
Chatgpt,
|
|
24380
24468
|
HelpDeskColored,
|
|
@@ -24397,7 +24485,7 @@ function WorkflowTemplatesProductFilter({
|
|
|
24397
24485
|
}) {
|
|
24398
24486
|
var _a;
|
|
24399
24487
|
const [isVisible, setIsVisible] = useState30(false);
|
|
24400
|
-
const getItem =
|
|
24488
|
+
const getItem = useCallback19(
|
|
24401
24489
|
(key, product, icon2) => ({
|
|
24402
24490
|
key,
|
|
24403
24491
|
element: /* @__PURE__ */ jsxs2(Row21, { gap: `var(${SpacingToken39.Spacing1});`, notPadded: true, children: [
|
|
@@ -24454,7 +24542,7 @@ function WorkflowTemplatesProductFilter({
|
|
|
24454
24542
|
var Product_default = WorkflowTemplatesProductFilter;
|
|
24455
24543
|
|
|
24456
24544
|
// src/views/Workflows/List/Home/Cards/Scratch.tsx
|
|
24457
|
-
import { useNavigate as
|
|
24545
|
+
import { useNavigate as useNavigate16 } from "react-router-dom";
|
|
24458
24546
|
import {
|
|
24459
24547
|
Heading as Heading6,
|
|
24460
24548
|
Icon as Icon36,
|
|
@@ -24471,7 +24559,7 @@ function WorkflowScratchCard({
|
|
|
24471
24559
|
icon: icon2,
|
|
24472
24560
|
openOne
|
|
24473
24561
|
}) {
|
|
24474
|
-
const navigate =
|
|
24562
|
+
const navigate = useNavigate16();
|
|
24475
24563
|
const { user } = useUserContext10();
|
|
24476
24564
|
const amplitudeWorkflowsJourney = workflowsBlockAmplitudeJourneyFactory(
|
|
24477
24565
|
user == null ? void 0 : user.meta.email
|
|
@@ -24503,7 +24591,7 @@ function WorkflowScratchCard({
|
|
|
24503
24591
|
var Scratch_default = WorkflowScratchCard;
|
|
24504
24592
|
|
|
24505
24593
|
// src/views/Workflows/List/Home/Cards/Template.tsx
|
|
24506
|
-
import { useNavigate as
|
|
24594
|
+
import { useNavigate as useNavigate17 } from "react-router-dom";
|
|
24507
24595
|
import {
|
|
24508
24596
|
DesignToken as DesignToken42,
|
|
24509
24597
|
Heading as Heading7,
|
|
@@ -24525,7 +24613,7 @@ function WorkflowTemplateCard({
|
|
|
24525
24613
|
icons,
|
|
24526
24614
|
category
|
|
24527
24615
|
}) {
|
|
24528
|
-
const navigate =
|
|
24616
|
+
const navigate = useNavigate17();
|
|
24529
24617
|
return /* @__PURE__ */ jsx4(
|
|
24530
24618
|
Card3,
|
|
24531
24619
|
{
|
|
@@ -24571,7 +24659,7 @@ var Grid = newStyled.div`
|
|
|
24571
24659
|
function WorkflowsHome({ isOnModal }) {
|
|
24572
24660
|
const [product, setProduct] = useState31("All");
|
|
24573
24661
|
const [category, setCategory] = useState31("All");
|
|
24574
|
-
const flowTemplates =
|
|
24662
|
+
const flowTemplates = useMemo10(() => getWorkflowTemplates(), []);
|
|
24575
24663
|
const filters = [
|
|
24576
24664
|
(template) => product === "All" || template.products.includes(product),
|
|
24577
24665
|
(template) => category === "All" || template.category.includes(category)
|
|
@@ -24673,8 +24761,8 @@ var Home_default = WorkflowsHome;
|
|
|
24673
24761
|
|
|
24674
24762
|
// src/views/Workflows/List/Modals/Create/Modal.tsx
|
|
24675
24763
|
function WorkflowCreateModal({ onClose }) {
|
|
24676
|
-
const navigate =
|
|
24677
|
-
const handleClose =
|
|
24764
|
+
const navigate = useNavigate18();
|
|
24765
|
+
const handleClose = useCallback20(() => {
|
|
24678
24766
|
if (onClose) {
|
|
24679
24767
|
onClose();
|
|
24680
24768
|
return;
|
|
@@ -24708,7 +24796,7 @@ var Create_default = WorkflowCreate;
|
|
|
24708
24796
|
|
|
24709
24797
|
// src/views/Workflows/List/View.tsx
|
|
24710
24798
|
import { useState as useState33 } from "react";
|
|
24711
|
-
import { useNavigate as
|
|
24799
|
+
import { useNavigate as useNavigate21 } from "react-router-dom";
|
|
24712
24800
|
import {
|
|
24713
24801
|
Button as Button35,
|
|
24714
24802
|
DesignToken as DesignToken46,
|
|
@@ -24724,8 +24812,8 @@ import {
|
|
|
24724
24812
|
} from "@livechat/developer-studio-ui-react";
|
|
24725
24813
|
|
|
24726
24814
|
// src/views/Workflows/Creator/LiveChatNavbar.tsx
|
|
24727
|
-
import { useCallback as
|
|
24728
|
-
import { useNavigate as
|
|
24815
|
+
import { useCallback as useCallback21 } from "react";
|
|
24816
|
+
import { useNavigate as useNavigate19 } from "react-router-dom";
|
|
24729
24817
|
import { LayoutSidebarLeft } from "@livechat/design-system-icons";
|
|
24730
24818
|
import {
|
|
24731
24819
|
Button as Button32,
|
|
@@ -24749,12 +24837,12 @@ var wrapperCss = (hasData) => css`
|
|
|
24749
24837
|
}`}
|
|
24750
24838
|
`;
|
|
24751
24839
|
function LiveChatNavbar() {
|
|
24752
|
-
const navigate =
|
|
24840
|
+
const navigate = useNavigate19();
|
|
24753
24841
|
const workflows = useFetchWorkflows({});
|
|
24754
24842
|
const isLoading = workflows.isLoading;
|
|
24755
24843
|
const hasNoData = workflows.isSuccess && workflows.data.length === 0;
|
|
24756
24844
|
const hasData = !isLoading && !hasNoData;
|
|
24757
|
-
const handleClick =
|
|
24845
|
+
const handleClick = useCallback21(() => {
|
|
24758
24846
|
sendMessage("toggleSideNav" /* ToggleSideNav */);
|
|
24759
24847
|
}, []);
|
|
24760
24848
|
return /* @__PURE__ */ jsxs2("div", { css: wrapperCss(hasData), children: [
|
|
@@ -24856,7 +24944,7 @@ function WorkflowStatusFilter({
|
|
|
24856
24944
|
var StatusFilter_default = WorkflowStatusFilter;
|
|
24857
24945
|
|
|
24858
24946
|
// src/views/Workflows/List/Grid/Table.tsx
|
|
24859
|
-
import { useNavigate as
|
|
24947
|
+
import { useNavigate as useNavigate20 } from "react-router-dom";
|
|
24860
24948
|
import {
|
|
24861
24949
|
Delete as Delete3,
|
|
24862
24950
|
Info as Info2,
|
|
@@ -24871,7 +24959,7 @@ import {
|
|
|
24871
24959
|
Icon as Icon39,
|
|
24872
24960
|
SpacingToken as SpacingToken44,
|
|
24873
24961
|
Switch as Switch2,
|
|
24874
|
-
Tag as
|
|
24962
|
+
Tag as Tag4,
|
|
24875
24963
|
Text as Text21,
|
|
24876
24964
|
Tooltip as Tooltip9
|
|
24877
24965
|
} from "@livechat/design-system-react-components";
|
|
@@ -24886,7 +24974,7 @@ import {
|
|
|
24886
24974
|
} from "@livechat/developer-studio-ui-react";
|
|
24887
24975
|
function WorkflowsTable({ workflowsQuery, state }) {
|
|
24888
24976
|
var _a, _b, _c;
|
|
24889
|
-
const navigate =
|
|
24977
|
+
const navigate = useNavigate20();
|
|
24890
24978
|
const notifications = useNotificationContext5();
|
|
24891
24979
|
const deleteAction = useDeleteWorkflow();
|
|
24892
24980
|
const activateWorkflowAction = useActivateWorkflow();
|
|
@@ -24934,7 +25022,7 @@ function WorkflowsTable({ workflowsQuery, state }) {
|
|
|
24934
25022
|
/* @__PURE__ */ jsx4("td", { width: "45%", children: /* @__PURE__ */ jsxs2(Row25, { gap: `var(${SpacingToken44.Spacing2})`, noWrap: true, notPadded: true, children: [
|
|
24935
25023
|
/* @__PURE__ */ jsx4(Text21, { noMargin: true, size: "sm", children: workflow.name }),
|
|
24936
25024
|
workflow.related_workflow_id ? /* @__PURE__ */ jsx4(
|
|
24937
|
-
|
|
25025
|
+
Tag4,
|
|
24938
25026
|
{
|
|
24939
25027
|
css: css`
|
|
24940
25028
|
color: #68afff;
|
|
@@ -25130,7 +25218,7 @@ var markedStyles = css`
|
|
|
25130
25218
|
`;
|
|
25131
25219
|
function WorkflowListView() {
|
|
25132
25220
|
var _a;
|
|
25133
|
-
const navigate =
|
|
25221
|
+
const navigate = useNavigate21();
|
|
25134
25222
|
const [state, setState] = useState33({
|
|
25135
25223
|
filters: {
|
|
25136
25224
|
status: "All",
|
|
@@ -25220,9 +25308,9 @@ var List_default2 = WorkflowList;
|
|
|
25220
25308
|
// src/views/Workflows/index.tsx
|
|
25221
25309
|
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
25222
25310
|
function Workflows() {
|
|
25223
|
-
const navigate =
|
|
25311
|
+
const navigate = useNavigate22();
|
|
25224
25312
|
const { userHasInstalledWorkflows, isWorkflowAppLoading } = useFetchUserInstalledWorkflows();
|
|
25225
|
-
|
|
25313
|
+
useEffect21(() => {
|
|
25226
25314
|
if (isWorkflowAppLoading) {
|
|
25227
25315
|
return;
|
|
25228
25316
|
}
|
|
@@ -25298,6 +25386,7 @@ function WorkflowsModule({ waitlistImage }) {
|
|
|
25298
25386
|
}
|
|
25299
25387
|
export {
|
|
25300
25388
|
LoginError_default as LoginError,
|
|
25389
|
+
WORKFLOWS_TEST_SELECTORS,
|
|
25301
25390
|
WorkflowsModule,
|
|
25302
25391
|
config,
|
|
25303
25392
|
getWorkflowsEnv,
|