app-v3-scripts-editor 1.29.1 → 1.29.3

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 (32) hide show
  1. package/dist/app-v3-scripts-editor.css +1 -1
  2. package/dist/app-v3-scripts-editor.es.js +25707 -24922
  3. package/dist/app-v3-scripts-editor.umd.js +174 -174
  4. package/dist/src/lib/components/Blocks/Agent/components/ListCondition.d.ts +1 -2
  5. package/dist/src/lib/components/Blocks/Agent/settings/AgentIntent.d.ts +5 -2
  6. package/dist/src/lib/components/Blocks/Agent/types.d.ts +3 -8
  7. package/dist/src/lib/components/Blocks/CallbotCustomer/types.d.ts +1 -1
  8. package/dist/src/lib/components/Blocks/Listen/components/DraggableItem.d.ts +2 -2
  9. package/dist/src/lib/components/Blocks/Listen/components/ListCondition.d.ts +1 -2
  10. package/dist/src/lib/components/Blocks/Listen/settings/FormAddCondition.d.ts +3 -3
  11. package/dist/src/lib/components/Blocks/Listen/types.d.ts +2 -7
  12. package/dist/src/lib/components/Scripts/components/resource-cms/intention/CreateButton.d.ts +11 -1
  13. package/dist/src/lib/components/Scripts/components/resource-cms/intention/Intention.d.ts +1 -2
  14. package/dist/src/lib/components/Selector/Campaign/index.d.ts +5 -5
  15. package/dist/src/lib/components/Shared/CallCampaignCustomerFilter/helper.d.ts +40 -0
  16. package/dist/src/lib/components/Shared/CallCampaignCustomerFilter/index.css.d.ts +13 -0
  17. package/dist/src/lib/components/Shared/CallCampaignCustomerFilter/index.d.ts +9 -0
  18. package/dist/src/lib/constants/initial-script.d.ts +8 -8
  19. package/dist/src/lib/constants/intents.d.ts +11 -6
  20. package/dist/src/lib/hooks/use-alerts/utils/check-auto-call-node-input.d.ts +7 -0
  21. package/dist/src/lib/hooks/use-alerts/utils/check-block-speak.d.ts +1 -1
  22. package/dist/src/lib/hooks/use-sync-node-data-array-item/index.d.ts +9 -0
  23. package/dist/src/lib/utils/node-intent-condition.d.ts +3 -0
  24. package/dist/src/services/campaign/useGetListCampaign.d.ts +18 -5
  25. package/dist/src/services/campaign/useListFilterFieldCallCampaign.d.ts +5 -0
  26. package/dist/src/services/intent/useCreateIntent.d.ts +7 -0
  27. package/dist/src/services/intent/useDeleteIntent.d.ts +8 -0
  28. package/dist/src/services/intent/useGetListIntent.d.ts +9 -0
  29. package/dist/src/services/intent/useUpdateIntent.d.ts +8 -0
  30. package/dist/src/services/types.d.ts +24 -0
  31. package/package.json +1 -1
  32. package/dist/src/lib/components/Blocks/Listen/settings/ListenIntent.d.ts +0 -8
@@ -1,4 +1,3 @@
1
1
  import { default as React } from 'react';
2
- type ListConditionContainerProps = {};
3
- declare const ListConditionContainer: React.FC<ListConditionContainerProps>;
2
+ declare const ListConditionContainer: React.FC;
4
3
  export default ListConditionContainer;
@@ -1,8 +1,11 @@
1
1
  import { AgentCondition } from '../types';
2
2
  interface AgentIntentProps {
3
- field: any;
3
+ field: {
4
+ key: string | number;
5
+ name: number;
6
+ };
4
7
  condition: AgentCondition;
5
- onDelete: (conditionId: string) => void;
8
+ onDelete: (conditionId: string | number) => void;
6
9
  }
