@livechat/platform-workflows 0.0.76 → 0.0.78

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.
Files changed (3) hide show
  1. package/dist/index.js +114 -83
  2. package/dist/index.mjs +126 -95
  3. 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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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.useNotifications)();
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) => notifications.showError(e.message)
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, _b;
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 = (_b = templates == null ? void 0 : templates.filter((match2) => jsonUtils.PATH.exec(jsonUtils.escapeTag(match2)))) == null ? void 0 : _b.map(jsonUtils.escapeTag);
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: `${baseInstancePath}`,
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: `${baseInstancePath}`,
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.useNotifications)();
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.showSuccess("Workflow has been updated successfully");
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.showSuccess("Workflow has been created successfully");
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.showSuccess(
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.showSuccess("Workflow has been removed successfully");
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.showSuccess("Workflow draft has been created successfully");
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.showSuccess(
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.showSuccess("Workflow draft has been discarded successfully");
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 });
@@ -13557,31 +13587,33 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13557
13587
  const [state, setState] = (0, import_react12.useState)();
13558
13588
  const config2 = (0, import_react12.useMemo)(
13559
13589
  () => [
13560
- {
13561
- name: "system",
13562
- displayName: "System tasks",
13563
- icon: /* @__PURE__ */ jsx4(
13564
- ProductIcon_default,
13565
- {
13566
- center: void 0,
13567
- disabled: void 0,
13568
- height: 5,
13569
- product: OTHER_TYPES.SYSTEM,
13570
- width: 5
13571
- }
13572
- ),
13573
- values: Object.values(systemTaskConfigs()).filter(
13574
- (x) => ![
13575
- import_developer_studio_api21.WorkflowDefinitionTaskType.join,
13576
- import_developer_studio_api21.WorkflowDefinitionTaskType.http
13577
- ].includes(x.key)
13578
- ).map((x) => ({
13579
- key: x.key,
13580
- name: x.customization.displayName,
13581
- shortDescription: x.customization.shortDescription,
13582
- secondaryText: x.customization.description
13583
- }))
13584
- },
13590
+ // {
13591
+ // name: "system",
13592
+ // displayName: "System tasks",
13593
+ // icon: (
13594
+ // <ProductIcon
13595
+ // center={undefined}
13596
+ // disabled={undefined}
13597
+ // height={5}
13598
+ // product={OTHER_TYPES.SYSTEM}
13599
+ // width={5}
13600
+ // />
13601
+ // ),
13602
+ // values: Object.values(systemTaskConfigs())
13603
+ // .filter(
13604
+ // (x) =>
13605
+ // ![
13606
+ // WorkflowDefinitionTaskType.join as string,
13607
+ // WorkflowDefinitionTaskType.http as string,
13608
+ // ].includes(x.key)
13609
+ // )
13610
+ // .map((x) => ({
13611
+ // key: x.key,
13612
+ // name: x.customization.displayName,
13613
+ // shortDescription: x.customization.shortDescription,
13614
+ // secondaryText: x.customization.description,
13615
+ // })),
13616
+ // },
13585
13617
  {
13586
13618
  name: "livechat",
13587
13619
  displayName: import_developer_studio_api21.IntegrationDisplayNames.LiveChat,
@@ -13714,10 +13746,10 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13714
13746
  user == null ? void 0 : user.meta.email
13715
13747
  );
13716
13748
  (0, import_react12.useEffect)(() => {
13717
- var _a2, _b, _c, _d, _e, _f, _g, _h;
13749
+ var _a2, _b, _c, _d, _e, _f, _g;
13718
13750
  if (!params.task) {
13719
13751
  const service = (_a2 = params.service) != null ? _a2 : "livechat";
13720
- const firstTask = (_d = (_c = (_b = config2.find((el) => el.name === service)) == null ? void 0 : _b.values.sort((a, b) => a.name.localeCompare(b.name))) == null ? void 0 : _c[0]) == null ? void 0 : _d.key;
13752
+ 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
13753
  navigate(`${basePath}/${service}/${firstTask}`, {
13722
13754
  state: location.state
13723
13755
  });
@@ -13726,13 +13758,13 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13726
13758
  const tasks = params.service ? templates.tasks[params.service] : void 0;
13727
13759
  const task2 = params.task && tasks ? tasks[params.task] : void 0;
13728
13760
  const suggestions = jsonUtils.stringifyToObjectKeyArray(
13729
- (_f = (_e = location.state) == null ? void 0 : _e.frame) != null ? _f : {},
13761
+ (_e = (_d = location.state) == null ? void 0 : _d.frame) != null ? _e : {},
13730
13762
  {}
13731
13763
  );
13732
13764
  const matches = Object.fromEntries(
13733
- (_h = (_g = jsonUtils.getMatchesInText(jsonUtils.stringify(task2), {
13765
+ (_g = (_f = jsonUtils.getMatchesInText(jsonUtils.stringify(task2), {
13734
13766
  prefix: "#"
13735
- })) == null ? void 0 : _g.map((match2) => {
13767
+ })) == null ? void 0 : _f.map((match2) => {
13736
13768
  const matchesWithAliases = match2.split("__");
13737
13769
  const path = suggestions.find(
13738
13770
  (x) => matchesWithAliases.some(
@@ -13743,7 +13775,7 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13743
13775
  return [match2, `\${${path}}`];
13744
13776
  }
13745
13777
  return [match2, null];
13746
- })) != null ? _h : []
13778
+ })) != null ? _g : []
13747
13779
  );
13748
13780
  const newTask = task2 ? jsonUtils.resolveObjectByContext(task2, matches, {
13749
13781
  prefix: "#"
@@ -14164,9 +14196,9 @@ function AddWorkflowTriggerModal({
14164
14196
  user == null ? void 0 : user.meta.email
14165
14197
  );
14166
14198
  (0, import_react15.useEffect)(() => {
14167
- var _a, _b, _c;
14199
+ var _a, _b;
14168
14200
  if (!params.trigger) {
14169
- const firstTrigger = (_c = (_b = (_a = config2.find((el) => el.name === params.service)) == null ? void 0 : _a.values.sort((a, b) => a.name.localeCompare(b.name))) == null ? void 0 : _b[0]) == null ? void 0 : _c.key;
14201
+ 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
14202
  navigate(`${basePath}/${params.service}/${firstTrigger}`);
14171
14203
  }
14172
14204
  const templates = WorkflowSpecification.templates;
@@ -14178,7 +14210,7 @@ function AddWorkflowTriggerModal({
14178
14210
  if (trigger) {
14179
14211
  amplitudeWorkflowsJourney.draft.edit.actions.addTrigger(
14180
14212
  trigger.type,
14181
- trigger.type === "webhook" ? `${trigger.webhook.source}` : void 0
14213
+ trigger.type === "webhook" ? trigger.webhook.source : void 0
14182
14214
  );
14183
14215
  addTrigger(trigger);
14184
14216
  }
@@ -15272,8 +15304,8 @@ function convertToTreeNode(obj, meta, nodeName, path) {
15272
15304
  name: (_e = (_d = customization == null ? void 0 : customization.displayName) != null ? _d : currentSpec == null ? void 0 : currentSpec.title) != null ? _e : nodeName,
15273
15305
  description: (_f = customization == null ? void 0 : customization.description) != null ? _f : currentSpec == null ? void 0 : currentSpec.description,
15274
15306
  icon: customization == null ? void 0 : customization.provider,
15275
- value: `${meta.basePath ? `${meta.basePath}` : ""}${path ? `.${path}` : ""}`,
15276
- path: `${path != null ? path : ""}`,
15307
+ value: `${meta.basePath ? meta.basePath : ""}${path ? `.${path}` : ""}`,
15308
+ path: path != null ? path : "",
15277
15309
  relativePath: meta.baseRelativePath && path && path.startsWith(meta.baseRelativePath) ? path.replace(`${meta.baseRelativePath}.`, "") : "",
15278
15310
  children: [],
15279
15311
  canAddChildren: (_g = config2 == null ? void 0 : config2.specification) == null ? void 0 : _g.additionalProperties,
@@ -15298,7 +15330,7 @@ function convertToTreeNode(obj, meta, nodeName, path) {
15298
15330
  index: index != null ? index : meta.index
15299
15331
  },
15300
15332
  key,
15301
- meta.dummy ? `${key}` : `${path ? `${path}.` : ""}${key}`
15333
+ meta.dummy ? key : `${path ? `${path}.` : ""}${key}`
15302
15334
  )
15303
15335
  ).filter(Boolean);
15304
15336
  } else if (Array.isArray(obj)) {
@@ -17278,7 +17310,7 @@ var import_developer_studio_ui_react19 = require("@livechat/developer-studio-ui-
17278
17310
  var import_platform_integrations3 = require("@livechat/platform-integrations");
17279
17311
  function GlobalAccounts(props) {
17280
17312
  const { pathname } = (0, import_react_router_dom6.useLocation)();
17281
- const notifications = (0, import_developer_studio_ui_react19.useNotifications)();
17313
+ const notifications = (0, import_developer_studio_ui_react19.useNotificationContext)();
17282
17314
  const { user } = (0, import_developer_studio_ui_react19.useUserContext)();
17283
17315
  const organizationProductsQuery = useFetchOrganizationProducts();
17284
17316
  const {
@@ -17328,7 +17360,7 @@ function GlobalAccounts(props) {
17328
17360
  onSuccess: refetch
17329
17361
  },
17330
17362
  {
17331
- notifications: notifications.context,
17363
+ notifications,
17332
17364
  user
17333
17365
  }
17334
17366
  );
@@ -19723,13 +19755,13 @@ function ApplyWorkflowButton({
19723
19755
  var import_developer_studio_ui_react22 = require("@livechat/developer-studio-ui-react");
19724
19756
  var useMessageBottomBar = (event) => {
19725
19757
  const { text: text2, sessionId } = event;
19726
- const notifications = (0, import_developer_studio_ui_react22.useNotifications)();
19758
+ const notifications = (0, import_developer_studio_ui_react22.useNotificationContext)();
19727
19759
  const handleCopyClick = () => __async(void 0, null, function* () {
19728
19760
  const isCopied = yield (0, import_developer_studio_ui_react22.copyTextToClipboard)(text2);
19729
19761
  if (isCopied) {
19730
- notifications.showSuccess("Message copied successfully");
19762
+ notifications.addSuccessToast("Message copied successfully");
19731
19763
  } else {
19732
- notifications.showError("Could not copy message");
19764
+ notifications.addErrorToast("Could not copy message");
19733
19765
  }
19734
19766
  });
19735
19767
  const handleRateMessageClick = () => {
@@ -19760,7 +19792,7 @@ function OneAssistantMessageBottomBar({
19760
19792
  const numberOfSources = (eventSources == null ? void 0 : eventSources.length) || 0;
19761
19793
  const { topSources } = getSources(eventSources);
19762
19794
  const { handleCopyClick, handleRateMessageClick } = useMessageBottomBar(event);
19763
- const sourcesText = `${(0, import_developer_studio_ui_react23.plural)(numberOfSources, "Source", "Sources")}`;
19795
+ const sourcesText = (0, import_developer_studio_ui_react23.plural)(numberOfSources, "Source", "Sources");
19764
19796
  return /* @__PURE__ */ jsxs2("div", { css: bottomBarContainer, children: [
19765
19797
  /* @__PURE__ */ jsxs2("div", { css: bottomBar2, children: [
19766
19798
  /* @__PURE__ */ jsxs2("div", { children: [
@@ -21076,7 +21108,6 @@ var import_design_system_react_components65 = require("@livechat/design-system-r
21076
21108
  var import_developer_studio_ui_react30 = require("@livechat/developer-studio-ui-react");
21077
21109
 
21078
21110
  // src/views/Workflows/Creator/Panels/Details/Executions/List.tsx
21079
- var import_design_system = require("@livechat/design-system");
21080
21111
  var import_design_system_icons28 = require("@livechat/design-system-icons");
21081
21112
  var import_design_system_react_components63 = require("@livechat/design-system-react-components");
21082
21113
  var import_developer_studio_ui_react28 = require("@livechat/developer-studio-ui-react");
@@ -21112,7 +21143,7 @@ function WorkflowExecutionList({
21112
21143
  /* @__PURE__ */ jsx4("td", { children: (0, import_developer_studio_ui_react28.formatUSADate)(execution.started_at) }),
21113
21144
  /* @__PURE__ */ jsx4("td", { children: (0, import_developer_studio_ui_react28.formatUSADate)(execution.ended_at) }),
21114
21145
  /* @__PURE__ */ jsx4("td", { children: /* @__PURE__ */ jsx4(
21115
- import_design_system.Badge,
21146
+ import_design_system_react_components63.Badge,
21116
21147
  {
21117
21148
  css: css`
21118
21149
  display: flex;
@@ -22338,7 +22369,7 @@ function WorkflowTemplatePreviewModal({
22338
22369
  " "
22339
22370
  ] }),
22340
22371
  /* @__PURE__ */ jsx4(import_design_system_react_components71.Text, { as: "span", noMargin: true, size: "md", children: item.description })
22341
- ] }, `${item.product}`)) })
22372
+ ] }, item.product)) })
22342
22373
  ]
22343
22374
  }
22344
22375
  ),
@@ -22626,7 +22657,7 @@ function WorkflowTemplateCard({
22626
22657
  /* @__PURE__ */ jsx4(TemplateCategoryIcon_default, { category }),
22627
22658
  /* @__PURE__ */ jsx4(import_design_system_react_components75.Heading, { as: "div", size: "xs", children: name })
22628
22659
  ] }),
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 }) }, `${i.toString()}`)) })
22660
+ /* @__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
22661
  ]
22631
22662
  }
22632
22663
  )
@@ -22863,7 +22894,7 @@ var import_developer_studio_ui_react42 = require("@livechat/developer-studio-ui-
22863
22894
  function WorkflowsTable({ workflowsQuery, state }) {
22864
22895
  var _a, _b, _c;
22865
22896
  const navigate = (0, import_react_router_dom24.useNavigate)();
22866
- const notifications = (0, import_developer_studio_ui_react42.useNotifications)();
22897
+ const notifications = (0, import_developer_studio_ui_react42.useNotificationContext)();
22867
22898
  const deleteAction = useDeleteWorkflow();
22868
22899
  const activateWorkflowAction = useActivateWorkflow();
22869
22900
  const { user } = (0, import_developer_studio_ui_react42.useUserContext)();
@@ -23003,7 +23034,7 @@ function WorkflowsTable({ workflowsQuery, state }) {
23003
23034
  "list"
23004
23035
  );
23005
23036
  yield deleteAction.mutateAsync(workflow);
23006
- notifications.showSuccess(
23037
+ notifications.addSuccessToast(
23007
23038
  "Workflow has been deleted successfully"
23008
23039
  );
23009
23040
  }))()
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
- useNotifications,
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 = useNotifications();
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) => notifications.showError(e.message)
1913
+ onError: (e) => {
1914
+ notifications.addErrorToast(e.message);
1915
+ }
1914
1916
  }
1915
1917
  );
1916
1918
  };
1917
1919
  var useFetchWorkflow = (workflowId) => {
1918
- const notifications = useNotifications();
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) => notifications.showError(e.message)
1931
+ onError: (e) => {
1932
+ notifications.addErrorToast(e.message);
1933
+ }
1930
1934
  }
1931
1935
  );
1932
1936
  };
1933
1937
  var useFetchWorkflowExecutionList = (workflowId) => {
1934
- const notifications = useNotifications();
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) => notifications.showError(e.message)
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 = useNotifications();
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) => notifications.showError(e.message)
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 = useNotifications();
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) => notifications.showError(e.message)
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 = useNotifications();
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) => notifications.showError(e.message)
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 = useNotifications();
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) => notifications.showError(e.message)
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 = useNotifications();
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) => notifications.showError(e.message)
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 = useNotifications();
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) => notifications.showError(e.message)
2140
+ onError: (e) => {
2141
+ notifications.addErrorToast(e.message);
2142
+ }
2125
2143
  }
2126
2144
  );
2127
2145
  };
2128
2146
  var useExecuteWorkflow = () => {
2129
- const notifications = useNotifications();
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) => notifications.showError(e.message)
2159
+ onError: (e) => {
2160
+ notifications.addErrorToast(e.message);
2161
+ }
2142
2162
  }
2143
2163
  );
2144
2164
  };
2145
2165
  var useGenerateAIResponse = () => {
2146
- const notifications = useNotifications();
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) => notifications.showError(e.message)
2175
+ onError: (e) => {
2176
+ notifications.addErrorToast(e.message);
2177
+ }
2156
2178
  }
2157
2179
  );
2158
2180
  };
@@ -11395,8 +11417,7 @@ import {
11395
11417
  } from "@livechat/design-system-react-components";
11396
11418
  import {
11397
11419
  IntegrationDisplayNames as IntegrationDisplayNames9,
11398
- IntegrationNames as IntegrationNames13,
11399
- WorkflowDefinitionTaskType as WorkflowDefinitionTaskType13
11420
+ IntegrationNames as IntegrationNames13
11400
11421
  } from "@livechat/developer-studio-api";
11401
11422
  import {
11402
11423
  Column as Column3,
@@ -11422,12 +11443,12 @@ var jsonUtils = {
11422
11443
  return prefix2 === "$" ? jsonUtils.HASH_TAG : jsonUtils.HASH_TAG2;
11423
11444
  },
11424
11445
  getMatchesInText(text2, options) {
11425
- var _a, _b;
11446
+ var _a;
11426
11447
  if (typeof text2 !== "string") {
11427
11448
  return void 0;
11428
11449
  }
11429
11450
  const templates = jsonUtils.getRegex((_a = options == null ? void 0 : options.prefix) != null ? _a : "$").exec(text2);
11430
- const results = (_b = templates == null ? void 0 : templates.filter((match2) => jsonUtils.PATH.exec(jsonUtils.escapeTag(match2)))) == null ? void 0 : _b.map(jsonUtils.escapeTag);
11451
+ const results = templates == null ? void 0 : templates.filter((match2) => jsonUtils.PATH.exec(jsonUtils.escapeTag(match2))).map(jsonUtils.escapeTag);
11431
11452
  return results;
11432
11453
  },
11433
11454
  getMatchesInObject(input, prefix2 = "$") {
@@ -11874,7 +11895,7 @@ import { useNavigate as useNavigate2 } from "react-router-dom";
11874
11895
  import { ReactFlowProvider, useReactFlow } from "reactflow";
11875
11896
  import debounce from "lodash.debounce";
11876
11897
  import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType12 } from "@livechat/developer-studio-api";
11877
- import { useNotifications as useNotifications2 } from "@livechat/developer-studio-ui-react";
11898
+ import { useNotificationContext as useNotificationContext2 } from "@livechat/developer-studio-ui-react";
11878
11899
 
11879
11900
  // src/views/Workflows/Common/One/contexts/OneMessagesContext.tsx
11880
11901
  import { createContext as createContext2, useContext as useContext4, useMemo, useState } from "react";
@@ -12576,14 +12597,14 @@ var validateTasks = (workflow, frames, products) => {
12576
12597
  }).filter(Boolean);
12577
12598
  const connectionErrors = resolvingErrors.filter((error) => error.params.subType === "credentials").map((error) => {
12578
12599
  return {
12579
- instancePath: `${baseInstancePath}`,
12600
+ instancePath: baseInstancePath,
12580
12601
  keyword: "connection",
12581
12602
  message: `Not connected to ${error.params.provider}`,
12582
12603
  params: {}
12583
12604
  };
12584
12605
  });
12585
12606
  const activationError = (config2 == null ? void 0 : config2.customization.provider.startsWith(IntegrationNames12.Text)) && !products.find(({ product }) => product === config2.customization.product) ? {
12586
- instancePath: `${baseInstancePath}`,
12607
+ instancePath: baseInstancePath,
12587
12608
  keyword: "activation",
12588
12609
  message: `${config2.customization.product} not activated`,
12589
12610
  params: {}
@@ -13005,7 +13026,7 @@ function WorkflowCreatorProviderBase({
13005
13026
  var _a, _b;
13006
13027
  const { fitView } = useReactFlow();
13007
13028
  const navigate = useNavigate2();
13008
- const notifications = useNotifications2();
13029
+ const notifications = useNotificationContext2();
13009
13030
  const createWorkflowAction = useCreateWorkflow();
13010
13031
  const createWorkflowDraftAction = useCreateWorkflowDraft();
13011
13032
  const updateWorkflowAction = useUpdateWorkflow();
@@ -13334,7 +13355,9 @@ function WorkflowCreatorProviderBase({
13334
13355
  state2.workflow
13335
13356
  );
13336
13357
  if (!silent) {
13337
- notifications.showSuccess("Workflow has been updated successfully");
13358
+ notifications.addSuccessToast(
13359
+ "Workflow has been updated successfully"
13360
+ );
13338
13361
  }
13339
13362
  setWorkflow((prevState) => __spreadProps(__spreadValues({}, prevState), {
13340
13363
  version: updateMutationResult.version
@@ -13344,7 +13367,9 @@ function WorkflowCreatorProviderBase({
13344
13367
  state2.workflow
13345
13368
  );
13346
13369
  if (!silent) {
13347
- notifications.showSuccess("Workflow has been created successfully");
13370
+ notifications.addSuccessToast(
13371
+ "Workflow has been created successfully"
13372
+ );
13348
13373
  }
13349
13374
  navigate(`/workflow/${workflowId}`);
13350
13375
  }
@@ -13376,7 +13401,7 @@ function WorkflowCreatorProviderBase({
13376
13401
  setWorkflow((prevState) => __spreadProps(__spreadValues({}, prevState), {
13377
13402
  active: !prevState.active
13378
13403
  }));
13379
- notifications.showSuccess(
13404
+ notifications.addSuccessToast(
13380
13405
  `Workflow has been ${state2.workflow.active ? "deactivated" : "activated"}`
13381
13406
  );
13382
13407
  setAction("isActivating", false);
@@ -13394,7 +13419,7 @@ function WorkflowCreatorProviderBase({
13394
13419
  yield deleteWorkflowAction.mutateAsync(state2.workflow);
13395
13420
  }
13396
13421
  navigate("/workflow/list");
13397
- notifications.showSuccess("Workflow has been removed successfully");
13422
+ notifications.addSuccessToast("Workflow has been removed successfully");
13398
13423
  setAction("isRemoving", false);
13399
13424
  }), [setAction, navigate, notifications, deleteWorkflowAction]);
13400
13425
  const createDraft = useCallback2(
@@ -13419,7 +13444,9 @@ function WorkflowCreatorProviderBase({
13419
13444
  state2.workflow
13420
13445
  );
13421
13446
  navigate(`/workflow/${draftId}`);
13422
- notifications.showSuccess("Workflow draft has been created successfully");
13447
+ notifications.addSuccessToast(
13448
+ "Workflow draft has been created successfully"
13449
+ );
13423
13450
  setAction("isCreating", false);
13424
13451
  }),
13425
13452
  [
@@ -13456,7 +13483,7 @@ function WorkflowCreatorProviderBase({
13456
13483
  }));
13457
13484
  navigate(`/workflow/${id}`);
13458
13485
  }
13459
- notifications.showSuccess(
13486
+ notifications.addSuccessToast(
13460
13487
  "Workflow draft has been published successfully"
13461
13488
  );
13462
13489
  setAction("isPublishing", false);
@@ -13489,7 +13516,9 @@ function WorkflowCreatorProviderBase({
13489
13516
  });
13490
13517
  navigate(`/workflow/${state2.workflow.id}`);
13491
13518
  }
13492
- notifications.showSuccess("Workflow draft has been discarded successfully");
13519
+ notifications.addSuccessToast(
13520
+ "Workflow draft has been discarded successfully"
13521
+ );
13493
13522
  setAction("isDiscarding", false);
13494
13523
  }), [deleteWorkflowAction, notifications, navigate, setAction]);
13495
13524
  const [previewModalVisible, setPreviewModalVisible] = useState4({ isVisible: false });
@@ -13641,31 +13670,33 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13641
13670
  const [state, setState] = useState5();
13642
13671
  const config2 = useMemo3(
13643
13672
  () => [
13644
- {
13645
- name: "system",
13646
- displayName: "System tasks",
13647
- icon: /* @__PURE__ */ jsx4(
13648
- ProductIcon_default,
13649
- {
13650
- center: void 0,
13651
- disabled: void 0,
13652
- height: 5,
13653
- product: OTHER_TYPES.SYSTEM,
13654
- width: 5
13655
- }
13656
- ),
13657
- values: Object.values(systemTaskConfigs()).filter(
13658
- (x) => ![
13659
- WorkflowDefinitionTaskType13.join,
13660
- WorkflowDefinitionTaskType13.http
13661
- ].includes(x.key)
13662
- ).map((x) => ({
13663
- key: x.key,
13664
- name: x.customization.displayName,
13665
- shortDescription: x.customization.shortDescription,
13666
- secondaryText: x.customization.description
13667
- }))
13668
- },
13673
+ // {
13674
+ // name: "system",
13675
+ // displayName: "System tasks",
13676
+ // icon: (
13677
+ // <ProductIcon
13678
+ // center={undefined}
13679
+ // disabled={undefined}
13680
+ // height={5}
13681
+ // product={OTHER_TYPES.SYSTEM}
13682
+ // width={5}
13683
+ // />
13684
+ // ),
13685
+ // values: Object.values(systemTaskConfigs())
13686
+ // .filter(
13687
+ // (x) =>
13688
+ // ![
13689
+ // WorkflowDefinitionTaskType.join as string,
13690
+ // WorkflowDefinitionTaskType.http as string,
13691
+ // ].includes(x.key)
13692
+ // )
13693
+ // .map((x) => ({
13694
+ // key: x.key,
13695
+ // name: x.customization.displayName,
13696
+ // shortDescription: x.customization.shortDescription,
13697
+ // secondaryText: x.customization.description,
13698
+ // })),
13699
+ // },
13669
13700
  {
13670
13701
  name: "livechat",
13671
13702
  displayName: IntegrationDisplayNames9.LiveChat,
@@ -13798,10 +13829,10 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13798
13829
  user == null ? void 0 : user.meta.email
13799
13830
  );
13800
13831
  useEffect4(() => {
13801
- var _a2, _b, _c, _d, _e, _f, _g, _h;
13832
+ var _a2, _b, _c, _d, _e, _f, _g;
13802
13833
  if (!params.task) {
13803
13834
  const service = (_a2 = params.service) != null ? _a2 : "livechat";
13804
- const firstTask = (_d = (_c = (_b = config2.find((el) => el.name === service)) == null ? void 0 : _b.values.sort((a, b) => a.name.localeCompare(b.name))) == null ? void 0 : _c[0]) == null ? void 0 : _d.key;
13835
+ 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
13836
  navigate(`${basePath}/${service}/${firstTask}`, {
13806
13837
  state: location.state
13807
13838
  });
@@ -13810,13 +13841,13 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13810
13841
  const tasks = params.service ? templates.tasks[params.service] : void 0;
13811
13842
  const task2 = params.task && tasks ? tasks[params.task] : void 0;
13812
13843
  const suggestions = jsonUtils.stringifyToObjectKeyArray(
13813
- (_f = (_e = location.state) == null ? void 0 : _e.frame) != null ? _f : {},
13844
+ (_e = (_d = location.state) == null ? void 0 : _d.frame) != null ? _e : {},
13814
13845
  {}
13815
13846
  );
13816
13847
  const matches = Object.fromEntries(
13817
- (_h = (_g = jsonUtils.getMatchesInText(jsonUtils.stringify(task2), {
13848
+ (_g = (_f = jsonUtils.getMatchesInText(jsonUtils.stringify(task2), {
13818
13849
  prefix: "#"
13819
- })) == null ? void 0 : _g.map((match2) => {
13850
+ })) == null ? void 0 : _f.map((match2) => {
13820
13851
  const matchesWithAliases = match2.split("__");
13821
13852
  const path = suggestions.find(
13822
13853
  (x) => matchesWithAliases.some(
@@ -13827,7 +13858,7 @@ function AddWorkflowTaskModal({ basePath, onClose }) {
13827
13858
  return [match2, `\${${path}}`];
13828
13859
  }
13829
13860
  return [match2, null];
13830
- })) != null ? _h : []
13861
+ })) != null ? _g : []
13831
13862
  );
13832
13863
  const newTask = task2 ? jsonUtils.resolveObjectByContext(task2, matches, {
13833
13864
  prefix: "#"
@@ -14270,9 +14301,9 @@ function AddWorkflowTriggerModal({
14270
14301
  user == null ? void 0 : user.meta.email
14271
14302
  );
14272
14303
  useEffect5(() => {
14273
- var _a, _b, _c;
14304
+ var _a, _b;
14274
14305
  if (!params.trigger) {
14275
- const firstTrigger = (_c = (_b = (_a = config2.find((el) => el.name === params.service)) == null ? void 0 : _a.values.sort((a, b) => a.name.localeCompare(b.name))) == null ? void 0 : _b[0]) == null ? void 0 : _c.key;
14306
+ 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
14307
  navigate(`${basePath}/${params.service}/${firstTrigger}`);
14277
14308
  }
14278
14309
  const templates = WorkflowSpecification.templates;
@@ -14284,7 +14315,7 @@ function AddWorkflowTriggerModal({
14284
14315
  if (trigger) {
14285
14316
  amplitudeWorkflowsJourney.draft.edit.actions.addTrigger(
14286
14317
  trigger.type,
14287
- trigger.type === "webhook" ? `${trigger.webhook.source}` : void 0
14318
+ trigger.type === "webhook" ? trigger.webhook.source : void 0
14288
14319
  );
14289
14320
  addTrigger(trigger);
14290
14321
  }
@@ -15437,8 +15468,8 @@ function convertToTreeNode(obj, meta, nodeName, path) {
15437
15468
  name: (_e = (_d = customization == null ? void 0 : customization.displayName) != null ? _d : currentSpec == null ? void 0 : currentSpec.title) != null ? _e : nodeName,
15438
15469
  description: (_f = customization == null ? void 0 : customization.description) != null ? _f : currentSpec == null ? void 0 : currentSpec.description,
15439
15470
  icon: customization == null ? void 0 : customization.provider,
15440
- value: `${meta.basePath ? `${meta.basePath}` : ""}${path ? `.${path}` : ""}`,
15441
- path: `${path != null ? path : ""}`,
15471
+ value: `${meta.basePath ? meta.basePath : ""}${path ? `.${path}` : ""}`,
15472
+ path: path != null ? path : "",
15442
15473
  relativePath: meta.baseRelativePath && path && path.startsWith(meta.baseRelativePath) ? path.replace(`${meta.baseRelativePath}.`, "") : "",
15443
15474
  children: [],
15444
15475
  canAddChildren: (_g = config2 == null ? void 0 : config2.specification) == null ? void 0 : _g.additionalProperties,
@@ -15463,7 +15494,7 @@ function convertToTreeNode(obj, meta, nodeName, path) {
15463
15494
  index: index != null ? index : meta.index
15464
15495
  },
15465
15496
  key,
15466
- meta.dummy ? `${key}` : `${path ? `${path}.` : ""}${key}`
15497
+ meta.dummy ? key : `${path ? `${path}.` : ""}${key}`
15467
15498
  )
15468
15499
  ).filter(Boolean);
15469
15500
  } else if (Array.isArray(obj)) {
@@ -17496,7 +17527,7 @@ import {
17496
17527
  Card,
17497
17528
  Column as Column8,
17498
17529
  Row as Row9,
17499
- useNotifications as useNotifications3,
17530
+ useNotificationContext as useNotificationContext3,
17500
17531
  useUserContext as useUserContext7
17501
17532
  } from "@livechat/developer-studio-ui-react";
17502
17533
  import {
@@ -17505,7 +17536,7 @@ import {
17505
17536
  } from "@livechat/platform-integrations";
17506
17537
  function GlobalAccounts(props) {
17507
17538
  const { pathname } = useLocation3();
17508
- const notifications = useNotifications3();
17539
+ const notifications = useNotificationContext3();
17509
17540
  const { user } = useUserContext7();
17510
17541
  const organizationProductsQuery = useFetchOrganizationProducts();
17511
17542
  const {
@@ -17555,7 +17586,7 @@ function GlobalAccounts(props) {
17555
17586
  onSuccess: refetch
17556
17587
  },
17557
17588
  {
17558
- notifications: notifications.context,
17589
+ notifications,
17559
17590
  user
17560
17591
  }
17561
17592
  );
@@ -20022,17 +20053,17 @@ function ApplyWorkflowButton({
20022
20053
  // src/views/Workflows/Common/One/hooks/useMessageBottomBar.ts
20023
20054
  import {
20024
20055
  copyTextToClipboard,
20025
- useNotifications as useNotifications4
20056
+ useNotificationContext as useNotificationContext4
20026
20057
  } from "@livechat/developer-studio-ui-react";
20027
20058
  var useMessageBottomBar = (event) => {
20028
20059
  const { text: text2, sessionId } = event;
20029
- const notifications = useNotifications4();
20060
+ const notifications = useNotificationContext4();
20030
20061
  const handleCopyClick = () => __async(void 0, null, function* () {
20031
20062
  const isCopied = yield copyTextToClipboard(text2);
20032
20063
  if (isCopied) {
20033
- notifications.showSuccess("Message copied successfully");
20064
+ notifications.addSuccessToast("Message copied successfully");
20034
20065
  } else {
20035
- notifications.showError("Could not copy message");
20066
+ notifications.addErrorToast("Could not copy message");
20036
20067
  }
20037
20068
  });
20038
20069
  const handleRateMessageClick = () => {
@@ -20063,7 +20094,7 @@ function OneAssistantMessageBottomBar({
20063
20094
  const numberOfSources = (eventSources == null ? void 0 : eventSources.length) || 0;
20064
20095
  const { topSources } = getSources(eventSources);
20065
20096
  const { handleCopyClick, handleRateMessageClick } = useMessageBottomBar(event);
20066
- const sourcesText = `${plural(numberOfSources, "Source", "Sources")}`;
20097
+ const sourcesText = plural(numberOfSources, "Source", "Sources");
20067
20098
  return /* @__PURE__ */ jsxs2("div", { css: bottomBarContainer, children: [
20068
20099
  /* @__PURE__ */ jsxs2("div", { css: bottomBar2, children: [
20069
20100
  /* @__PURE__ */ jsxs2("div", { children: [
@@ -20712,7 +20743,7 @@ var Edges_default = CustomEdge_default;
20712
20743
  import { MarkerType } from "reactflow";
20713
20744
  import ElkConstructor from "elkjs";
20714
20745
  import { DesignToken as DesignToken28 } from "@livechat/design-system-react-components";
20715
- import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType14 } from "@livechat/developer-studio-api";
20746
+ import { WorkflowDefinitionTaskType as WorkflowDefinitionTaskType13 } from "@livechat/developer-studio-api";
20716
20747
  var elk = new ElkConstructor({
20717
20748
  defaultLayoutOptions: {
20718
20749
  "elk.algorithm": "layered",
@@ -20769,9 +20800,9 @@ var convertToNodes = (tasks) => {
20769
20800
  );
20770
20801
  const { parentSource, parentTargets } = sourceAndTargets != null ? sourceAndTargets : {};
20771
20802
  switch (task2.type) {
20772
- case WorkflowDefinitionTaskType14.terminate:
20773
- case WorkflowDefinitionTaskType14.http:
20774
- case WorkflowDefinitionTaskType14.join:
20803
+ case WorkflowDefinitionTaskType13.terminate:
20804
+ case WorkflowDefinitionTaskType13.http:
20805
+ case WorkflowDefinitionTaskType13.join:
20775
20806
  nodes.push(
20776
20807
  buildNode(
20777
20808
  {
@@ -20790,7 +20821,7 @@ var convertToNodes = (tasks) => {
20790
20821
  )
20791
20822
  );
20792
20823
  return nodes;
20793
- case WorkflowDefinitionTaskType14.switch:
20824
+ case WorkflowDefinitionTaskType13.switch:
20794
20825
  nodes.push(
20795
20826
  buildNode(
20796
20827
  {
@@ -20857,7 +20888,7 @@ var convertToNodes = (tasks) => {
20857
20888
  }
20858
20889
  );
20859
20890
  return nodes;
20860
- case WorkflowDefinitionTaskType14.forkJoin:
20891
+ case WorkflowDefinitionTaskType13.forkJoin:
20861
20892
  nodes.push(
20862
20893
  buildNode(
20863
20894
  {
@@ -21408,9 +21439,9 @@ import {
21408
21439
  import { Row as Row13 } from "@livechat/developer-studio-ui-react";
21409
21440
 
21410
21441
  // src/views/Workflows/Creator/Panels/Details/Executions/List.tsx
21411
- import { Badge as Badge2 } from "@livechat/design-system";
21412
21442
  import { CheckCircle as CheckCircle2, CloseCircle as CloseCircle2 } from "@livechat/design-system-icons";
21413
21443
  import {
21444
+ Badge as Badge2,
21414
21445
  DesignToken as DesignToken32,
21415
21446
  Icon as Icon27,
21416
21447
  SpacingToken as SpacingToken28
@@ -22734,7 +22765,7 @@ function WorkflowTemplatePreviewModal({
22734
22765
  " "
22735
22766
  ] }),
22736
22767
  /* @__PURE__ */ jsx4(Text19, { as: "span", noMargin: true, size: "md", children: item.description })
22737
- ] }, `${item.product}`)) })
22768
+ ] }, item.product)) })
22738
22769
  ]
22739
22770
  }
22740
22771
  ),
@@ -23063,7 +23094,7 @@ function WorkflowTemplateCard({
23063
23094
  /* @__PURE__ */ jsx4(TemplateCategoryIcon_default, { category }),
23064
23095
  /* @__PURE__ */ jsx4(Heading7, { as: "div", size: "xs", children: name })
23065
23096
  ] }),
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 }) }, `${i.toString()}`)) })
23097
+ /* @__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
23098
  ]
23068
23099
  }
23069
23100
  )
@@ -23331,13 +23362,13 @@ import {
23331
23362
  Row as Row24,
23332
23363
  StopPropagation,
23333
23364
  Table,
23334
- useNotifications as useNotifications5,
23365
+ useNotificationContext as useNotificationContext5,
23335
23366
  useUserContext as useUserContext11
23336
23367
  } from "@livechat/developer-studio-ui-react";
23337
23368
  function WorkflowsTable({ workflowsQuery, state }) {
23338
23369
  var _a, _b, _c;
23339
23370
  const navigate = useNavigate18();
23340
- const notifications = useNotifications5();
23371
+ const notifications = useNotificationContext5();
23341
23372
  const deleteAction = useDeleteWorkflow();
23342
23373
  const activateWorkflowAction = useActivateWorkflow();
23343
23374
  const { user } = useUserContext11();
@@ -23477,7 +23508,7 @@ function WorkflowsTable({ workflowsQuery, state }) {
23477
23508
  "list"
23478
23509
  );
23479
23510
  yield deleteAction.mutateAsync(workflow);
23480
- notifications.showSuccess(
23511
+ notifications.addSuccessToast(
23481
23512
  "Workflow has been deleted successfully"
23482
23513
  );
23483
23514
  }))()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livechat/platform-workflows",
3
- "version": "0.0.76",
3
+ "version": "0.0.78",
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.44"
85
+ "@livechat/developer-studio-ui-react": "1.0.13",
86
+ "@livechat/platform-integrations": "0.0.45"
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",