@livechat/platform-workflows 0.0.76 → 0.0.77
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.js +87 -58
- package/dist/index.mjs +92 -62
- package/package.json +3 -4
package/dist/index.js
CHANGED
|
@@ -1896,7 +1896,7 @@ var useFetchUserInstalledWorkflows = () => {
|
|
|
1896
1896
|
};
|
|
1897
1897
|
};
|
|
1898
1898
|
var useFetchWorkflows = (params) => {
|
|
1899
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
1899
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
1900
1900
|
return (0, import_react_query2.useQuery)(
|
|
1901
1901
|
queryKeys.workflows.get(params),
|
|
1902
1902
|
() => __async(void 0, null, function* () {
|
|
@@ -1912,12 +1912,14 @@ var useFetchWorkflows = (params) => {
|
|
|
1912
1912
|
});
|
|
1913
1913
|
}),
|
|
1914
1914
|
{
|
|
1915
|
-
onError: (e) =>
|
|
1915
|
+
onError: (e) => {
|
|
1916
|
+
notifications.addErrorToast(e.message);
|
|
1917
|
+
}
|
|
1916
1918
|
}
|
|
1917
1919
|
);
|
|
1918
1920
|
};
|
|
1919
1921
|
var useFetchWorkflow = (workflowId) => {
|
|
1920
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
1922
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
1921
1923
|
return (0, import_react_query2.useQuery)(
|
|
1922
1924
|
queryKeys.workflow.get(workflowId),
|
|
1923
1925
|
() => __async(void 0, null, function* () {
|
|
@@ -1928,12 +1930,14 @@ var useFetchWorkflow = (workflowId) => {
|
|
|
1928
1930
|
}),
|
|
1929
1931
|
{
|
|
1930
1932
|
enabled: Boolean(workflowId),
|
|
1931
|
-
onError: (e) =>
|
|
1933
|
+
onError: (e) => {
|
|
1934
|
+
notifications.addErrorToast(e.message);
|
|
1935
|
+
}
|
|
1932
1936
|
}
|
|
1933
1937
|
);
|
|
1934
1938
|
};
|
|
1935
1939
|
var useFetchWorkflowExecutionList = (workflowId) => {
|
|
1936
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
1940
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
1937
1941
|
return (0, import_react_query2.useQuery)(
|
|
1938
1942
|
queryKeys.workflowExecutions.get(workflowId),
|
|
1939
1943
|
() => __async(void 0, null, function* () {
|
|
@@ -1944,13 +1948,15 @@ var useFetchWorkflowExecutionList = (workflowId) => {
|
|
|
1944
1948
|
}),
|
|
1945
1949
|
{
|
|
1946
1950
|
enabled: Boolean(workflowId),
|
|
1947
|
-
onError: (e) =>
|
|
1951
|
+
onError: (e) => {
|
|
1952
|
+
notifications.addErrorToast(e.message);
|
|
1953
|
+
}
|
|
1948
1954
|
}
|
|
1949
1955
|
);
|
|
1950
1956
|
};
|
|
1951
1957
|
var useCreateWorkflow = () => {
|
|
1952
1958
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
1953
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
1959
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
1954
1960
|
const { user } = (0, import_developer_studio_ui_react2.useUserContext)();
|
|
1955
1961
|
return (0, import_react_query2.useMutation)(
|
|
1956
1962
|
(payload) => __async(void 0, null, function* () {
|
|
@@ -1986,13 +1992,15 @@ var useCreateWorkflow = () => {
|
|
|
1986
1992
|
);
|
|
1987
1993
|
void queryClient.invalidateQueries([queryKeys.workflows.base]);
|
|
1988
1994
|
}),
|
|
1989
|
-
onError: (e) =>
|
|
1995
|
+
onError: (e) => {
|
|
1996
|
+
notifications.addErrorToast(e.message);
|
|
1997
|
+
}
|
|
1990
1998
|
}
|
|
1991
1999
|
);
|
|
1992
2000
|
};
|
|
1993
2001
|
var useCreateWorkflowDraft = () => {
|
|
1994
2002
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
1995
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2003
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
1996
2004
|
const { user } = (0, import_developer_studio_ui_react2.useUserContext)();
|
|
1997
2005
|
return (0, import_react_query2.useMutation)(
|
|
1998
2006
|
(payload) => __async(void 0, null, function* () {
|
|
@@ -2020,13 +2028,15 @@ var useCreateWorkflowDraft = () => {
|
|
|
2020
2028
|
);
|
|
2021
2029
|
void queryClient.invalidateQueries([queryKeys.workflows.base]);
|
|
2022
2030
|
}),
|
|
2023
|
-
onError: (e) =>
|
|
2031
|
+
onError: (e) => {
|
|
2032
|
+
notifications.addErrorToast(e.message);
|
|
2033
|
+
}
|
|
2024
2034
|
}
|
|
2025
2035
|
);
|
|
2026
2036
|
};
|
|
2027
2037
|
var useUpdateWorkflow = () => {
|
|
2028
2038
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
2029
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2039
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
2030
2040
|
return (0, import_react_query2.useMutation)(
|
|
2031
2041
|
(workflow) => __async(void 0, null, function* () {
|
|
2032
2042
|
const { data } = yield import_developer_studio_api2.api.integrations.text.platform.workflow.workflows.updateWorkflow(
|
|
@@ -2039,13 +2049,15 @@ var useUpdateWorkflow = () => {
|
|
|
2039
2049
|
onSuccess: () => {
|
|
2040
2050
|
void queryClient.invalidateQueries([queryKeys.workflows.base]);
|
|
2041
2051
|
},
|
|
2042
|
-
onError: (e) =>
|
|
2052
|
+
onError: (e) => {
|
|
2053
|
+
notifications.addErrorToast(e.message);
|
|
2054
|
+
}
|
|
2043
2055
|
}
|
|
2044
2056
|
);
|
|
2045
2057
|
};
|
|
2046
2058
|
var useDeleteWorkflow = () => {
|
|
2047
2059
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
2048
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2060
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
2049
2061
|
return (0, import_react_query2.useMutation)(
|
|
2050
2062
|
(workflow) => __async(void 0, null, function* () {
|
|
2051
2063
|
yield import_developer_studio_api2.api.integrations.text.platform.workflow.workflows.deleteWorkflow(
|
|
@@ -2065,13 +2077,15 @@ var useDeleteWorkflow = () => {
|
|
|
2065
2077
|
}
|
|
2066
2078
|
void queryClient.refetchQueries([queryKeys.workflows.base]);
|
|
2067
2079
|
},
|
|
2068
|
-
onError: (e) =>
|
|
2080
|
+
onError: (e) => {
|
|
2081
|
+
notifications.addErrorToast(e.message);
|
|
2082
|
+
}
|
|
2069
2083
|
}
|
|
2070
2084
|
);
|
|
2071
2085
|
};
|
|
2072
2086
|
var usePublishWorkflowDraft = () => {
|
|
2073
2087
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
2074
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2088
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
2075
2089
|
return (0, import_react_query2.useMutation)(
|
|
2076
2090
|
(workflow) => __async(void 0, null, function* () {
|
|
2077
2091
|
const { data } = yield import_developer_studio_api2.api.integrations.text.platform.workflow.workflows.publishWorkflowDraft(
|
|
@@ -2100,13 +2114,15 @@ var usePublishWorkflowDraft = () => {
|
|
|
2100
2114
|
}
|
|
2101
2115
|
void queryClient.refetchQueries([queryKeys.workflows.base]);
|
|
2102
2116
|
}),
|
|
2103
|
-
onError: (e) =>
|
|
2117
|
+
onError: (e) => {
|
|
2118
|
+
notifications.addErrorToast(e.message);
|
|
2119
|
+
}
|
|
2104
2120
|
}
|
|
2105
2121
|
);
|
|
2106
2122
|
};
|
|
2107
2123
|
var useActivateWorkflow = () => {
|
|
2108
2124
|
const queryClient = (0, import_react_query2.useQueryClient)();
|
|
2109
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2125
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
2110
2126
|
return (0, import_react_query2.useMutation)(
|
|
2111
2127
|
(_0) => __async(void 0, [_0], function* ({ id, active }) {
|
|
2112
2128
|
yield import_developer_studio_api2.api.integrations.text.platform.workflow.workflows.toggleWorkflowActivation(
|
|
@@ -2123,12 +2139,14 @@ var useActivateWorkflow = () => {
|
|
|
2123
2139
|
void queryClient.refetchQueries([queryKeys.workflows.base]);
|
|
2124
2140
|
void queryClient.refetchQueries(queryKeys.workflow.get(id));
|
|
2125
2141
|
},
|
|
2126
|
-
onError: (e) =>
|
|
2142
|
+
onError: (e) => {
|
|
2143
|
+
notifications.addErrorToast(e.message);
|
|
2144
|
+
}
|
|
2127
2145
|
}
|
|
2128
2146
|
);
|
|
2129
2147
|
};
|
|
2130
2148
|
var useExecuteWorkflow = () => {
|
|
2131
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2149
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
2132
2150
|
return (0, import_react_query2.useMutation)(
|
|
2133
2151
|
(_0) => __async(void 0, [_0], function* ({
|
|
2134
2152
|
workflow,
|
|
@@ -2140,12 +2158,14 @@ var useExecuteWorkflow = () => {
|
|
|
2140
2158
|
);
|
|
2141
2159
|
}),
|
|
2142
2160
|
{
|
|
2143
|
-
onError: (e) =>
|
|
2161
|
+
onError: (e) => {
|
|
2162
|
+
notifications.addErrorToast(e.message);
|
|
2163
|
+
}
|
|
2144
2164
|
}
|
|
2145
2165
|
);
|
|
2146
2166
|
};
|
|
2147
2167
|
var useGenerateAIResponse = () => {
|
|
2148
|
-
const notifications = (0, import_developer_studio_ui_react2.
|
|
2168
|
+
const notifications = (0, import_developer_studio_ui_react2.useNotificationContext)();
|
|
2149
2169
|
return (0, import_react_query2.useMutation)(
|
|
2150
2170
|
(payload) => __async(void 0, null, function* () {
|
|
2151
2171
|
const response = yield import_developer_studio_api2.api.integrations.text.ai.generateResponses(
|
|
@@ -2154,7 +2174,9 @@ var useGenerateAIResponse = () => {
|
|
|
2154
2174
|
return response;
|
|
2155
2175
|
}),
|
|
2156
2176
|
{
|
|
2157
|
-
onError: (e) =>
|
|
2177
|
+
onError: (e) => {
|
|
2178
|
+
notifications.addErrorToast(e.message);
|
|
2179
|
+
}
|
|
2158
2180
|
}
|
|
2159
2181
|
);
|
|
2160
2182
|
};
|
|
@@ -11362,12 +11384,12 @@ var jsonUtils = {
|
|
|
11362
11384
|
return prefix2 === "$" ? jsonUtils.HASH_TAG : jsonUtils.HASH_TAG2;
|
|
11363
11385
|
},
|
|
11364
11386
|
getMatchesInText(text2, options) {
|
|
11365
|
-
var _a
|
|
11387
|
+
var _a;
|
|
11366
11388
|
if (typeof text2 !== "string") {
|
|
11367
11389
|
return void 0;
|
|
11368
11390
|
}
|
|
11369
11391
|
const templates = jsonUtils.getRegex((_a = options == null ? void 0 : options.prefix) != null ? _a : "$").exec(text2);
|
|
11370
|
-
const results =
|
|
11392
|
+
const results = templates == null ? void 0 : templates.filter((match2) => jsonUtils.PATH.exec(jsonUtils.escapeTag(match2))).map(jsonUtils.escapeTag);
|
|
11371
11393
|
return results;
|
|
11372
11394
|
},
|
|
11373
11395
|
getMatchesInObject(input, prefix2 = "$") {
|
|
@@ -12498,14 +12520,14 @@ var validateTasks = (workflow, frames, products) => {
|
|
|
12498
12520
|
}).filter(Boolean);
|
|
12499
12521
|
const connectionErrors = resolvingErrors.filter((error) => error.params.subType === "credentials").map((error) => {
|
|
12500
12522
|
return {
|
|
12501
|
-
instancePath:
|
|
12523
|
+
instancePath: baseInstancePath,
|
|
12502
12524
|
keyword: "connection",
|
|
12503
12525
|
message: `Not connected to ${error.params.provider}`,
|
|
12504
12526
|
params: {}
|
|
12505
12527
|
};
|
|
12506
12528
|
});
|
|
12507
12529
|
const activationError = (config2 == null ? void 0 : config2.customization.provider.startsWith(import_developer_studio_api18.IntegrationNames.Text)) && !products.find(({ product }) => product === config2.customization.product) ? {
|
|
12508
|
-
instancePath:
|
|
12530
|
+
instancePath: baseInstancePath,
|
|
12509
12531
|
keyword: "activation",
|
|
12510
12532
|
message: `${config2.customization.product} not activated`,
|
|
12511
12533
|
params: {}
|
|
@@ -12927,7 +12949,7 @@ function WorkflowCreatorProviderBase({
|
|
|
12927
12949
|
var _a, _b;
|
|
12928
12950
|
const { fitView } = (0, import_reactflow.useReactFlow)();
|
|
12929
12951
|
const navigate = (0, import_react_router_dom2.useNavigate)();
|
|
12930
|
-
const notifications = (0, import_developer_studio_ui_react5.
|
|
12952
|
+
const notifications = (0, import_developer_studio_ui_react5.useNotificationContext)();
|
|
12931
12953
|
const createWorkflowAction = useCreateWorkflow();
|
|
12932
12954
|
const createWorkflowDraftAction = useCreateWorkflowDraft();
|
|
12933
12955
|
const updateWorkflowAction = useUpdateWorkflow();
|
|
@@ -13256,7 +13278,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13256
13278
|
state2.workflow
|
|
13257
13279
|
);
|
|
13258
13280
|
if (!silent) {
|
|
13259
|
-
notifications.
|
|
13281
|
+
notifications.addSuccessToast(
|
|
13282
|
+
"Workflow has been updated successfully"
|
|
13283
|
+
);
|
|
13260
13284
|
}
|
|
13261
13285
|
setWorkflow((prevState) => __spreadProps(__spreadValues({}, prevState), {
|
|
13262
13286
|
version: updateMutationResult.version
|
|
@@ -13266,7 +13290,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13266
13290
|
state2.workflow
|
|
13267
13291
|
);
|
|
13268
13292
|
if (!silent) {
|
|
13269
|
-
notifications.
|
|
13293
|
+
notifications.addSuccessToast(
|
|
13294
|
+
"Workflow has been created successfully"
|
|
13295
|
+
);
|
|
13270
13296
|
}
|
|
13271
13297
|
navigate(`/workflow/${workflowId}`);
|
|
13272
13298
|
}
|
|
@@ -13298,7 +13324,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13298
13324
|
setWorkflow((prevState) => __spreadProps(__spreadValues({}, prevState), {
|
|
13299
13325
|
active: !prevState.active
|
|
13300
13326
|
}));
|
|
13301
|
-
notifications.
|
|
13327
|
+
notifications.addSuccessToast(
|
|
13302
13328
|
`Workflow has been ${state2.workflow.active ? "deactivated" : "activated"}`
|
|
13303
13329
|
);
|
|
13304
13330
|
setAction("isActivating", false);
|
|
@@ -13316,7 +13342,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13316
13342
|
yield deleteWorkflowAction.mutateAsync(state2.workflow);
|
|
13317
13343
|
}
|
|
13318
13344
|
navigate("/workflow/list");
|
|
13319
|
-
notifications.
|
|
13345
|
+
notifications.addSuccessToast("Workflow has been removed successfully");
|
|
13320
13346
|
setAction("isRemoving", false);
|
|
13321
13347
|
}), [setAction, navigate, notifications, deleteWorkflowAction]);
|
|
13322
13348
|
const createDraft = (0, import_react10.useCallback)(
|
|
@@ -13341,7 +13367,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13341
13367
|
state2.workflow
|
|
13342
13368
|
);
|
|
13343
13369
|
navigate(`/workflow/${draftId}`);
|
|
13344
|
-
notifications.
|
|
13370
|
+
notifications.addSuccessToast(
|
|
13371
|
+
"Workflow draft has been created successfully"
|
|
13372
|
+
);
|
|
13345
13373
|
setAction("isCreating", false);
|
|
13346
13374
|
}),
|
|
13347
13375
|
[
|
|
@@ -13378,7 +13406,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13378
13406
|
}));
|
|
13379
13407
|
navigate(`/workflow/${id}`);
|
|
13380
13408
|
}
|
|
13381
|
-
notifications.
|
|
13409
|
+
notifications.addSuccessToast(
|
|
13382
13410
|
"Workflow draft has been published successfully"
|
|
13383
13411
|
);
|
|
13384
13412
|
setAction("isPublishing", false);
|
|
@@ -13411,7 +13439,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13411
13439
|
});
|
|
13412
13440
|
navigate(`/workflow/${state2.workflow.id}`);
|
|
13413
13441
|
}
|
|
13414
|
-
notifications.
|
|
13442
|
+
notifications.addSuccessToast(
|
|
13443
|
+
"Workflow draft has been discarded successfully"
|
|
13444
|
+
);
|
|
13415
13445
|
setAction("isDiscarding", false);
|
|
13416
13446
|
}), [deleteWorkflowAction, notifications, navigate, setAction]);
|
|
13417
13447
|
const [previewModalVisible, setPreviewModalVisible] = (0, import_react10.useState)({ isVisible: false });
|
|
@@ -13714,10 +13744,10 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
13714
13744
|
user == null ? void 0 : user.meta.email
|
|
13715
13745
|
);
|
|
13716
13746
|
(0, import_react12.useEffect)(() => {
|
|
13717
|
-
var _a2, _b, _c, _d, _e, _f, _g
|
|
13747
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
13718
13748
|
if (!params.task) {
|
|
13719
13749
|
const service = (_a2 = params.service) != null ? _a2 : "livechat";
|
|
13720
|
-
const firstTask = (
|
|
13750
|
+
const firstTask = (_c = (_b = config2.find((el) => el.name === service)) == null ? void 0 : _b.values.sort((a, b) => a.name.localeCompare(b.name))[0]) == null ? void 0 : _c.key;
|
|
13721
13751
|
navigate(`${basePath}/${service}/${firstTask}`, {
|
|
13722
13752
|
state: location.state
|
|
13723
13753
|
});
|
|
@@ -13726,13 +13756,13 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
13726
13756
|
const tasks = params.service ? templates.tasks[params.service] : void 0;
|
|
13727
13757
|
const task2 = params.task && tasks ? tasks[params.task] : void 0;
|
|
13728
13758
|
const suggestions = jsonUtils.stringifyToObjectKeyArray(
|
|
13729
|
-
(
|
|
13759
|
+
(_e = (_d = location.state) == null ? void 0 : _d.frame) != null ? _e : {},
|
|
13730
13760
|
{}
|
|
13731
13761
|
);
|
|
13732
13762
|
const matches = Object.fromEntries(
|
|
13733
|
-
(
|
|
13763
|
+
(_g = (_f = jsonUtils.getMatchesInText(jsonUtils.stringify(task2), {
|
|
13734
13764
|
prefix: "#"
|
|
13735
|
-
})) == null ? void 0 :
|
|
13765
|
+
})) == null ? void 0 : _f.map((match2) => {
|
|
13736
13766
|
const matchesWithAliases = match2.split("__");
|
|
13737
13767
|
const path = suggestions.find(
|
|
13738
13768
|
(x) => matchesWithAliases.some(
|
|
@@ -13743,7 +13773,7 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
13743
13773
|
return [match2, `\${${path}}`];
|
|
13744
13774
|
}
|
|
13745
13775
|
return [match2, null];
|
|
13746
|
-
})) != null ?
|
|
13776
|
+
})) != null ? _g : []
|
|
13747
13777
|
);
|
|
13748
13778
|
const newTask = task2 ? jsonUtils.resolveObjectByContext(task2, matches, {
|
|
13749
13779
|
prefix: "#"
|
|
@@ -14164,9 +14194,9 @@ function AddWorkflowTriggerModal({
|
|
|
14164
14194
|
user == null ? void 0 : user.meta.email
|
|
14165
14195
|
);
|
|
14166
14196
|
(0, import_react15.useEffect)(() => {
|
|
14167
|
-
var _a, _b
|
|
14197
|
+
var _a, _b;
|
|
14168
14198
|
if (!params.trigger) {
|
|
14169
|
-
const firstTrigger = (
|
|
14199
|
+
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;
|
|
14170
14200
|
navigate(`${basePath}/${params.service}/${firstTrigger}`);
|
|
14171
14201
|
}
|
|
14172
14202
|
const templates = WorkflowSpecification.templates;
|
|
@@ -14178,7 +14208,7 @@ function AddWorkflowTriggerModal({
|
|
|
14178
14208
|
if (trigger) {
|
|
14179
14209
|
amplitudeWorkflowsJourney.draft.edit.actions.addTrigger(
|
|
14180
14210
|
trigger.type,
|
|
14181
|
-
trigger.type === "webhook" ?
|
|
14211
|
+
trigger.type === "webhook" ? trigger.webhook.source : void 0
|
|
14182
14212
|
);
|
|
14183
14213
|
addTrigger(trigger);
|
|
14184
14214
|
}
|
|
@@ -15272,8 +15302,8 @@ function convertToTreeNode(obj, meta, nodeName, path) {
|
|
|
15272
15302
|
name: (_e = (_d = customization == null ? void 0 : customization.displayName) != null ? _d : currentSpec == null ? void 0 : currentSpec.title) != null ? _e : nodeName,
|
|
15273
15303
|
description: (_f = customization == null ? void 0 : customization.description) != null ? _f : currentSpec == null ? void 0 : currentSpec.description,
|
|
15274
15304
|
icon: customization == null ? void 0 : customization.provider,
|
|
15275
|
-
value: `${meta.basePath ?
|
|
15276
|
-
path:
|
|
15305
|
+
value: `${meta.basePath ? meta.basePath : ""}${path ? `.${path}` : ""}`,
|
|
15306
|
+
path: path != null ? path : "",
|
|
15277
15307
|
relativePath: meta.baseRelativePath && path && path.startsWith(meta.baseRelativePath) ? path.replace(`${meta.baseRelativePath}.`, "") : "",
|
|
15278
15308
|
children: [],
|
|
15279
15309
|
canAddChildren: (_g = config2 == null ? void 0 : config2.specification) == null ? void 0 : _g.additionalProperties,
|
|
@@ -15298,7 +15328,7 @@ function convertToTreeNode(obj, meta, nodeName, path) {
|
|
|
15298
15328
|
index: index != null ? index : meta.index
|
|
15299
15329
|
},
|
|
15300
15330
|
key,
|
|
15301
|
-
meta.dummy ?
|
|
15331
|
+
meta.dummy ? key : `${path ? `${path}.` : ""}${key}`
|
|
15302
15332
|
)
|
|
15303
15333
|
).filter(Boolean);
|
|
15304
15334
|
} else if (Array.isArray(obj)) {
|
|
@@ -17278,7 +17308,7 @@ var import_developer_studio_ui_react19 = require("@livechat/developer-studio-ui-
|
|
|
17278
17308
|
var import_platform_integrations3 = require("@livechat/platform-integrations");
|
|
17279
17309
|
function GlobalAccounts(props) {
|
|
17280
17310
|
const { pathname } = (0, import_react_router_dom6.useLocation)();
|
|
17281
|
-
const notifications = (0, import_developer_studio_ui_react19.
|
|
17311
|
+
const notifications = (0, import_developer_studio_ui_react19.useNotificationContext)();
|
|
17282
17312
|
const { user } = (0, import_developer_studio_ui_react19.useUserContext)();
|
|
17283
17313
|
const organizationProductsQuery = useFetchOrganizationProducts();
|
|
17284
17314
|
const {
|
|
@@ -17328,7 +17358,7 @@ function GlobalAccounts(props) {
|
|
|
17328
17358
|
onSuccess: refetch
|
|
17329
17359
|
},
|
|
17330
17360
|
{
|
|
17331
|
-
notifications
|
|
17361
|
+
notifications,
|
|
17332
17362
|
user
|
|
17333
17363
|
}
|
|
17334
17364
|
);
|
|
@@ -19723,13 +19753,13 @@ function ApplyWorkflowButton({
|
|
|
19723
19753
|
var import_developer_studio_ui_react22 = require("@livechat/developer-studio-ui-react");
|
|
19724
19754
|
var useMessageBottomBar = (event) => {
|
|
19725
19755
|
const { text: text2, sessionId } = event;
|
|
19726
|
-
const notifications = (0, import_developer_studio_ui_react22.
|
|
19756
|
+
const notifications = (0, import_developer_studio_ui_react22.useNotificationContext)();
|
|
19727
19757
|
const handleCopyClick = () => __async(void 0, null, function* () {
|
|
19728
19758
|
const isCopied = yield (0, import_developer_studio_ui_react22.copyTextToClipboard)(text2);
|
|
19729
19759
|
if (isCopied) {
|
|
19730
|
-
notifications.
|
|
19760
|
+
notifications.addSuccessToast("Message copied successfully");
|
|
19731
19761
|
} else {
|
|
19732
|
-
notifications.
|
|
19762
|
+
notifications.addErrorToast("Could not copy message");
|
|
19733
19763
|
}
|
|
19734
19764
|
});
|
|
19735
19765
|
const handleRateMessageClick = () => {
|
|
@@ -19760,7 +19790,7 @@ function OneAssistantMessageBottomBar({
|
|
|
19760
19790
|
const numberOfSources = (eventSources == null ? void 0 : eventSources.length) || 0;
|
|
19761
19791
|
const { topSources } = getSources(eventSources);
|
|
19762
19792
|
const { handleCopyClick, handleRateMessageClick } = useMessageBottomBar(event);
|
|
19763
|
-
const sourcesText =
|
|
19793
|
+
const sourcesText = (0, import_developer_studio_ui_react23.plural)(numberOfSources, "Source", "Sources");
|
|
19764
19794
|
return /* @__PURE__ */ jsxs2("div", { css: bottomBarContainer, children: [
|
|
19765
19795
|
/* @__PURE__ */ jsxs2("div", { css: bottomBar2, children: [
|
|
19766
19796
|
/* @__PURE__ */ jsxs2("div", { children: [
|
|
@@ -21076,7 +21106,6 @@ var import_design_system_react_components65 = require("@livechat/design-system-r
|
|
|
21076
21106
|
var import_developer_studio_ui_react30 = require("@livechat/developer-studio-ui-react");
|
|
21077
21107
|
|
|
21078
21108
|
// src/views/Workflows/Creator/Panels/Details/Executions/List.tsx
|
|
21079
|
-
var import_design_system = require("@livechat/design-system");
|
|
21080
21109
|
var import_design_system_icons28 = require("@livechat/design-system-icons");
|
|
21081
21110
|
var import_design_system_react_components63 = require("@livechat/design-system-react-components");
|
|
21082
21111
|
var import_developer_studio_ui_react28 = require("@livechat/developer-studio-ui-react");
|
|
@@ -21112,7 +21141,7 @@ function WorkflowExecutionList({
|
|
|
21112
21141
|
/* @__PURE__ */ jsx4("td", { children: (0, import_developer_studio_ui_react28.formatUSADate)(execution.started_at) }),
|
|
21113
21142
|
/* @__PURE__ */ jsx4("td", { children: (0, import_developer_studio_ui_react28.formatUSADate)(execution.ended_at) }),
|
|
21114
21143
|
/* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(
|
|
21115
|
-
|
|
21144
|
+
import_design_system_react_components63.Badge,
|
|
21116
21145
|
{
|
|
21117
21146
|
css: css`
|
|
21118
21147
|
display: flex;
|
|
@@ -22338,7 +22367,7 @@ function WorkflowTemplatePreviewModal({
|
|
|
22338
22367
|
" "
|
|
22339
22368
|
] }),
|
|
22340
22369
|
/* @__PURE__ */ jsx4(import_design_system_react_components71.Text, { as: "span", noMargin: true, size: "md", children: item.description })
|
|
22341
|
-
] },
|
|
22370
|
+
] }, item.product)) })
|
|
22342
22371
|
]
|
|
22343
22372
|
}
|
|
22344
22373
|
),
|
|
@@ -22626,7 +22655,7 @@ function WorkflowTemplateCard({
|
|
|
22626
22655
|
/* @__PURE__ */ jsx4(TemplateCategoryIcon_default, { category }),
|
|
22627
22656
|
/* @__PURE__ */ jsx4(import_design_system_react_components75.Heading, { as: "div", size: "xs", children: name })
|
|
22628
22657
|
] }),
|
|
22629
|
-
/* @__PURE__ */ jsx4(import_developer_studio_ui_react40.Row, { gap: `var(${import_design_system_react_components75.SpacingToken.Spacing1})`, noWrap: true, notPadded: true, children: icons.map((icon2, i) => /* @__PURE__ */ jsx4(IconWrapper2, { children: /* @__PURE__ */ jsx4(ProductIcon_default, { height: 5, product: icon2, width: 5 }) },
|
|
22658
|
+
/* @__PURE__ */ jsx4(import_developer_studio_ui_react40.Row, { gap: `var(${import_design_system_react_components75.SpacingToken.Spacing1})`, noWrap: true, notPadded: true, children: icons.map((icon2, i) => /* @__PURE__ */ jsx4(IconWrapper2, { children: /* @__PURE__ */ jsx4(ProductIcon_default, { height: 5, product: icon2, width: 5 }) }, i.toString())) })
|
|
22630
22659
|
]
|
|
22631
22660
|
}
|
|
22632
22661
|
)
|
|
@@ -22863,7 +22892,7 @@ var import_developer_studio_ui_react42 = require("@livechat/developer-studio-ui-
|
|
|
22863
22892
|
function WorkflowsTable({ workflowsQuery, state }) {
|
|
22864
22893
|
var _a, _b, _c;
|
|
22865
22894
|
const navigate = (0, import_react_router_dom24.useNavigate)();
|
|
22866
|
-
const notifications = (0, import_developer_studio_ui_react42.
|
|
22895
|
+
const notifications = (0, import_developer_studio_ui_react42.useNotificationContext)();
|
|
22867
22896
|
const deleteAction = useDeleteWorkflow();
|
|
22868
22897
|
const activateWorkflowAction = useActivateWorkflow();
|
|
22869
22898
|
const { user } = (0, import_developer_studio_ui_react42.useUserContext)();
|
|
@@ -23003,7 +23032,7 @@ function WorkflowsTable({ workflowsQuery, state }) {
|
|
|
23003
23032
|
"list"
|
|
23004
23033
|
);
|
|
23005
23034
|
yield deleteAction.mutateAsync(workflow);
|
|
23006
|
-
notifications.
|
|
23035
|
+
notifications.addSuccessToast(
|
|
23007
23036
|
"Workflow has been deleted successfully"
|
|
23008
23037
|
);
|
|
23009
23038
|
}))()
|
package/dist/index.mjs
CHANGED
|
@@ -1831,7 +1831,7 @@ import {
|
|
|
1831
1831
|
import { useMutation, useQuery as useQuery2, useQueryClient } from "@tanstack/react-query";
|
|
1832
1832
|
import { api as api2, IntegrationNames } from "@livechat/developer-studio-api";
|
|
1833
1833
|
import {
|
|
1834
|
-
|
|
1834
|
+
useNotificationContext,
|
|
1835
1835
|
useUserContext
|
|
1836
1836
|
} from "@livechat/developer-studio-ui-react";
|
|
1837
1837
|
import { integrationCredentialsQueryKeys } from "@livechat/platform-integrations";
|
|
@@ -1894,7 +1894,7 @@ var useFetchUserInstalledWorkflows = () => {
|
|
|
1894
1894
|
};
|
|
1895
1895
|
};
|
|
1896
1896
|
var useFetchWorkflows = (params) => {
|
|
1897
|
-
const notifications =
|
|
1897
|
+
const notifications = useNotificationContext();
|
|
1898
1898
|
return useQuery2(
|
|
1899
1899
|
queryKeys.workflows.get(params),
|
|
1900
1900
|
() => __async(void 0, null, function* () {
|
|
@@ -1910,12 +1910,14 @@ var useFetchWorkflows = (params) => {
|
|
|
1910
1910
|
});
|
|
1911
1911
|
}),
|
|
1912
1912
|
{
|
|
1913
|
-
onError: (e) =>
|
|
1913
|
+
onError: (e) => {
|
|
1914
|
+
notifications.addErrorToast(e.message);
|
|
1915
|
+
}
|
|
1914
1916
|
}
|
|
1915
1917
|
);
|
|
1916
1918
|
};
|
|
1917
1919
|
var useFetchWorkflow = (workflowId) => {
|
|
1918
|
-
const notifications =
|
|
1920
|
+
const notifications = useNotificationContext();
|
|
1919
1921
|
return useQuery2(
|
|
1920
1922
|
queryKeys.workflow.get(workflowId),
|
|
1921
1923
|
() => __async(void 0, null, function* () {
|
|
@@ -1926,12 +1928,14 @@ var useFetchWorkflow = (workflowId) => {
|
|
|
1926
1928
|
}),
|
|
1927
1929
|
{
|
|
1928
1930
|
enabled: Boolean(workflowId),
|
|
1929
|
-
onError: (e) =>
|
|
1931
|
+
onError: (e) => {
|
|
1932
|
+
notifications.addErrorToast(e.message);
|
|
1933
|
+
}
|
|
1930
1934
|
}
|
|
1931
1935
|
);
|
|
1932
1936
|
};
|
|
1933
1937
|
var useFetchWorkflowExecutionList = (workflowId) => {
|
|
1934
|
-
const notifications =
|
|
1938
|
+
const notifications = useNotificationContext();
|
|
1935
1939
|
return useQuery2(
|
|
1936
1940
|
queryKeys.workflowExecutions.get(workflowId),
|
|
1937
1941
|
() => __async(void 0, null, function* () {
|
|
@@ -1942,13 +1946,15 @@ var useFetchWorkflowExecutionList = (workflowId) => {
|
|
|
1942
1946
|
}),
|
|
1943
1947
|
{
|
|
1944
1948
|
enabled: Boolean(workflowId),
|
|
1945
|
-
onError: (e) =>
|
|
1949
|
+
onError: (e) => {
|
|
1950
|
+
notifications.addErrorToast(e.message);
|
|
1951
|
+
}
|
|
1946
1952
|
}
|
|
1947
1953
|
);
|
|
1948
1954
|
};
|
|
1949
1955
|
var useCreateWorkflow = () => {
|
|
1950
1956
|
const queryClient = useQueryClient();
|
|
1951
|
-
const notifications =
|
|
1957
|
+
const notifications = useNotificationContext();
|
|
1952
1958
|
const { user } = useUserContext();
|
|
1953
1959
|
return useMutation(
|
|
1954
1960
|
(payload) => __async(void 0, null, function* () {
|
|
@@ -1984,13 +1990,15 @@ var useCreateWorkflow = () => {
|
|
|
1984
1990
|
);
|
|
1985
1991
|
void queryClient.invalidateQueries([queryKeys.workflows.base]);
|
|
1986
1992
|
}),
|
|
1987
|
-
onError: (e) =>
|
|
1993
|
+
onError: (e) => {
|
|
1994
|
+
notifications.addErrorToast(e.message);
|
|
1995
|
+
}
|
|
1988
1996
|
}
|
|
1989
1997
|
);
|
|
1990
1998
|
};
|
|
1991
1999
|
var useCreateWorkflowDraft = () => {
|
|
1992
2000
|
const queryClient = useQueryClient();
|
|
1993
|
-
const notifications =
|
|
2001
|
+
const notifications = useNotificationContext();
|
|
1994
2002
|
const { user } = useUserContext();
|
|
1995
2003
|
return useMutation(
|
|
1996
2004
|
(payload) => __async(void 0, null, function* () {
|
|
@@ -2018,13 +2026,15 @@ var useCreateWorkflowDraft = () => {
|
|
|
2018
2026
|
);
|
|
2019
2027
|
void queryClient.invalidateQueries([queryKeys.workflows.base]);
|
|
2020
2028
|
}),
|
|
2021
|
-
onError: (e) =>
|
|
2029
|
+
onError: (e) => {
|
|
2030
|
+
notifications.addErrorToast(e.message);
|
|
2031
|
+
}
|
|
2022
2032
|
}
|
|
2023
2033
|
);
|
|
2024
2034
|
};
|
|
2025
2035
|
var useUpdateWorkflow = () => {
|
|
2026
2036
|
const queryClient = useQueryClient();
|
|
2027
|
-
const notifications =
|
|
2037
|
+
const notifications = useNotificationContext();
|
|
2028
2038
|
return useMutation(
|
|
2029
2039
|
(workflow) => __async(void 0, null, function* () {
|
|
2030
2040
|
const { data } = yield api2.integrations.text.platform.workflow.workflows.updateWorkflow(
|
|
@@ -2037,13 +2047,15 @@ var useUpdateWorkflow = () => {
|
|
|
2037
2047
|
onSuccess: () => {
|
|
2038
2048
|
void queryClient.invalidateQueries([queryKeys.workflows.base]);
|
|
2039
2049
|
},
|
|
2040
|
-
onError: (e) =>
|
|
2050
|
+
onError: (e) => {
|
|
2051
|
+
notifications.addErrorToast(e.message);
|
|
2052
|
+
}
|
|
2041
2053
|
}
|
|
2042
2054
|
);
|
|
2043
2055
|
};
|
|
2044
2056
|
var useDeleteWorkflow = () => {
|
|
2045
2057
|
const queryClient = useQueryClient();
|
|
2046
|
-
const notifications =
|
|
2058
|
+
const notifications = useNotificationContext();
|
|
2047
2059
|
return useMutation(
|
|
2048
2060
|
(workflow) => __async(void 0, null, function* () {
|
|
2049
2061
|
yield api2.integrations.text.platform.workflow.workflows.deleteWorkflow(
|
|
@@ -2063,13 +2075,15 @@ var useDeleteWorkflow = () => {
|
|
|
2063
2075
|
}
|
|
2064
2076
|
void queryClient.refetchQueries([queryKeys.workflows.base]);
|
|
2065
2077
|
},
|
|
2066
|
-
onError: (e) =>
|
|
2078
|
+
onError: (e) => {
|
|
2079
|
+
notifications.addErrorToast(e.message);
|
|
2080
|
+
}
|
|
2067
2081
|
}
|
|
2068
2082
|
);
|
|
2069
2083
|
};
|
|
2070
2084
|
var usePublishWorkflowDraft = () => {
|
|
2071
2085
|
const queryClient = useQueryClient();
|
|
2072
|
-
const notifications =
|
|
2086
|
+
const notifications = useNotificationContext();
|
|
2073
2087
|
return useMutation(
|
|
2074
2088
|
(workflow) => __async(void 0, null, function* () {
|
|
2075
2089
|
const { data } = yield api2.integrations.text.platform.workflow.workflows.publishWorkflowDraft(
|
|
@@ -2098,13 +2112,15 @@ var usePublishWorkflowDraft = () => {
|
|
|
2098
2112
|
}
|
|
2099
2113
|
void queryClient.refetchQueries([queryKeys.workflows.base]);
|
|
2100
2114
|
}),
|
|
2101
|
-
onError: (e) =>
|
|
2115
|
+
onError: (e) => {
|
|
2116
|
+
notifications.addErrorToast(e.message);
|
|
2117
|
+
}
|
|
2102
2118
|
}
|
|
2103
2119
|
);
|
|
2104
2120
|
};
|
|
2105
2121
|
var useActivateWorkflow = () => {
|
|
2106
2122
|
const queryClient = useQueryClient();
|
|
2107
|
-
const notifications =
|
|
2123
|
+
const notifications = useNotificationContext();
|
|
2108
2124
|
return useMutation(
|
|
2109
2125
|
(_0) => __async(void 0, [_0], function* ({ id, active }) {
|
|
2110
2126
|
yield api2.integrations.text.platform.workflow.workflows.toggleWorkflowActivation(
|
|
@@ -2121,12 +2137,14 @@ var useActivateWorkflow = () => {
|
|
|
2121
2137
|
void queryClient.refetchQueries([queryKeys.workflows.base]);
|
|
2122
2138
|
void queryClient.refetchQueries(queryKeys.workflow.get(id));
|
|
2123
2139
|
},
|
|
2124
|
-
onError: (e) =>
|
|
2140
|
+
onError: (e) => {
|
|
2141
|
+
notifications.addErrorToast(e.message);
|
|
2142
|
+
}
|
|
2125
2143
|
}
|
|
2126
2144
|
);
|
|
2127
2145
|
};
|
|
2128
2146
|
var useExecuteWorkflow = () => {
|
|
2129
|
-
const notifications =
|
|
2147
|
+
const notifications = useNotificationContext();
|
|
2130
2148
|
return useMutation(
|
|
2131
2149
|
(_0) => __async(void 0, [_0], function* ({
|
|
2132
2150
|
workflow,
|
|
@@ -2138,12 +2156,14 @@ var useExecuteWorkflow = () => {
|
|
|
2138
2156
|
);
|
|
2139
2157
|
}),
|
|
2140
2158
|
{
|
|
2141
|
-
onError: (e) =>
|
|
2159
|
+
onError: (e) => {
|
|
2160
|
+
notifications.addErrorToast(e.message);
|
|
2161
|
+
}
|
|
2142
2162
|
}
|
|
2143
2163
|
);
|
|
2144
2164
|
};
|
|
2145
2165
|
var useGenerateAIResponse = () => {
|
|
2146
|
-
const notifications =
|
|
2166
|
+
const notifications = useNotificationContext();
|
|
2147
2167
|
return useMutation(
|
|
2148
2168
|
(payload) => __async(void 0, null, function* () {
|
|
2149
2169
|
const response = yield api2.integrations.text.ai.generateResponses(
|
|
@@ -2152,7 +2172,9 @@ var useGenerateAIResponse = () => {
|
|
|
2152
2172
|
return response;
|
|
2153
2173
|
}),
|
|
2154
2174
|
{
|
|
2155
|
-
onError: (e) =>
|
|
2175
|
+
onError: (e) => {
|
|
2176
|
+
notifications.addErrorToast(e.message);
|
|
2177
|
+
}
|
|
2156
2178
|
}
|
|
2157
2179
|
);
|
|
2158
2180
|
};
|
|
@@ -11422,12 +11444,12 @@ var jsonUtils = {
|
|
|
11422
11444
|
return prefix2 === "$" ? jsonUtils.HASH_TAG : jsonUtils.HASH_TAG2;
|
|
11423
11445
|
},
|
|
11424
11446
|
getMatchesInText(text2, options) {
|
|
11425
|
-
var _a
|
|
11447
|
+
var _a;
|
|
11426
11448
|
if (typeof text2 !== "string") {
|
|
11427
11449
|
return void 0;
|
|
11428
11450
|
}
|
|
11429
11451
|
const templates = jsonUtils.getRegex((_a = options == null ? void 0 : options.prefix) != null ? _a : "$").exec(text2);
|
|
11430
|
-
const results =
|
|
11452
|
+
const results = templates == null ? void 0 : templates.filter((match2) => jsonUtils.PATH.exec(jsonUtils.escapeTag(match2))).map(jsonUtils.escapeTag);
|
|
11431
11453
|
return results;
|
|
11432
11454
|
},
|
|
11433
11455
|
getMatchesInObject(input, prefix2 = "$") {
|
|
@@ -11874,7 +11896,7 @@ import { useNavigate as useNavigate2 } from "react-router-dom";
|
|
|
11874
11896
|
import { ReactFlowProvider, useReactFlow } from "reactflow";
|
|
11875
11897
|
import debounce from "lodash.debounce";
|
|
11876
11898
|
import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType12 } from "@livechat/developer-studio-api";
|
|
11877
|
-
import {
|
|
11899
|
+
import { useNotificationContext as useNotificationContext2 } from "@livechat/developer-studio-ui-react";
|
|
11878
11900
|
|
|
11879
11901
|
// src/views/Workflows/Common/One/contexts/OneMessagesContext.tsx
|
|
11880
11902
|
import { createContext as createContext2, useContext as useContext4, useMemo, useState } from "react";
|
|
@@ -12576,14 +12598,14 @@ var validateTasks = (workflow, frames, products) => {
|
|
|
12576
12598
|
}).filter(Boolean);
|
|
12577
12599
|
const connectionErrors = resolvingErrors.filter((error) => error.params.subType === "credentials").map((error) => {
|
|
12578
12600
|
return {
|
|
12579
|
-
instancePath:
|
|
12601
|
+
instancePath: baseInstancePath,
|
|
12580
12602
|
keyword: "connection",
|
|
12581
12603
|
message: `Not connected to ${error.params.provider}`,
|
|
12582
12604
|
params: {}
|
|
12583
12605
|
};
|
|
12584
12606
|
});
|
|
12585
12607
|
const activationError = (config2 == null ? void 0 : config2.customization.provider.startsWith(IntegrationNames12.Text)) && !products.find(({ product }) => product === config2.customization.product) ? {
|
|
12586
|
-
instancePath:
|
|
12608
|
+
instancePath: baseInstancePath,
|
|
12587
12609
|
keyword: "activation",
|
|
12588
12610
|
message: `${config2.customization.product} not activated`,
|
|
12589
12611
|
params: {}
|
|
@@ -13005,7 +13027,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13005
13027
|
var _a, _b;
|
|
13006
13028
|
const { fitView } = useReactFlow();
|
|
13007
13029
|
const navigate = useNavigate2();
|
|
13008
|
-
const notifications =
|
|
13030
|
+
const notifications = useNotificationContext2();
|
|
13009
13031
|
const createWorkflowAction = useCreateWorkflow();
|
|
13010
13032
|
const createWorkflowDraftAction = useCreateWorkflowDraft();
|
|
13011
13033
|
const updateWorkflowAction = useUpdateWorkflow();
|
|
@@ -13334,7 +13356,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13334
13356
|
state2.workflow
|
|
13335
13357
|
);
|
|
13336
13358
|
if (!silent) {
|
|
13337
|
-
notifications.
|
|
13359
|
+
notifications.addSuccessToast(
|
|
13360
|
+
"Workflow has been updated successfully"
|
|
13361
|
+
);
|
|
13338
13362
|
}
|
|
13339
13363
|
setWorkflow((prevState) => __spreadProps(__spreadValues({}, prevState), {
|
|
13340
13364
|
version: updateMutationResult.version
|
|
@@ -13344,7 +13368,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13344
13368
|
state2.workflow
|
|
13345
13369
|
);
|
|
13346
13370
|
if (!silent) {
|
|
13347
|
-
notifications.
|
|
13371
|
+
notifications.addSuccessToast(
|
|
13372
|
+
"Workflow has been created successfully"
|
|
13373
|
+
);
|
|
13348
13374
|
}
|
|
13349
13375
|
navigate(`/workflow/${workflowId}`);
|
|
13350
13376
|
}
|
|
@@ -13376,7 +13402,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13376
13402
|
setWorkflow((prevState) => __spreadProps(__spreadValues({}, prevState), {
|
|
13377
13403
|
active: !prevState.active
|
|
13378
13404
|
}));
|
|
13379
|
-
notifications.
|
|
13405
|
+
notifications.addSuccessToast(
|
|
13380
13406
|
`Workflow has been ${state2.workflow.active ? "deactivated" : "activated"}`
|
|
13381
13407
|
);
|
|
13382
13408
|
setAction("isActivating", false);
|
|
@@ -13394,7 +13420,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13394
13420
|
yield deleteWorkflowAction.mutateAsync(state2.workflow);
|
|
13395
13421
|
}
|
|
13396
13422
|
navigate("/workflow/list");
|
|
13397
|
-
notifications.
|
|
13423
|
+
notifications.addSuccessToast("Workflow has been removed successfully");
|
|
13398
13424
|
setAction("isRemoving", false);
|
|
13399
13425
|
}), [setAction, navigate, notifications, deleteWorkflowAction]);
|
|
13400
13426
|
const createDraft = useCallback2(
|
|
@@ -13419,7 +13445,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13419
13445
|
state2.workflow
|
|
13420
13446
|
);
|
|
13421
13447
|
navigate(`/workflow/${draftId}`);
|
|
13422
|
-
notifications.
|
|
13448
|
+
notifications.addSuccessToast(
|
|
13449
|
+
"Workflow draft has been created successfully"
|
|
13450
|
+
);
|
|
13423
13451
|
setAction("isCreating", false);
|
|
13424
13452
|
}),
|
|
13425
13453
|
[
|
|
@@ -13456,7 +13484,7 @@ function WorkflowCreatorProviderBase({
|
|
|
13456
13484
|
}));
|
|
13457
13485
|
navigate(`/workflow/${id}`);
|
|
13458
13486
|
}
|
|
13459
|
-
notifications.
|
|
13487
|
+
notifications.addSuccessToast(
|
|
13460
13488
|
"Workflow draft has been published successfully"
|
|
13461
13489
|
);
|
|
13462
13490
|
setAction("isPublishing", false);
|
|
@@ -13489,7 +13517,9 @@ function WorkflowCreatorProviderBase({
|
|
|
13489
13517
|
});
|
|
13490
13518
|
navigate(`/workflow/${state2.workflow.id}`);
|
|
13491
13519
|
}
|
|
13492
|
-
notifications.
|
|
13520
|
+
notifications.addSuccessToast(
|
|
13521
|
+
"Workflow draft has been discarded successfully"
|
|
13522
|
+
);
|
|
13493
13523
|
setAction("isDiscarding", false);
|
|
13494
13524
|
}), [deleteWorkflowAction, notifications, navigate, setAction]);
|
|
13495
13525
|
const [previewModalVisible, setPreviewModalVisible] = useState4({ isVisible: false });
|
|
@@ -13798,10 +13828,10 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
13798
13828
|
user == null ? void 0 : user.meta.email
|
|
13799
13829
|
);
|
|
13800
13830
|
useEffect4(() => {
|
|
13801
|
-
var _a2, _b, _c, _d, _e, _f, _g
|
|
13831
|
+
var _a2, _b, _c, _d, _e, _f, _g;
|
|
13802
13832
|
if (!params.task) {
|
|
13803
13833
|
const service = (_a2 = params.service) != null ? _a2 : "livechat";
|
|
13804
|
-
const firstTask = (
|
|
13834
|
+
const firstTask = (_c = (_b = config2.find((el) => el.name === service)) == null ? void 0 : _b.values.sort((a, b) => a.name.localeCompare(b.name))[0]) == null ? void 0 : _c.key;
|
|
13805
13835
|
navigate(`${basePath}/${service}/${firstTask}`, {
|
|
13806
13836
|
state: location.state
|
|
13807
13837
|
});
|
|
@@ -13810,13 +13840,13 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
13810
13840
|
const tasks = params.service ? templates.tasks[params.service] : void 0;
|
|
13811
13841
|
const task2 = params.task && tasks ? tasks[params.task] : void 0;
|
|
13812
13842
|
const suggestions = jsonUtils.stringifyToObjectKeyArray(
|
|
13813
|
-
(
|
|
13843
|
+
(_e = (_d = location.state) == null ? void 0 : _d.frame) != null ? _e : {},
|
|
13814
13844
|
{}
|
|
13815
13845
|
);
|
|
13816
13846
|
const matches = Object.fromEntries(
|
|
13817
|
-
(
|
|
13847
|
+
(_g = (_f = jsonUtils.getMatchesInText(jsonUtils.stringify(task2), {
|
|
13818
13848
|
prefix: "#"
|
|
13819
|
-
})) == null ? void 0 :
|
|
13849
|
+
})) == null ? void 0 : _f.map((match2) => {
|
|
13820
13850
|
const matchesWithAliases = match2.split("__");
|
|
13821
13851
|
const path = suggestions.find(
|
|
13822
13852
|
(x) => matchesWithAliases.some(
|
|
@@ -13827,7 +13857,7 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
|
|
|
13827
13857
|
return [match2, `\${${path}}`];
|
|
13828
13858
|
}
|
|
13829
13859
|
return [match2, null];
|
|
13830
|
-
})) != null ?
|
|
13860
|
+
})) != null ? _g : []
|
|
13831
13861
|
);
|
|
13832
13862
|
const newTask = task2 ? jsonUtils.resolveObjectByContext(task2, matches, {
|
|
13833
13863
|
prefix: "#"
|
|
@@ -14270,9 +14300,9 @@ function AddWorkflowTriggerModal({
|
|
|
14270
14300
|
user == null ? void 0 : user.meta.email
|
|
14271
14301
|
);
|
|
14272
14302
|
useEffect5(() => {
|
|
14273
|
-
var _a, _b
|
|
14303
|
+
var _a, _b;
|
|
14274
14304
|
if (!params.trigger) {
|
|
14275
|
-
const firstTrigger = (
|
|
14305
|
+
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;
|
|
14276
14306
|
navigate(`${basePath}/${params.service}/${firstTrigger}`);
|
|
14277
14307
|
}
|
|
14278
14308
|
const templates = WorkflowSpecification.templates;
|
|
@@ -14284,7 +14314,7 @@ function AddWorkflowTriggerModal({
|
|
|
14284
14314
|
if (trigger) {
|
|
14285
14315
|
amplitudeWorkflowsJourney.draft.edit.actions.addTrigger(
|
|
14286
14316
|
trigger.type,
|
|
14287
|
-
trigger.type === "webhook" ?
|
|
14317
|
+
trigger.type === "webhook" ? trigger.webhook.source : void 0
|
|
14288
14318
|
);
|
|
14289
14319
|
addTrigger(trigger);
|
|
14290
14320
|
}
|
|
@@ -15437,8 +15467,8 @@ function convertToTreeNode(obj, meta, nodeName, path) {
|
|
|
15437
15467
|
name: (_e = (_d = customization == null ? void 0 : customization.displayName) != null ? _d : currentSpec == null ? void 0 : currentSpec.title) != null ? _e : nodeName,
|
|
15438
15468
|
description: (_f = customization == null ? void 0 : customization.description) != null ? _f : currentSpec == null ? void 0 : currentSpec.description,
|
|
15439
15469
|
icon: customization == null ? void 0 : customization.provider,
|
|
15440
|
-
value: `${meta.basePath ?
|
|
15441
|
-
path:
|
|
15470
|
+
value: `${meta.basePath ? meta.basePath : ""}${path ? `.${path}` : ""}`,
|
|
15471
|
+
path: path != null ? path : "",
|
|
15442
15472
|
relativePath: meta.baseRelativePath && path && path.startsWith(meta.baseRelativePath) ? path.replace(`${meta.baseRelativePath}.`, "") : "",
|
|
15443
15473
|
children: [],
|
|
15444
15474
|
canAddChildren: (_g = config2 == null ? void 0 : config2.specification) == null ? void 0 : _g.additionalProperties,
|
|
@@ -15463,7 +15493,7 @@ function convertToTreeNode(obj, meta, nodeName, path) {
|
|
|
15463
15493
|
index: index != null ? index : meta.index
|
|
15464
15494
|
},
|
|
15465
15495
|
key,
|
|
15466
|
-
meta.dummy ?
|
|
15496
|
+
meta.dummy ? key : `${path ? `${path}.` : ""}${key}`
|
|
15467
15497
|
)
|
|
15468
15498
|
).filter(Boolean);
|
|
15469
15499
|
} else if (Array.isArray(obj)) {
|
|
@@ -17496,7 +17526,7 @@ import {
|
|
|
17496
17526
|
Card,
|
|
17497
17527
|
Column as Column8,
|
|
17498
17528
|
Row as Row9,
|
|
17499
|
-
|
|
17529
|
+
useNotificationContext as useNotificationContext3,
|
|
17500
17530
|
useUserContext as useUserContext7
|
|
17501
17531
|
} from "@livechat/developer-studio-ui-react";
|
|
17502
17532
|
import {
|
|
@@ -17505,7 +17535,7 @@ import {
|
|
|
17505
17535
|
} from "@livechat/platform-integrations";
|
|
17506
17536
|
function GlobalAccounts(props) {
|
|
17507
17537
|
const { pathname } = useLocation3();
|
|
17508
|
-
const notifications =
|
|
17538
|
+
const notifications = useNotificationContext3();
|
|
17509
17539
|
const { user } = useUserContext7();
|
|
17510
17540
|
const organizationProductsQuery = useFetchOrganizationProducts();
|
|
17511
17541
|
const {
|
|
@@ -17555,7 +17585,7 @@ function GlobalAccounts(props) {
|
|
|
17555
17585
|
onSuccess: refetch
|
|
17556
17586
|
},
|
|
17557
17587
|
{
|
|
17558
|
-
notifications
|
|
17588
|
+
notifications,
|
|
17559
17589
|
user
|
|
17560
17590
|
}
|
|
17561
17591
|
);
|
|
@@ -20022,17 +20052,17 @@ function ApplyWorkflowButton({
|
|
|
20022
20052
|
// src/views/Workflows/Common/One/hooks/useMessageBottomBar.ts
|
|
20023
20053
|
import {
|
|
20024
20054
|
copyTextToClipboard,
|
|
20025
|
-
|
|
20055
|
+
useNotificationContext as useNotificationContext4
|
|
20026
20056
|
} from "@livechat/developer-studio-ui-react";
|
|
20027
20057
|
var useMessageBottomBar = (event) => {
|
|
20028
20058
|
const { text: text2, sessionId } = event;
|
|
20029
|
-
const notifications =
|
|
20059
|
+
const notifications = useNotificationContext4();
|
|
20030
20060
|
const handleCopyClick = () => __async(void 0, null, function* () {
|
|
20031
20061
|
const isCopied = yield copyTextToClipboard(text2);
|
|
20032
20062
|
if (isCopied) {
|
|
20033
|
-
notifications.
|
|
20063
|
+
notifications.addSuccessToast("Message copied successfully");
|
|
20034
20064
|
} else {
|
|
20035
|
-
notifications.
|
|
20065
|
+
notifications.addErrorToast("Could not copy message");
|
|
20036
20066
|
}
|
|
20037
20067
|
});
|
|
20038
20068
|
const handleRateMessageClick = () => {
|
|
@@ -20063,7 +20093,7 @@ function OneAssistantMessageBottomBar({
|
|
|
20063
20093
|
const numberOfSources = (eventSources == null ? void 0 : eventSources.length) || 0;
|
|
20064
20094
|
const { topSources } = getSources(eventSources);
|
|
20065
20095
|
const { handleCopyClick, handleRateMessageClick } = useMessageBottomBar(event);
|
|
20066
|
-
const sourcesText =
|
|
20096
|
+
const sourcesText = plural(numberOfSources, "Source", "Sources");
|
|
20067
20097
|
return /* @__PURE__ */ jsxs2("div", { css: bottomBarContainer, children: [
|
|
20068
20098
|
/* @__PURE__ */ jsxs2("div", { css: bottomBar2, children: [
|
|
20069
20099
|
/* @__PURE__ */ jsxs2("div", { children: [
|
|
@@ -21408,9 +21438,9 @@ import {
|
|
|
21408
21438
|
import { Row as Row13 } from "@livechat/developer-studio-ui-react";
|
|
21409
21439
|
|
|
21410
21440
|
// src/views/Workflows/Creator/Panels/Details/Executions/List.tsx
|
|
21411
|
-
import { Badge as Badge2 } from "@livechat/design-system";
|
|
21412
21441
|
import { CheckCircle as CheckCircle2, CloseCircle as CloseCircle2 } from "@livechat/design-system-icons";
|
|
21413
21442
|
import {
|
|
21443
|
+
Badge as Badge2,
|
|
21414
21444
|
DesignToken as DesignToken32,
|
|
21415
21445
|
Icon as Icon27,
|
|
21416
21446
|
SpacingToken as SpacingToken28
|
|
@@ -22734,7 +22764,7 @@ function WorkflowTemplatePreviewModal({
|
|
|
22734
22764
|
" "
|
|
22735
22765
|
] }),
|
|
22736
22766
|
/* @__PURE__ */ jsx4(Text19, { as: "span", noMargin: true, size: "md", children: item.description })
|
|
22737
|
-
] },
|
|
22767
|
+
] }, item.product)) })
|
|
22738
22768
|
]
|
|
22739
22769
|
}
|
|
22740
22770
|
),
|
|
@@ -23063,7 +23093,7 @@ function WorkflowTemplateCard({
|
|
|
23063
23093
|
/* @__PURE__ */ jsx4(TemplateCategoryIcon_default, { category }),
|
|
23064
23094
|
/* @__PURE__ */ jsx4(Heading7, { as: "div", size: "xs", children: name })
|
|
23065
23095
|
] }),
|
|
23066
|
-
/* @__PURE__ */ jsx4(Row22, { gap: `var(${SpacingToken40.Spacing1})`, noWrap: true, notPadded: true, children: icons.map((icon2, i) => /* @__PURE__ */ jsx4(IconWrapper2, { children: /* @__PURE__ */ jsx4(ProductIcon_default, { height: 5, product: icon2, width: 5 }) },
|
|
23096
|
+
/* @__PURE__ */ jsx4(Row22, { gap: `var(${SpacingToken40.Spacing1})`, noWrap: true, notPadded: true, children: icons.map((icon2, i) => /* @__PURE__ */ jsx4(IconWrapper2, { children: /* @__PURE__ */ jsx4(ProductIcon_default, { height: 5, product: icon2, width: 5 }) }, i.toString())) })
|
|
23067
23097
|
]
|
|
23068
23098
|
}
|
|
23069
23099
|
)
|
|
@@ -23331,13 +23361,13 @@ import {
|
|
|
23331
23361
|
Row as Row24,
|
|
23332
23362
|
StopPropagation,
|
|
23333
23363
|
Table,
|
|
23334
|
-
|
|
23364
|
+
useNotificationContext as useNotificationContext5,
|
|
23335
23365
|
useUserContext as useUserContext11
|
|
23336
23366
|
} from "@livechat/developer-studio-ui-react";
|
|
23337
23367
|
function WorkflowsTable({ workflowsQuery, state }) {
|
|
23338
23368
|
var _a, _b, _c;
|
|
23339
23369
|
const navigate = useNavigate18();
|
|
23340
|
-
const notifications =
|
|
23370
|
+
const notifications = useNotificationContext5();
|
|
23341
23371
|
const deleteAction = useDeleteWorkflow();
|
|
23342
23372
|
const activateWorkflowAction = useActivateWorkflow();
|
|
23343
23373
|
const { user } = useUserContext11();
|
|
@@ -23477,7 +23507,7 @@ function WorkflowsTable({ workflowsQuery, state }) {
|
|
|
23477
23507
|
"list"
|
|
23478
23508
|
);
|
|
23479
23509
|
yield deleteAction.mutateAsync(workflow);
|
|
23480
|
-
notifications.
|
|
23510
|
+
notifications.addSuccessToast(
|
|
23481
23511
|
"Workflow has been deleted successfully"
|
|
23482
23512
|
);
|
|
23483
23513
|
}))()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livechat/platform-workflows",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.77",
|
|
4
4
|
"description": "Text Platform | Workflows",
|
|
5
5
|
"author": "Wojciech Dudek",
|
|
6
6
|
"license": "MIT",
|
|
@@ -81,13 +81,12 @@
|
|
|
81
81
|
"uuid": "^9.0.1",
|
|
82
82
|
"validator": "^13.12.0",
|
|
83
83
|
"web-worker": "^1.3.0",
|
|
84
|
-
"@livechat/developer-studio-ui-react": "1.0.12",
|
|
85
84
|
"@livechat/developer-studio-api": "3.4.9",
|
|
86
|
-
"@livechat/platform-integrations": "0.0.
|
|
85
|
+
"@livechat/platform-integrations": "0.0.45",
|
|
86
|
+
"@livechat/developer-studio-ui-react": "1.0.13"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@tanstack/react-query": "4.36.1",
|
|
90
|
-
"@livechat/design-system": "^0.13.5",
|
|
91
90
|
"@livechat/design-system-icons": "^2.5.3",
|
|
92
91
|
"@livechat/design-system-react-components": "1.38.5",
|
|
93
92
|
"react": "^18.3.1",
|