7
10
  declare const AgentIntent: ({ field, condition, onDelete }: AgentIntentProps) => import("react/jsx-runtime").JSX.Element;
8
11
  export default AgentIntent;
@@ -1,12 +1,7 @@
1
1
  import { Node, NodeProps } from '@xyflow/react';
2
2
  import { BlockTypeProps } from '../../../constants';
3
- export interface AgentCondition {
4
- id: string;
5
- label: string;
6
- description: string;
7
- keywords: string[];
8
- is_conversion: boolean;
9
- }
3
+ import { NodeIntentCondition } from '../../../utils/node-intent-condition';
4
+ export type AgentCondition = NodeIntentCondition;
10
5
  export interface AgentNodeData extends Record<string, unknown> {
11
6
  title?: string;
12
7
  conditions?: AgentCondition[];
@@ -16,7 +11,7 @@ export interface AgentNodeData extends Record<string, unknown> {
16
11
  using_knowledge: boolean;
17
12
  switch_to_different_global_node: boolean;
18
13
  exit_after_each_speech: boolean;
19
- variables: any[];
14
+ variables: Record<string, unknown>[];
20
15
  }
21
16
  export type BlockAgentProps = BlockTypeProps<AgentNodeData>;
22
17
  export type AgentNodeProps = NodeProps<Node<AgentNodeData>>;
@@ -17,7 +17,7 @@ export declare const CallbotCustomerTypeList: CALLBOT_CUSTOMER_ACTION_TYPE[];
17
17
  export interface CallbotCustomerNodeData extends INodeBaseType, Record<string, unknown> {
18
18
  title: string;
19
19
  type: CALLBOT_CUSTOMER_ACTION_TYPE;
20
- id?: string;
20
+ id?: string[];
21
21
  filter_type?: "AND" | "OR";
22
22
  groups?: IFilterGroup[];
23
23
  object?: string;
@@ -1,5 +1,5 @@
1
- import { ListenCondition } from '../types';
1
+ import { IIntent } from '../../../../../services';
2
2
  declare const SortableItem: React.FC<{
3
- item: ListenCondition;
3
+ item: IIntent;
4
4
  }>;
5
5
  export default SortableItem;
@@ -1,4 +1,3 @@
1
1
  import { default as React } from 'react';
2
- type ListConditionContainerProps = {};
3
- declare const ListConditionContainer: React.FC<ListConditionContainerProps>;
2
+ declare const ListConditionContainer: React.FC;
4
3
  export default ListConditionContainer;
@@ -1,7 +1,7 @@
1
- import { ListenCondition } from '../types';
1
+ import { IIntent } from '../../../../../services';
2
2
  type FormAddListenConditionProps = {
3
- dataSubmit?: (data: ListenCondition) => void;
4
- defaultValues?: ListenCondition;
3
+ dataSubmit?: (data: IIntent) => void;
4
+ defaultValues?: IIntent;
5
5
  onFormSubmit?: () => void;
6
6
  };
7
7
  export type FormAddListenConditionMethods = {
@@ -1,12 +1,7 @@
1
1
  import { Node, NodeProps } from '@xyflow/react';
2
2
  import { BlockTypeProps } from '../../../constants';
3
- export interface ListenCondition {
4
- id: string;
5
- label: string;
6
- description: string;
7
- keywords: string[];
8
- is_conversion: boolean;
9
- }
3
+ import { NodeIntentCondition } from '../../../utils/node-intent-condition';
4
+ export type ListenCondition = NodeIntentCondition;
10
5
  export interface ListenNodeData extends Record<string, unknown> {
11
6
  title?: string;
12
7
  conditions?: ListenCondition[];
@@ -1,4 +1,14 @@
1
+ import { ButtonProps } from 'antd';
1
2
  import { default as React } from 'react';
2
- type CreateIntentionButtonContainerProps = {};
3
+ import { IIntent } from '../../../../../../services';
4
+ type CreateIntentionButtonContainerProps = {
5
+ initialValues?: IIntent;
6
+ modalTitle?: string;
7
+ submitText?: string;
8
+ buttonProps?: ButtonProps;
9
+ buttonText?: React.ReactNode;
10
+ loading?: boolean;
11
+ onSubmit?: (values: IIntent) => Promise<unknown> | unknown;
12
+ };
3
13
  declare const CreateIntentionButtonContainer: React.FC<CreateIntentionButtonContainerProps>;
4
14
  export default CreateIntentionButtonContainer;
@@ -1,4 +1,3 @@
1
1
  import { default as React } from 'react';
2
- type IntentionContainerProps = {};
3
- declare const IntentionContainer: React.FC<IntentionContainerProps>;
2
+ declare const IntentionContainer: React.FC;
4
3
  export default IntentionContainer;
@@ -1,8 +1,8 @@
1
- import { SelectProps } from 'antd/es/select';
1
+ import { SelectProps } from 'antd';
2
+ import { CampaignType } from '../../../../services/campaign/useGetListCampaign';
2
3
  type OptionFilterProps = {
3
- defaultValue?: string | string[] | null;
4
- operator?: string;
5
- type?: string;
4
+ types?: CampaignType[];
5
+ pageSize?: number;
6
6
  } & SelectProps;
7
- export declare const CampaignSelector: (props: OptionFilterProps) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const CampaignSelector: ({ types, pageSize, onPopupScroll: externalOnPopupScroll, onSearch: externalOnSearch, ...p }: OptionFilterProps) => import("react/jsx-runtime").JSX.Element;
8
8
  export default CampaignSelector;
@@ -0,0 +1,40 @@
1
+ import { SelectProps } from 'antd';
2
+ import { NamePath } from 'antd/es/form/interface';
3
+ import { FilterFieldsCallCampaignType } from '../../../../services';
4
+ import { DATA_TYPE_PROPERTY } from '../../../constants/common';
5
+ export declare const DEFAULT_CONDITION_LIST_NAME: NamePath;
6
+ export declare const DEFAULT_FILTER_TYPE_NAME: NamePath;
7
+ type FieldChoice = NonNullable<FilterFieldsCallCampaignType[string]["choices"]>[number];
8
+ type PathSegment = string | number;
9
+ export type CallCampaignField = {
10
+ field: string;
11
+ name: string;
12
+ type: string;
13
+ choices: FieldChoice[];
14
+ };
15
+ export type CallCampaignConditionFieldKey = "field" | "field_name" | "field_type" | "operator" | "value" | "dateType";
16
+ export declare const normalizeFilterFieldsData: (data: unknown) => CallCampaignField[];
17
+ export declare const buildFieldMap: (fields: CallCampaignField[]) => Map<string, CallCampaignField>;
18
+ export declare const buildFieldOptions: (fields: CallCampaignField[]) => SelectProps["options"];
19
+ export declare const buildFixedSelectOptions: (field?: CallCampaignField) => SelectProps["options"];
20
+ export declare const getOperatorOptionsForField: (field?: CallCampaignField) => SelectProps["options"];
21
+ export declare const isDateField: (field?: CallCampaignField) => boolean;
22
+ export declare const isNumericField: (field?: CallCampaignField) => boolean;
23
+ export declare const isEmployeeField: (field?: CallCampaignField) => boolean;
24
+ export declare const isFixedSelectField: (field?: CallCampaignField) => boolean;
25
+ export declare const isValueDisabled: (operator?: string) => operator is "VALUABLE" | "EMPTY";
26
+ export declare const isMultiValueOperator: (operator?: string) => operator is "CONTAIN" | "NOT_CONTAIN";
27
+ export declare const getSelectValueProps: (operator?: string) => {
28
+ mode?: undefined;
29
+ maxTagCount?: undefined;
30
+ } | {
31
+ mode: "multiple";
32
+ maxTagCount: number;
33
+ };
34
+ export declare const getVariableFilterTypes: (field?: CallCampaignField) => DATA_TYPE_PROPERTY[];
35
+ export declare const toNamePathArray: (name: NamePath) => PathSegment[];
36
+ export declare const resolveConditionItemPath: (name: NamePath, itemName: number) => PathSegment[];
37
+ export declare const resolveConditionFieldPath: (name: NamePath, itemName: number, key: CallCampaignConditionFieldKey) => (string | number)[];
38
+ export declare const resolveFilterTypePath: (name?: NamePath) => PathSegment[];
39
+ export declare const getDefaultDateType: (field?: CallCampaignField) => string;
40
+ export {};
@@ -0,0 +1,13 @@
1
+ export declare const Container: string;
2
+ export declare const Header: string;
3
+ export declare const FilterTypeGroup: string;
4
+ export declare const FormItem: string;
5
+ export declare const FilterTypeSelect: string;
6
+ export declare const ConditionList: string;
7
+ export declare const ConditionRow: string;
8
+ export declare const HiddenField: string;
9
+ export declare const ValueCell: string;
10
+ export declare const DateValueGroup: string;
11
+ export declare const ActionColumn: string;
12
+ export declare const IconButton: string;
13
+ export declare const AddButton: string;
@@ -0,0 +1,9 @@
1
+ import { NamePath } from 'antd/es/form/interface';
2
+ import { default as React } from 'react';
3
+ type CallCampaignCustomerContainerProps = {
4
+ id: string[];
5
+ name?: NamePath;
6
+ filterTypeName?: NamePath;
7
+ };
8
+ declare const CallCampaignCustomerContainer: React.FC<CallCampaignCustomerContainerProps>;
9
+ export default CallCampaignCustomerContainer;
@@ -1,4 +1,4 @@
1
- import { Node } from '@xyflow/react';
1
+ import { Edge, Node } from '@xyflow/react';
2
2
  import { SPEAK_TYPE, TRANSFER_TYPE } from './block-types';
3
3
  export declare const initialTitles: {
4
4
  AGENT: string;
@@ -26,10 +26,10 @@ export declare const initialTitles: {
26
26
  export declare const initialData: {
27
27
  AGENT: {
28
28
  conditions: {
29
- id: string;
30
- label: string;
29
+ name: string;
31
30
  description: string;
32
- keywords: any[];
31
+ keywords: string;
32
+ id: string;
33
33
  is_conversion: boolean;
34
34
  }[];
35
35
  };
@@ -55,10 +55,10 @@ export declare const initialData: {
55
55
  };
56
56
  LISTEN: {
57
57
  conditions: {
58
- id: string;
59
- label: string;
58
+ name: string;
60
59
  description: string;
61
- keywords: any[];
60
+ keywords: string;
61
+ id: string;
62
62
  is_conversion: boolean;
63
63
  }[];
64
64
  maximum_retry: number;
@@ -120,7 +120,7 @@ export declare const initialData: {
120
120
  };
121
121
  };
122
122
  export declare const initialNodes: Node[];
123
- export declare const initialEdges: any[];
123
+ export declare const initialEdges: Edge[];
124
124
  export declare const initialNodeProps: {
125
125
  LISTEN: {
126
126
  dragHandle: string;
@@ -1,31 +1,36 @@
1
1
  export declare const INTENTS: {
2
2
  INTERESTED: {
3
- label: string;
3
+ name: string;
4
4
  description: string;
5
5
  keywords: string;
6
6
  };
7
7
  NOT_INTERESTED: {
8
- label: string;
8
+ name: string;
9
9
  description: string;
10
10
  keywords: string;
11
11
  };
12
12
  NOT_HEARD: {
13
- label: string;
13
+ name: string;
14
14
  description: string;
15
15
  keywords: string;
16
16
  };
17
17
  BUSY: {
18
- label: string;
18
+ name: string;
19
19
  description: string;
20
20
  keywords: string;
21
21
  };
22
22
  SILENT: {
23
- label: string;
23
+ name: string;
24
24
  description: string;
25
25
  keywords: string;
26
26
  };
27
27
  UNRECOGNIZED: {
28
- label: string;
28
+ name: string;
29
+ description: string;
30
+ keywords: string;
31
+ };
32
+ DEFAULT: {
33
+ name: string;
29
34
  description: string;
30
35
  keywords: string;
31
36
  };
@@ -0,0 +1,7 @@
1
+ import { Node } from '@xyflow/react';
2
+ import { AlertCheckContext } from './check-deleted-variables';
3
+ declare const checkAutoCallNodeInput: (node: Node, context: AlertCheckContext) => {
4
+ errors: any[];
5
+ infos: any[];
6
+ };
7
+ export default checkAutoCallNodeInput;
@@ -1,6 +1,6 @@
1
1
  import { SpeakNodeData } from '../../../components/Blocks/Speak/types';
2
2
  import { AlertCheckContext } from './check-deleted-variables';
3
- declare const checkBlockSpeak: (data: SpeakNodeData, context: AlertCheckContext) => {
3
+ declare const checkBlockSpeak: (data: SpeakNodeData, _context: AlertCheckContext) => {
4
4
  errors: any[];
5
5
  infos: any[];
6
6
  };
@@ -0,0 +1,9 @@
1
+ type NodeDataArrayItemWithId = {
2
+ id?: string | number;
3
+ };
4
+ type SyncNodeDataArrayItemByIdParams<TItem extends NodeDataArrayItemWithId> = {
5
+ dataKey: string;
6
+ item: TItem;
7
+ };
8
+ export declare function useSyncNodeDataArrayItemById(): <TItem extends NodeDataArrayItemWithId>({ dataKey, item }: SyncNodeDataArrayItemByIdParams<TItem>) => void;
9
+ export default useSyncNodeDataArrayItemById;
@@ -0,0 +1,3 @@
1
+ import { IIntent } from '../../services';
2
+ export type NodeIntentCondition = Pick<IIntent, "id" | "name" | "description" | "keywords" | "is_conversion">;
3
+ export declare const pickNodeIntentCondition: (intent: IIntent) => NodeIntentCondition;
@@ -1,8 +1,21 @@
1
- import { IPaginationInputs } from '../types';
2
- interface IParams extends IPaginationInputs {
1
+ import { AxiosError } from 'axios';
2
+ import { IPagination } from '../types';
3
+ export type CampaignType = "autocall" | "telesale" | "sms_campaign";
4
+ export interface CampaignItem {
5
+ id: string | number;
6
+ name: string;
7
+ [key: string]: unknown;
8
+ }
9
+ type CampaignPage = IPagination<CampaignItem> & {
10
+ campaignType: CampaignType;
11
+ currentPage: number;
12
+ typeIndex: number;
13
+ };
14
+ interface IParams {
3
15
  enable?: boolean;
4
- campaigns?: Record<string, boolean>;
5
- currentFilters?: Record<string, any>;
16
+ types?: CampaignType[];
17
+ pageSize?: number;
18
+ currentFilters?: Record<string, unknown>;
6
19
  }
7
- declare const useGetListCampaign: ({ currentFilters, pagination, enable, campaigns, }: IParams) => import('@tanstack/react-query').UseQueryResult<any[], Error>;
20
+ declare const useGetListCampaign: ({ currentFilters, enable, types, pageSize, }: IParams) => import('@tanstack/react-query').UseInfiniteQueryResult<import('@tanstack/react-query').InfiniteData<CampaignPage, unknown>, AxiosError<unknown, any>>;
8
21
  export default useGetListCampaign;
@@ -0,0 +1,5 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { FilterFieldsCallCampaignType } from '../types';
3
+ export declare const filterFieldsCallCampaign = "filter-field-call-campaign";
4
+ declare const useFilterFieldsCallCampaign: (ids?: string[]) => import('@tanstack/react-query').UseQueryResult<AxiosResponse<FilterFieldsCallCampaignType, any>, Error>;
5
+ export default useFilterFieldsCallCampaign;
@@ -0,0 +1,7 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ import { IIntent } from '../../lib';
3
+ type Variables = Pick<IIntent, "name" | "description" | "keywords" | "is_conversion"> & {
4
+ SCENARIO_ID: string;
5
+ };
6
+ declare function useCreateIntent(): import('@tanstack/react-query').UseMutationResult<AxiosResponse<IIntent, any>, AxiosError<unknown, any>, Variables, unknown>;
7
+ export default useCreateIntent;
@@ -0,0 +1,8 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ import { IIntent } from '../types';
3
+ type Variables = {
4
+ SCENARIO_ID: string;
5
+ INTENT_ID: string;
6
+ };
7
+ declare function useDeleteIntent(): import('@tanstack/react-query').UseMutationResult<AxiosResponse<IIntent, any>, AxiosError<unknown, any>, Variables, unknown>;
8
+ export default useDeleteIntent;
@@ -0,0 +1,9 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ import { IIntent } from '../../lib';
3
+ export declare const getListIntentQueryKey: (COMPANY_ID?: string, SCENARIO_ID?: string) => readonly ["get_list_intent_key", string, string];
4
+ type Props = {
5
+ SCENARIO_ID: string;
6
+ enabled?: boolean;
7
+ };
8
+ declare function useGetListIntent({ SCENARIO_ID, enabled }: Props): import('@tanstack/react-query').UseQueryResult<AxiosResponse<IIntent[], any>, AxiosError<unknown, any>>;
9
+ export default useGetListIntent;
@@ -0,0 +1,8 @@
1
+ import { AxiosError, AxiosResponse } from 'axios';
2
+ import { IIntent } from '../types';
3
+ type Variables = Pick<IIntent, "name" | "description" | "keywords" | "is_conversion"> & {
4
+ SCENARIO_ID: string;
5
+ INTENT_ID: string;
6
+ };
7
+ declare function useUpdateIntent(): import('@tanstack/react-query').UseMutationResult<AxiosResponse<IIntent, any>, AxiosError<unknown, any>, Variables, unknown>;
8
+ export default useUpdateIntent;
@@ -352,3 +352,27 @@ export interface IHotline {
352
352
  updated_at: string;
353
353
  created_at: string;
354
354
  }
355
+ export interface FilterFieldsCallCampaignType {
356
+ [key: string]: {
357
+ field?: string;
358
+ name?: string;
359
+ type?: string;
360
+ choices?: {
361
+ id?: string;
362
+ text?: string;
363
+ }[];
364
+ };
365
+ }
366
+ export interface IIntent {
367
+ id?: string | number;
368
+ slug?: string;
369
+ name?: string;
370
+ description?: string;
371
+ keywords?: string;
372
+ is_conversion?: boolean;
373
+ is_using?: boolean;
374
+ block_using?: {
375
+ node_id?: string;
376
+ node_title?: string;
377
+ }[];
378
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "app-v3-scripts-editor",
3
3
  "private": false,
4
- "version": "1.29.1",
4
+ "version": "1.29.3",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/ucall-asia/app-v3-scripts-editor.git"
@@ -1,8 +0,0 @@
1
- import { ListenCondition } from '../types';
2
- interface ListenIntentProps {
3
- field: any;
4
- condition: ListenCondition;
5
- onDelete: (conditionId: string) => void;
6
- }
7
- declare const ListenIntent: ({ field, condition, onDelete }: ListenIntentProps) => import("react/jsx-runtime").JSX.Element;
8
- export default ListenIntent;