@antscorp/antsomi-ui 1.3.6-beta.4 → 1.3.6-beta.41

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 (122) hide show
  1. package/es/components/atoms/Input/Input.d.ts +11 -17
  2. package/es/components/atoms/Input/Input.js +7 -11
  3. package/es/components/atoms/SelectAssociatedTag/constants.d.ts +1 -1
  4. package/es/components/atoms/SelectAssociatedTag/constants.js +4 -4
  5. package/es/components/atoms/Switch/Switch.js +2 -1
  6. package/es/components/icons/LazyIcon/LazyIcon.d.ts +3 -0
  7. package/es/components/icons/LazyIcon/LazyIcon.js +3 -0
  8. package/es/components/icons/TaskAltIcon.d.ts +3 -0
  9. package/es/components/icons/TaskAltIcon.js +7 -0
  10. package/es/components/icons/UnsubscribeIcon.d.ts +3 -0
  11. package/es/components/icons/UnsubscribeIcon.js +7 -0
  12. package/es/components/icons/UnsubscribersIcon.d.ts +3 -0
  13. package/es/components/icons/UnsubscribersIcon.js +7 -0
  14. package/es/components/icons/index.d.ts +3 -0
  15. package/es/components/icons/index.js +3 -0
  16. package/es/components/molecules/CodeStructure/CodeStructure.d.ts +23 -2
  17. package/es/components/molecules/CodeStructure/CodeStructure.js +136 -26
  18. package/es/components/molecules/CodeStructure/constants.js +2 -2
  19. package/es/components/molecules/CodeStructure/styled.d.ts +3 -0
  20. package/es/components/molecules/CodeStructure/styled.js +6 -0
  21. package/es/components/molecules/CodeStructure/type.d.ts +2 -2
  22. package/es/components/molecules/CodeStructure/type.js +2 -2
  23. package/es/components/molecules/CodeStructure/utils.d.ts +12 -2
  24. package/es/components/molecules/CodeStructure/utils.js +5 -3
  25. package/es/components/molecules/DrawerDetail/DrawerDetail.js +10 -5
  26. package/es/components/molecules/DrawerDetail/types.d.ts +1 -0
  27. package/es/components/molecules/Dropdown/style.scss +6 -4
  28. package/es/components/molecules/EditingListV2/EditingList.js +5 -2
  29. package/es/components/molecules/EditingListV2/components/List/List.js +16 -6
  30. package/es/components/molecules/EditingListV2/components/Loadable.d.ts +0 -6
  31. package/es/components/molecules/EditingListV2/components/Loadable.js +0 -1
  32. package/es/components/molecules/EditingListV2/components/Popover/Popover.js +6 -12
  33. package/es/components/molecules/EditingListV2/components/index.d.ts +0 -3
  34. package/es/components/molecules/EditingListV2/components/index.js +0 -3
  35. package/es/components/molecules/EditingListV2/types.d.ts +2 -0
  36. package/es/components/molecules/InputSelectAttribute/index.js +5 -2
  37. package/es/components/molecules/InputSelectAttribute/styled.js +7 -2
  38. package/es/components/molecules/SearchPopover/SearchPopover.d.ts +0 -1
  39. package/es/components/molecules/SearchPopover/SearchPopover.js +1 -2
  40. package/es/components/molecules/SearchPopover/components/PopoverAddField/PopoverAddField.js +2 -2
  41. package/es/components/molecules/SearchPopover/components/PopoverSelect/PopoverSelect.js +2 -2
  42. package/es/components/molecules/SearchPopover/types.d.ts +1 -0
  43. package/es/components/molecules/TagifyInput/TagifyInput.js +27 -10
  44. package/es/components/molecules/TagifyInput/constants.d.ts +2 -1
  45. package/es/components/molecules/TagifyInput/constants.js +2 -1
  46. package/es/components/molecules/TagifyInput/utils.js +5 -2
  47. package/es/components/molecules/TagifyInput/utils.style.js +3 -2
  48. package/es/components/molecules/UploadImage/index.d.ts +102 -3
  49. package/es/components/molecules/UploadImage/index.js +48 -110
  50. package/es/components/molecules/UploadImage/styled.d.ts +2 -1
  51. package/es/components/molecules/VirtualizedMenu/types.d.ts +1 -0
  52. package/es/components/organism/TicketEditorV2/Content.d.ts +27 -0
  53. package/es/components/organism/TicketEditorV2/Content.js +296 -0
  54. package/es/components/organism/TicketEditorV2/Service.d.ts +49 -0
  55. package/es/components/organism/TicketEditorV2/Service.js +58 -0
  56. package/es/components/organism/TicketEditorV2/TicketEditorV2.d.ts +20 -0
  57. package/es/components/organism/TicketEditorV2/TicketEditorV2.js +124 -0
  58. package/es/components/organism/TicketEditorV2/components/DropdownComponent.d.ts +9 -0
  59. package/es/components/organism/TicketEditorV2/components/DropdownComponent.js +45 -0
  60. package/es/components/organism/TicketEditorV2/components/Message.d.ts +2 -0
  61. package/es/components/organism/TicketEditorV2/components/Message.js +31 -0
  62. package/es/components/organism/TicketEditorV2/components/MessageComponent.d.ts +10 -0
  63. package/es/components/organism/TicketEditorV2/components/MessageComponent.js +64 -0
  64. package/es/components/organism/TicketEditorV2/components/icons/AddTicketIcon.d.ts +2 -0
  65. package/es/components/organism/TicketEditorV2/components/icons/AddTicketIcon.js +5 -0
  66. package/es/components/organism/TicketEditorV2/components/icons/TicketIcon.d.ts +2 -0
  67. package/es/components/organism/TicketEditorV2/components/icons/TicketIcon.js +5 -0
  68. package/es/components/organism/TicketEditorV2/constant.d.ts +17 -0
  69. package/es/components/organism/TicketEditorV2/constant.js +17 -0
  70. package/es/components/organism/TicketEditorV2/constants/index.d.ts +1 -0
  71. package/es/components/organism/TicketEditorV2/constants/index.js +1 -0
  72. package/es/components/organism/TicketEditorV2/constants/queryKeys.d.ts +5 -0
  73. package/es/components/organism/TicketEditorV2/constants/queryKeys.js +5 -0
  74. package/es/components/organism/TicketEditorV2/index.d.ts +1 -0
  75. package/es/components/organism/TicketEditorV2/index.js +1 -0
  76. package/es/components/organism/TicketEditorV2/queries/index.d.ts +3 -0
  77. package/es/components/organism/TicketEditorV2/queries/index.js +3 -0
  78. package/es/components/organism/TicketEditorV2/queries/useGetDetailTicket.d.ts +12 -0
  79. package/es/components/organism/TicketEditorV2/queries/useGetDetailTicket.js +14 -0
  80. package/es/components/organism/TicketEditorV2/queries/useGetListComments.d.ts +13 -0
  81. package/es/components/organism/TicketEditorV2/queries/useGetListComments.js +18 -0
  82. package/es/components/organism/TicketEditorV2/queries/useGetListUser.d.ts +11 -0
  83. package/es/components/organism/TicketEditorV2/queries/useGetListUser.js +14 -0
  84. package/es/components/organism/TicketEditorV2/styled.d.ts +54 -0
  85. package/es/components/organism/TicketEditorV2/styled.js +871 -0
  86. package/es/components/organism/TicketEditorV2/util.d.ts +46 -0
  87. package/es/components/organism/TicketEditorV2/util.js +408 -0
  88. package/es/components/organism/index.d.ts +1 -0
  89. package/es/components/organism/index.js +1 -0
  90. package/es/constants/queries.d.ts +1 -0
  91. package/es/constants/queries.js +1 -0
  92. package/es/locales/en/translation.json +2 -1
  93. package/es/locales/i18n.d.ts +2 -0
  94. package/es/locales/vi/translation.json +2 -1
  95. package/es/queries/ThirdParty/index.d.ts +1 -0
  96. package/es/queries/ThirdParty/index.js +1 -0
  97. package/es/queries/ThirdParty/useStoreSavedMedia.d.ts +1 -0
  98. package/es/queries/ThirdParty/useStoreSavedMedia.js +12 -0
  99. package/es/queries/index.d.ts +0 -1
  100. package/es/queries/index.js +0 -1
  101. package/es/services/MediaTemplateDesign/UploadFile/index.d.ts +1 -1
  102. package/es/services/MediaTemplateDesign/UploadFile/index.js +2 -2
  103. package/package.json +2 -2
  104. package/es/components/molecules/EditingListV2/components/Action/Action.d.ts +0 -6
  105. package/es/components/molecules/EditingListV2/components/Action/Action.js +0 -10
  106. package/es/components/molecules/EditingListV2/components/Action/index.d.ts +0 -1
  107. package/es/components/molecules/EditingListV2/components/Action/index.js +0 -1
  108. package/es/components/molecules/EditingListV2/components/Search/Search.d.ts +0 -4
  109. package/es/components/molecules/EditingListV2/components/Search/Search.js +0 -8
  110. package/es/components/molecules/EditingListV2/components/Search/index.d.ts +0 -1
  111. package/es/components/molecules/EditingListV2/components/Search/index.js +0 -1
  112. package/es/components/molecules/EditingListV2/components/Title/Title.d.ts +0 -9
  113. package/es/components/molecules/EditingListV2/components/Title/Title.js +0 -16
  114. package/es/components/molecules/EditingListV2/components/Title/index.d.ts +0 -1
  115. package/es/components/molecules/EditingListV2/components/Title/index.js +0 -1
  116. package/es/components/molecules/EditingListV2/styled.d.ts +0 -5
  117. package/es/components/molecules/EditingListV2/styled.js +0 -38
  118. package/es/components/molecules/SearchPopover/styles.scss +0 -7
  119. package/es/queries/Media/index.d.ts +0 -1
  120. package/es/queries/Media/index.js +0 -1
  121. package/es/queries/Media/useGetListingSavedMedia.d.ts +0 -12
  122. package/es/queries/Media/useGetListingSavedMedia.js +0 -15
@@ -1,6 +1,5 @@
1
- /// <reference types="hoist-non-react-statics" />
2
1
  import React, { ReactNode } from 'react';
3
- import { InputProps as AntdInputProps, Input as AntdInput, InputRef } from 'antd';
2
+ import { InputProps as AntdInputProps, InputRef } from 'antd';
4
3
  export interface InputProps extends AntdInputProps {
5
4
  noborder?: 'true' | 'false' | boolean;
6
5
  debounce?: number;
@@ -16,20 +15,15 @@ export interface InputProps extends AntdInputProps {
16
15
  disableUndo?: boolean;
17
16
  withWrapper?: boolean;
18
17
  }
19
- export declare const Input: string & import("styled-components").StyledComponentBase<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<InputRef>> & {
20
- Group: React.FC<import("antd/es/input").GroupProps>;
21
- Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<InputRef>>;
22
- TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
23
- Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<InputRef>>;
24
- }, any, InputProps, never> & import("hoist-non-react-statics").NonReactStatics<React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<InputRef>> & {
25
- Group: React.FC<import("antd/es/input").GroupProps>;
26
- Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<InputRef>>;
27
- TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
28
- Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<InputRef>>;
29
- }, {}> & {
30
- DefaultInput: typeof AntdInput;
31
- CustomSearch: typeof SearchInput;
18
+ export declare const Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>> & {
19
+ readonly DefaultInput: React.ForwardRefExoticComponent<AntdInputProps & React.RefAttributes<InputRef>> & {
20
+ Group: React.FC<import("antd/es/input").GroupProps>;
21
+ Search: React.ForwardRefExoticComponent<import("antd/es/input").SearchProps & React.RefAttributes<InputRef>>;
22
+ TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
23
+ Password: React.ForwardRefExoticComponent<import("antd/es/input").PasswordProps & React.RefAttributes<InputRef>>;
24
+ };
25
+ readonly CustomSearch: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
26
+ readonly TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
27
+ readonly Password: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
32
28
  };
33
- declare const SearchInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<InputRef>>;
34
29
  export declare const TextArea: React.ForwardRefExoticComponent<import("antd/es/input").TextAreaProps & React.RefAttributes<import("antd/es/input/TextArea").TextAreaRef>>;
35
- export {};
@@ -17,7 +17,7 @@ import { PreviewVisibilityEyeIcon, VisibilityOffEyeIcon } from '../../icons';
17
17
  const PATH = '@antscorp/antsomi-ui/es/components/atoms/Input/Input.tsx';
18
18
  const OriginInput = React.forwardRef((props, ref) => {
19
19
  // Props
20
- const { withWrapper, debounce, errorArchive, required, labelColor, isReverseMask, isHideErrMessage, focused, label, onAfterChange, onChange, errorMsg, ...restProps } = props;
20
+ const { debounce = 400, isHideErrMessage = false, withWrapper = true, errorArchive, required, labelColor, isReverseMask, focused, label, onAfterChange, onChange, errorMsg, ...restProps } = props;
21
21
  // State
22
22
  const [value, setValue] = useState(props.value);
23
23
  const [isFocused, setFocused] = useState(false);
@@ -79,16 +79,12 @@ const OriginInput = React.forwardRef((props, ref) => {
79
79
  return content;
80
80
  return _jsx("div", { className: "input__wrapper", children: content });
81
81
  });
82
- OriginInput.defaultProps = {
83
- debounce: 400,
84
- isHideErrMessage: false,
85
- withWrapper: true,
86
- };
87
- export const Input = OriginInput;
88
82
  const SearchInput = React.forwardRef((props, ref) => (_jsx(OriginInput, { bordered: false, autoFocus: true, suffix: _jsx(Icon, { type: "icon-ants-search-2", size: 24, color: globalToken?.bw8 }), ...props, ref: ref, className: `${props.className} antsomi-search-input` })));
89
83
  const PasswordInput = React.forwardRef((props, ref) => (_jsx(AntdInput.Password, { iconRender: visible => visible ? (_jsx(StyledIconWrapper, { type: "text", children: _jsx(PreviewVisibilityEyeIcon, {}) })) : (_jsx(StyledIconWrapper, { type: "text", children: _jsx(VisibilityOffEyeIcon, {}) })), ...props, ref: ref })));
90
- Input.CustomSearch = SearchInput;
91
- Input.TextArea = StyledInput.TextArea;
92
- Input.DefaultInput = AntdInput;
93
- Input.Password = PasswordInput;
84
+ export const Input = Object.assign(OriginInput, {
85
+ DefaultInput: AntdInput,
86
+ CustomSearch: SearchInput,
87
+ TextArea: StyledInput.TextArea,
88
+ Password: PasswordInput,
89
+ });
94
90
  export const { TextArea } = StyledInput;
@@ -4,7 +4,7 @@ export declare const DEFAULT_TAGS: {
4
4
  readonly md5: "md5";
5
5
  readonly sha_256: "sha_256";
6
6
  readonly MD5: "MD5";
7
- readonly SHA_265: "SHA_265";
7
+ readonly SHA_256: "SHA_256";
8
8
  };
9
9
  export declare const DEFAULT_TAGS_OPTS: Record<string, TagItem>;
10
10
  export declare const DEFAULT_TAGS_LIST: TagItem[];
@@ -7,7 +7,7 @@ export const DEFAULT_TAGS = {
7
7
  md5: 'md5',
8
8
  sha_256: 'sha_256',
9
9
  MD5: 'MD5',
10
- SHA_265: 'SHA_265',
10
+ SHA_256: 'SHA_256',
11
11
  };
12
12
  export const DEFAULT_TAGS_OPTS = {
13
13
  RAW: { label: 'RAW', value: DEFAULT_TAGS.RAW, color: globalToken?.bw0, background: '#4CB4C9' },
@@ -20,8 +20,8 @@ export const DEFAULT_TAGS_OPTS = {
20
20
  },
21
21
  MD5: { label: 'MD5', value: DEFAULT_TAGS.MD5, color: globalToken?.bw0, background: '#3B8FDE' },
22
22
  SHA_265: {
23
- label: 'SHA265',
24
- value: DEFAULT_TAGS.SHA_265,
23
+ label: 'SHA-256',
24
+ value: DEFAULT_TAGS.SHA_256,
25
25
  color: globalToken?.bw0,
26
26
  background: '#12B800',
27
27
  },
@@ -35,7 +35,7 @@ export const defaultProps = {
35
35
  },
36
36
  selected: {
37
37
  tag: DEFAULT_TAGS.RAW,
38
- value: DEFAULT_TAGS.SHA_265,
38
+ value: DEFAULT_TAGS.SHA_256,
39
39
  },
40
40
  options: DEFAULT_TAGS_LIST,
41
41
  onSelect: () => { },
@@ -3,6 +3,7 @@ import { THEME } from '@antscorp/antsomi-ui/es/constants';
3
3
  import { StyledSwitch } from './styled';
4
4
  const Switch = props => {
5
5
  const { color = THEME.token?.colorPrimary || '#005eb8', style, ...rest } = props;
6
- return _jsx(StyledSwitch, { style: { ...style, '--switch-color': color }, ...rest });
6
+ const validatedColor = CSS.supports('color', color) ? color : THEME.token?.colorPrimary;
7
+ return _jsx(StyledSwitch, { style: { ...style, '--switch-color': validatedColor }, ...rest });
7
8
  };
8
9
  export { Switch };
@@ -346,6 +346,7 @@ export declare const LazyIcon: {
346
346
  TabGroupIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
347
347
  TableIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
348
348
  TableVer2Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
349
+ TaskAltIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
349
350
  TextIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
350
351
  ThirdPartyPluginV130Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
351
352
  ThirdPartyPluginV230Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
@@ -360,6 +361,8 @@ export declare const LazyIcon: {
360
361
  UnblockIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
361
362
  UndoIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
362
363
  Unknown30Icon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
364
+ UnsubscribeIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
365
+ UnsubscribersIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
363
366
  UploadIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
364
367
  UploadMenuIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
365
368
  UserActivityIcon: import("react").LazyExoticComponent<import("react").ForwardRefExoticComponent<import("../types").IconProps & import("react").RefAttributes<SVGSVGElement>>>;
@@ -352,6 +352,7 @@ export const LazyIcon = {
352
352
  TabGroupIcon: lazy(() => import('../TabGroupIcon').then(m => ({ default: m.TabGroupIcon }))),
353
353
  TableIcon: lazy(() => import('../TableIcon').then(m => ({ default: m.TableIcon }))),
354
354
  TableVer2Icon: lazy(() => import('../TableVer2Icon').then(m => ({ default: m.TableVer2Icon }))),
355
+ TaskAltIcon: lazy(() => import('../TaskAltIcon').then(m => ({ default: m.TaskAltIcon }))),
355
356
  TextIcon: lazy(() => import('../TextIcon').then(m => ({ default: m.TextIcon }))),
356
357
  ThirdPartyPluginV130Icon: lazy(() => import('../ThirdPartyPluginV130Icon').then(m => ({ default: m.ThirdPartyPluginV130Icon }))),
357
358
  ThirdPartyPluginV230Icon: lazy(() => import('../ThirdPartyPluginV230Icon').then(m => ({ default: m.ThirdPartyPluginV230Icon }))),
@@ -366,6 +367,8 @@ export const LazyIcon = {
366
367
  UnblockIcon: lazy(() => import('../UnblockIcon').then(m => ({ default: m.UnblockIcon }))),
367
368
  UndoIcon: lazy(() => import('../UndoIcon').then(m => ({ default: m.UndoIcon }))),
368
369
  Unknown30Icon: lazy(() => import('../Unknown30Icon').then(m => ({ default: m.Unknown30Icon }))),
370
+ UnsubscribeIcon: lazy(() => import('../UnsubscribeIcon').then(m => ({ default: m.UnsubscribeIcon }))),
371
+ UnsubscribersIcon: lazy(() => import('../UnsubscribersIcon').then(m => ({ default: m.UnsubscribersIcon }))),
369
372
  UploadIcon: lazy(() => import('../UploadIcon').then(m => ({ default: m.UploadIcon }))),
370
373
  UploadMenuIcon: lazy(() => import('../UploadMenuIcon').then(m => ({ default: m.UploadMenuIcon }))),
371
374
  UserActivityIcon: lazy(() => import('../UserActivityIcon').then(m => ({ default: m.UserActivityIcon }))),
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const TaskAltIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { useIcon } from './hooks/useIcon';
4
+ export const TaskAltIcon = forwardRef((props, ref) => {
5
+ const { width, height } = useIcon(props);
6
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 -960 960 960", fill: "currentColor", ...props, ref: ref, width: width, height: height, children: _jsx("path", { d: "M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q65 0 123 19t107 53l-58 59q-38-24-81-37.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-18-2-36t-6-35l65-65q11 32 17 66t6 70q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm-56-216L254-466l56-56 114 114 400-401 56 56-456 457Z" }) }));
7
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const UnsubscribeIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { useIcon } from './hooks/useIcon';
4
+ export const UnsubscribeIcon = forwardRef((props, ref) => {
5
+ const { width, height } = useIcon(props);
6
+ return (_jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 -960 960 960", fill: "currentColor", ...props, ref: ref, width: width, height: height, children: _jsx("path", { d: "M480-440 160-640v400h320q0 21 3 40.5t9 39.5H160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v228q-18-9-38.5-15t-41.5-9v-124L480-440Zm0-80 320-200H160l320 200ZM760-40q-83 0-141.5-58.5T560-240q0-83 58.5-141.5T760-440q83 0 141.5 58.5T960-240q0 83-58.5 141.5T760-40ZM640-220h240v-40H640v40Zm-480-20v-480 480Z" }) }));
7
+ });
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import { IconProps } from './types';
3
+ export declare const UnsubscribersIcon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { useIcon } from './hooks/useIcon';
4
+ export const UnsubscribersIcon = forwardRef((props, ref) => {
5
+ const { width, height } = useIcon(props);
6
+ return (_jsx("svg", { viewBox: "0 0 30 30", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props, ref: ref, width: width, height: height, children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M16.2695 20.3125C16.2695 21.3145 16.4839 22.2665 16.8693 23.125H2.5V21.8945L5.01953 19.375V13.1641C5.01953 11.2109 5.50781 9.51172 6.48438 8.06641C7.5 6.62109 8.88672 5.68359 10.6445 5.25391V4.375C10.6445 3.86719 10.8203 3.4375 11.1719 3.08594C11.5234 2.69531 11.9727 2.5 12.5195 2.5C13.0664 2.5 13.5156 2.69531 13.8672 3.08594C14.2188 3.4375 14.3945 3.86719 14.3945 4.375V5.25391C16.1523 5.68359 17.5195 6.62109 18.4961 8.06641C19.5117 9.51172 20.0195 11.2109 20.0195 13.1641V14.1871C17.7935 15.3251 16.2695 17.6408 16.2695 20.3125ZM12.5195 26.875C11.8164 26.875 11.2109 26.6406 10.7031 26.1719C10.2344 25.7031 10 25.1172 10 24.4141H15.0391C15.0391 25.0781 14.7852 25.6641 14.2773 26.1719C13.7695 26.6406 13.1836 26.875 12.5195 26.875ZM28.7695 20.3125C28.7695 23.4191 26.2511 25.9375 23.1445 25.9375C20.0379 25.9375 17.5195 23.4191 17.5195 20.3125C17.5195 17.2059 20.0379 14.6875 23.1445 14.6875C26.2511 14.6875 28.7695 17.2059 28.7695 20.3125ZM26.2695 19.6875V20.9375H20.0195V19.6875H26.2695Z", fill: "currentColor" }) }));
7
+ });
@@ -342,6 +342,7 @@ export { SystemRunningIcon } from './SystemRunningIcon';
342
342
  export { TabGroupIcon } from './TabGroupIcon';
343
343
  export { TableIcon } from './TableIcon';
344
344
  export { TableVer2Icon } from './TableVer2Icon';
345
+ export { TaskAltIcon } from './TaskAltIcon';
345
346
  export { TextIcon } from './TextIcon';
346
347
  export { ThirdPartyPluginV130Icon } from './ThirdPartyPluginV130Icon';
347
348
  export { ThirdPartyPluginV230Icon } from './ThirdPartyPluginV230Icon';
@@ -356,6 +357,8 @@ export { TipsIdeaLight30Icon } from './TipsIdeaLight30Icon';
356
357
  export { UnblockIcon } from './UnblockIcon';
357
358
  export { UndoIcon } from './UndoIcon';
358
359
  export { Unknown30Icon } from './Unknown30Icon';
360
+ export { UnsubscribeIcon } from './UnsubscribeIcon';
361
+ export { UnsubscribersIcon } from './UnsubscribersIcon';
359
362
  export { UploadIcon } from './UploadIcon';
360
363
  export { UploadMenuIcon } from './UploadMenuIcon';
361
364
  export { UserActivityIcon } from './UserActivityIcon';
@@ -342,6 +342,7 @@ export { SystemRunningIcon } from './SystemRunningIcon';
342
342
  export { TabGroupIcon } from './TabGroupIcon';
343
343
  export { TableIcon } from './TableIcon';
344
344
  export { TableVer2Icon } from './TableVer2Icon';
345
+ export { TaskAltIcon } from './TaskAltIcon';
345
346
  export { TextIcon } from './TextIcon';
346
347
  export { ThirdPartyPluginV130Icon } from './ThirdPartyPluginV130Icon';
347
348
  export { ThirdPartyPluginV230Icon } from './ThirdPartyPluginV230Icon';
@@ -356,6 +357,8 @@ export { TipsIdeaLight30Icon } from './TipsIdeaLight30Icon';
356
357
  export { UnblockIcon } from './UnblockIcon';
357
358
  export { UndoIcon } from './UndoIcon';
358
359
  export { Unknown30Icon } from './Unknown30Icon';
360
+ export { UnsubscribeIcon } from './UnsubscribeIcon';
361
+ export { UnsubscribersIcon } from './UnsubscribersIcon';
359
362
  export { UploadIcon } from './UploadIcon';
360
363
  export { UploadMenuIcon } from './UploadMenuIcon';
361
364
  export { UserActivityIcon } from './UserActivityIcon';
@@ -1,11 +1,32 @@
1
1
  import React from 'react';
2
2
  import { CodeStructureData } from './type';
3
3
  interface CodeStructureProps {
4
- initialData: CodeStructureData;
4
+ initialData: Partial<CodeStructureData>;
5
5
  onChange: ({ data, isError }: {
6
- data: CodeStructureData;
6
+ data: Partial<CodeStructureData>;
7
7
  isError: boolean;
8
8
  }) => void;
9
9
  }
10
+ /**
11
+ * Component to configure the code structure for a pool rule.
12
+ *
13
+ * The component contains a form with fields for:
14
+ * - Prefix
15
+ * - Infix (character type, number of digits, number of letters, capitalization, character order)
16
+ * - Suffix
17
+ * - Separator
18
+ * - Quantity (number of codes per time)
19
+ * - Refill interval (manual or automatic)
20
+ * - Refill threshold (number of codes remaining)
21
+ * - Refill unit (codes or percent)
22
+ *
23
+ * The form also displays a preview of the generated code sample.
24
+ *
25
+ * The component calls the `onChange` callback with the updated form values and an `isError` flag
26
+ * indicating whether the form is valid or not.
27
+ *
28
+ * @param {CodeStructureProps} props The component props.
29
+ * @returns {React.ReactElement} The rendered component.
30
+ */
10
31
  export declare const CodeStructure: React.FC<CodeStructureProps>;
11
32
  export {};
@@ -1,20 +1,42 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // Libraries
3
- import { useEffect } from 'react';
3
+ import { memo, useEffect } from 'react';
4
4
  import { Form, InputNumber, Radio, Select, Typography, Flex, Input, Row, Col } from 'antd';
5
5
  import { useImmer } from 'use-immer';
6
6
  import { translate, translations } from '@antscorp/antsomi-locales';
7
+ import { isEmpty } from 'lodash';
7
8
  // Utils
8
9
  import { calculateTotalCodes, generateCodeWithPrefixAndSuffix, generateRandomCodeWithConfig, } from './utils';
9
10
  // Types
10
11
  import { CapitalizationType, CharacterOrderType, CharacterType, RefillType, RefillUnitType, SeparatorType, } from './type';
11
12
  // Constants
12
13
  import { CAPITALIZATION_OPTIONS, CHARACTER_ORDER_OPTIONS, CHARACTER_TYPE_OPTIONS, REFILL_UNIT_OPTIONS, SEPARATOR_OPTIONS, } from './constants';
13
- import { CodeStructureWrapper } from './styled';
14
+ import { BlockAbsolute, CodeStructureWrapper } from './styled';
14
15
  import { useDebouncedCallbackV2 } from '@antscorp/antsomi-ui/es/hooks';
15
16
  const { Title } = Typography;
16
- export const CodeStructure = ({ initialData, onChange }) => {
17
- const { characterType = CharacterType.DIGIT_AND_LETTERS, digitalNumbers = 2, alphabetLetters = 3, capitalization = CapitalizationType.UPPERCASE, characterOrder = CharacterOrderType.RANDOM, separator = SeparatorType.UNDERSCORE, quantity = 1, suffix = '', refillInterval = RefillType.MANUAL, prefix = '', refillThreshold = 10, refillUnit = RefillUnitType.CODES, } = initialData;
17
+ /**
18
+ * Component to configure the code structure for a pool rule.
19
+ *
20
+ * The component contains a form with fields for:
21
+ * - Prefix
22
+ * - Infix (character type, number of digits, number of letters, capitalization, character order)
23
+ * - Suffix
24
+ * - Separator
25
+ * - Quantity (number of codes per time)
26
+ * - Refill interval (manual or automatic)
27
+ * - Refill threshold (number of codes remaining)
28
+ * - Refill unit (codes or percent)
29
+ *
30
+ * The form also displays a preview of the generated code sample.
31
+ *
32
+ * The component calls the `onChange` callback with the updated form values and an `isError` flag
33
+ * indicating whether the form is valid or not.
34
+ *
35
+ * @param {CodeStructureProps} props The component props.
36
+ * @returns {React.ReactElement} The rendered component.
37
+ */
38
+ export const CodeStructure = memo(({ initialData, onChange }) => {
39
+ const { characterType = CharacterType.DIGIT_AND_LETTERS, digitalNumbers = 2, alphabetLetters = 3, capitalization = CapitalizationType.UPPERCASE, characterOrder = CharacterOrderType.RANDOM, separator = SeparatorType.UNDERSCORE, quantity = 50, suffix = '', refillInterval = RefillType.MANUAL, prefix = '', refillThreshold = 10, refillUnit = RefillUnitType.CODES, } = initialData;
18
40
  const [form] = Form.useForm();
19
41
  const [state, setState] = useImmer({
20
42
  codeSample: '',
@@ -42,7 +64,7 @@ export const CodeStructure = ({ initialData, onChange }) => {
42
64
  draft.codeWithPrefixAndSuffix = value;
43
65
  });
44
66
  };
45
- const debouncedOnChange = useDebouncedCallbackV2(onChange, 350);
67
+ const debouncedOnChange = useDebouncedCallbackV2(onChange, 400);
46
68
  const updateFormValues = async (fieldKeyChange, isError) => {
47
69
  // Get all values from the form
48
70
  const allValues = form.getFieldsValue();
@@ -63,18 +85,52 @@ export const CodeStructure = ({ initialData, onChange }) => {
63
85
  fieldKeyChange !== 'separator';
64
86
  const isChangePrefix = fieldKeyChange === 'suffix' || fieldKeyChange === 'prefix' || fieldKeyChange === 'separator';
65
87
  if (isRelevantChangeMaxCode) {
66
- const total = calculateTotalCodes(numLetters, numDigits, type);
88
+ const total = calculateTotalCodes({
89
+ numberOfLetters: characterType === CharacterType.DIGIT_AND_LETTERS ||
90
+ characterType === CharacterType.LETTERS
91
+ ? numLetters
92
+ : 0,
93
+ numberOfDigits: characterType === CharacterType.DIGITS ||
94
+ characterType === CharacterType.DIGIT_AND_LETTERS
95
+ ? numDigits
96
+ : 0,
97
+ characterType: type,
98
+ });
67
99
  totalPredicted = total;
68
100
  setMaxCodes(total);
69
101
  }
102
+ let codeSampleTmp = codeSample;
70
103
  if (isRelevantChangeCodeKey) {
71
- setCodeSample(generateRandomCodeWithConfig(form.getFieldsValue()));
104
+ codeSampleTmp = generateRandomCodeWithConfig(form.getFieldsValue());
105
+ setCodeSample(codeSampleTmp);
72
106
  }
73
107
  if (isChangePrefix) {
74
- setCodeWithPrefixAndSuffix(generateCodeWithPrefixAndSuffix(codeSample, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')));
108
+ setCodeWithPrefixAndSuffix(generateCodeWithPrefixAndSuffix(codeSampleTmp, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')));
75
109
  }
76
110
  const dataOnChange = {
77
- ...allValues,
111
+ quantity: allValues.quantity,
112
+ refillInterval: allValues.refillInterval,
113
+ prefix: allValues.prefix,
114
+ suffix: allValues.suffix,
115
+ separator: allValues.separator,
116
+ ...(allValues.refillInterval === 'auto' && {
117
+ refillThreshold: allValues.refillThreshold,
118
+ refillUnit: allValues.refillUnit,
119
+ }),
120
+ characterType: allValues.characterType,
121
+ ...(allValues.characterType === CharacterType.DIGIT_AND_LETTERS && {
122
+ digitalNumbers: allValues.digitalNumbers,
123
+ alphabetLetters: allValues.alphabetLetters,
124
+ capitalization: allValues.capitalization,
125
+ characterOrder: allValues.characterOrder,
126
+ }),
127
+ ...(allValues.characterType === CharacterType.DIGITS && {
128
+ digitalNumbers: allValues.digitalNumbers,
129
+ }),
130
+ ...(allValues.characterType === CharacterType.LETTERS && {
131
+ alphabetLetters: allValues.alphabetLetters,
132
+ capitalization: allValues.capitalization,
133
+ }),
78
134
  totalPredicted,
79
135
  };
80
136
  debouncedOnChange({
@@ -83,14 +139,46 @@ export const CodeStructure = ({ initialData, onChange }) => {
83
139
  });
84
140
  };
85
141
  useEffect(() => {
86
- setMaxCodes(calculateTotalCodes(alphabetLetters, digitalNumbers, characterType));
142
+ setMaxCodes(calculateTotalCodes({
143
+ numberOfLetters: characterType === CharacterType.DIGIT_AND_LETTERS ||
144
+ characterType === CharacterType.LETTERS
145
+ ? alphabetLetters
146
+ : 0,
147
+ numberOfDigits: characterType === CharacterType.DIGITS ||
148
+ characterType === CharacterType.DIGIT_AND_LETTERS
149
+ ? digitalNumbers
150
+ : 0,
151
+ characterType,
152
+ }));
87
153
  }, [alphabetLetters, digitalNumbers, characterType]);
88
154
  useEffect(() => {
89
- setCodeSample(generateRandomCodeWithConfig(initialData));
155
+ setCodeSample(generateRandomCodeWithConfig({
156
+ characterType,
157
+ digitalNumbers,
158
+ alphabetLetters,
159
+ capitalization,
160
+ characterOrder,
161
+ }));
90
162
  }, [characterType, digitalNumbers, alphabetLetters, capitalization, characterOrder]);
91
163
  useEffect(() => {
92
- form.setFieldsValue(initialData);
93
- }, [initialData, form]);
164
+ setCodeWithPrefixAndSuffix(generateCodeWithPrefixAndSuffix(codeSample, prefix, suffix, separator));
165
+ }, [codeSample, prefix, suffix, separator]);
166
+ useEffect(() => {
167
+ form.setFieldsValue({
168
+ prefix,
169
+ suffix,
170
+ separator,
171
+ quantity,
172
+ refillInterval,
173
+ refillThreshold,
174
+ refillUnit,
175
+ characterType,
176
+ digitalNumbers,
177
+ alphabetLetters,
178
+ capitalization,
179
+ characterOrder,
180
+ });
181
+ }, [initialData]);
94
182
  return (_jsx(CodeStructureWrapper, { children: _jsxs(Form, { form: form, layout: "horizontal", labelCol: { span: 6 }, colon: false, wrapperCol: { span: 24 }, labelAlign: "left", initialValues: {
95
183
  characterType,
96
184
  digitalNumbers,
@@ -108,30 +196,52 @@ export const CodeStructure = ({ initialData, onChange }) => {
108
196
  const fieldKeyChange = changedFields[0].name[0];
109
197
  const isValidate = form.getFieldsError().some(field => field.errors.length > 0);
110
198
  updateFormValues(fieldKeyChange, isValidate);
111
- }, children: [_jsx(Title, { level: 5, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE, 'Code Structure') }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_PREFIX, 'Prefix'), name: "prefix", children: _jsx(Input, { placeholder: "", style: {
199
+ }, children: [_jsx(Title, { style: { marginTop: 0 }, level: 5, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE, 'Coupon Code Structure') }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_PREFIX, 'Prefix'), name: "prefix", rules: [
200
+ {
201
+ pattern: /^[a-zA-Z0-9]+$/i,
202
+ message: translate(translations._POOL_SHOPIFY_VALIDATE_PRE_SUFF, 'Invalid input. Use only letters and numbers.'),
203
+ },
204
+ ], children: _jsx(Input, { placeholder: "", style: {
112
205
  maxWidth: 465,
113
- } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_INFIX, 'Infix') }), _jsx(Col, { span: 16, offset: 0, children: _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE, 'Character Type') }) }), _jsx(Form.Item, { name: "characterType", children: _jsx(Radio.Group, { options: CHARACTER_TYPE_OPTIONS }) })] }) })] }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "digitalNumbers", children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx("div", { style: { marginBottom: '15px' }, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_DIG_NO, 'digital numbers') })] }) }) }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { name: "alphabetLetters", children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '40px' } }) }), _jsx("div", { style: { marginBottom: '15px' }, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_LET_NO, 'alphabet letters') })] }) }) }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP, 'Letters Capitalization') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "capitalization", children: _jsx(Radio.Group, { options: CAPITALIZATION_OPTIONS }) })] }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER, 'Character Order') }) }), _jsx(Form.Item, { label: _jsx("span", { children: "\u00A0" }), name: "characterOrder", children: _jsx(Radio.Group, { options: CHARACTER_ORDER_OPTIONS }) })] }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SUFFIX, 'Suffix'), name: "suffix", children: _jsx(Input, { placeholder: "", style: {
206
+ } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_INFIX, 'Infix') }), _jsx(Col, { span: 16, offset: 0, children: _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: _jsx(Col, { offset: 0, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE, 'Character Type') }) }), _jsx(Form.Item, { name: "characterType", children: _jsx(Radio.Group, { options: CHARACTER_TYPE_OPTIONS }) })] }) })] }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", style: {
207
+ position: 'relative',
208
+ }, children: [_jsx(Form.Item, { hidden: form.getFieldValue('characterType') === CharacterType.LETTERS, shouldUpdate: true, name: "digitalNumbers", rules: [{ required: true, message: `This field can't be empty` }], children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '65px' } }) }), (form.getFieldValue('characterType') === CharacterType.DIGITS ||
209
+ form.getFieldValue('characterType') === CharacterType.DIGIT_AND_LETTERS) && (_jsx(BlockAbsolute, { children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_DIG_NO, 'digital numbers') }))] }) }) }), _jsx(Row, { children: _jsx(Col, { offset: 6, children: _jsxs(Flex, { gap: 10, align: "center", style: {
210
+ position: 'relative',
211
+ }, children: [_jsx(Form.Item, { hidden: form.getFieldValue('characterType') === CharacterType.DIGITS, name: "alphabetLetters", rules: [{ required: true, message: `This field can't be empty` }], children: _jsx(InputNumber, { min: 1, max: 50, style: { width: '65px' } }) }), (form.getFieldValue('characterType') === CharacterType.DIGIT_AND_LETTERS ||
212
+ form.getFieldValue('characterType') === CharacterType.LETTERS) && (_jsx(BlockAbsolute, { children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_TYPE_LET_NO, 'alphabet letters') }))] }) }) }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: form.getFieldValue('characterType') !== CharacterType.DIGITS && (_jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP, 'Letters Capitalization') })) }), _jsx(Form.Item, { hidden: form.getFieldValue('characterType') === CharacterType.DIGITS, label: _jsx("span", { children: "\u00A0" }), name: "capitalization", children: _jsx(Radio.Group, { options: CAPITALIZATION_OPTIONS }) })] }), _jsxs(Flex, { vertical: true, gap: 10, children: [_jsx(Row, { children: form.getFieldValue('characterType') === CharacterType.DIGIT_AND_LETTERS && (_jsx(Col, { offset: 6, children: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER, 'Character Order') })) }), _jsx(Form.Item, { hidden: form.getFieldValue('characterType') !== CharacterType.DIGIT_AND_LETTERS, label: _jsx("span", { children: "\u00A0" }), name: "characterOrder", children: _jsx(Radio.Group, { options: CHARACTER_ORDER_OPTIONS }) })] }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SUFFIX, 'Suffix'), name: "suffix", rules: [
213
+ {
214
+ pattern: /^[a-zA-Z0-9]+$/i,
215
+ message: translate(translations._POOL_SHOPIFY_VALIDATE_PRE_SUFF, 'Invalid input. Use only letters and numbers.'),
216
+ },
217
+ ], children: _jsx(Input, { placeholder: "", style: {
114
218
  maxWidth: 465,
115
- } }) }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SEPARATOR, 'Separator'), name: "separator", children: _jsx(Select, { options: SEPARATOR_OPTIONS, style: { width: '180px' } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, children: _jsxs(Flex, { justify: "start", align: "center", gap: 5, children: [translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_QUANTITY, 'Quantity'), ' ', _jsx("span", { style: { color: 'red' }, children: "*" })] }) }), _jsx(Col, { children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Form.Item, { required: true, name: "quantity", rules: [{ required: true }], children: _jsx(InputNumber, { min: 1, max: 10000 }) }), _jsx("div", { style: { marginBottom: '15px' }, children: "code(s) per time" })] }) })] }), _jsxs(Form.Item, { label: translate(translations._ACT_PREVIEW, 'Preview'), children: ["Maximum of ", _jsx("b", { children: maxCodes.toLocaleString() }), " codes (sample", ' ', generateCodeWithPrefixAndSuffix(codeSample, form.getFieldValue('prefix'), form.getFieldValue('suffix'), form.getFieldValue('separator')), ") to be generated"] }), _jsx(Title, { level: 5, children: "Code Refill" }), _jsx(Form.Item, { label: "Refill Interval", name: "refillInterval", children: _jsxs(Radio.Group, { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, children: [_jsx(Radio, { value: "manual", children: "Manual refill only" }), _jsx(Radio, { value: "auto", children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Typography.Text, { style: { whiteSpace: 'nowrap' }, children: "Add codes when less than" }), _jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: ({ getFieldValue }) => {
219
+ } }) }), _jsx(Form.Item, { label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_SEPARATOR, 'Separator'), name: "separator", children: _jsx(Select, { options: SEPARATOR_OPTIONS, style: { width: '180px' } }) }), _jsxs(Row, { children: [_jsx(Col, { span: 6, children: _jsxs(Flex, { justify: "start", align: "center", gap: 5, children: [translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_QUANTITY, 'Quantity'), ' ', _jsx("span", { style: { color: 'red' }, children: "*" })] }) }), _jsx(Col, { children: _jsxs(Flex, { gap: 10, align: "center", style: { position: 'relative' }, children: [_jsx(Form.Item, { required: true, name: "quantity", rules: [{ required: true, message: `This field can't be empty` }], children: _jsx(InputNumber, { min: 0, max: 10000, style: { width: '65px' } }) }), _jsx(BlockAbsolute, { children: translate(translations._POOL_SHOPIFY_CODE_PREVIEW_TEXT_5, 'code(s) per time') })] }) })] }), _jsx(Form.Item, { label: translate(translations._ACT_PREVIEW, 'Preview'), children: _jsxs(Typography.Text, { children: [translate(translations._POOL_SHOPIFY_CODE_PREVIEW_TEXT_1, 'Maximum of'), ' ', _jsx("b", { children: maxCodes.toLocaleString() }), ' ', translate(translations._POOL_SHOPIFY_CODE_PREVIEW_TEXT_2, 'codes'), " (", translate(translations._POOL_SHOPIFY_CODE_PREVIEW_TEXT_3, 'sample'), ' ', state.codeWithPrefixAndSuffix, " )", ' ', translate(translations._POOL_SHOPIFY_CODE_PREVIEW_TEXT_4, 'to be generated')] }) }), _jsx(Title, { style: { marginTop: 0 }, level: 5, children: translate(translations._POOL_SHOPIFY_CODE_REFILL, 'Code Refill') }), _jsx(Form.Item, { label: translate(translations._POOL_SHOPIFY_CODE_REFILL_INTERVAL, 'Refill Interval'), name: "refillInterval", children: _jsxs(Radio.Group, { style: { display: 'flex', flexDirection: 'column', gap: '10px' }, onChange: e => {
220
+ if (e.target.value === 'manual' && isEmpty(form.getFieldValue('refillThreshold'))) {
221
+ form.setFieldsValue({ refillThreshold: 10 });
222
+ form.validateFields(['refillThreshold']);
223
+ }
224
+ }, children: [_jsx(Radio, { value: "manual", children: translate(translations._POOL_SHOPIFY_CODE_REFILL_MANUAL, 'Manual refill only') }), _jsx(Radio, { value: "auto", children: _jsxs(Flex, { gap: 10, align: "center", children: [_jsx(Typography.Text, { style: { whiteSpace: 'nowrap' }, children: translate(translations._POOL_SHOPIFY_CODE_REFILL_AUTO, 'Add codes when less than') }), _jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: ({ getFieldValue }) => {
116
225
  const refillUnit = getFieldValue('refillUnit');
117
226
  return (_jsx(Form.Item, { name: "refillThreshold", noStyle: true, rules: [
118
227
  { required: true, message: '' },
119
228
  {
120
229
  validator: (_, value) => {
121
230
  if (refillUnit === RefillUnitType.PERCENT) {
122
- if (value < 1 || value > 100) {
123
- return Promise.reject(new Error(''));
124
- }
125
- }
126
- else if (refillUnit === RefillUnitType.CODES) {
127
- if (value < 0) {
128
- return Promise.reject(new Error(''));
231
+ if (value > 100) {
232
+ form.setFieldsValue({ refillThreshold: 100 });
129
233
  }
130
234
  }
131
235
  return Promise.resolve();
132
236
  },
133
237
  },
134
- ], children: _jsx(InputNumber, { min: refillUnit === RefillUnitType.CODES ? 0 : 1, max: refillUnit === RefillUnitType.PERCENT ? 100 : undefined, style: { width: '63px' } }) }));
238
+ ], children: _jsx(InputNumber, { onBlur: e => {
239
+ const { value } = e.target;
240
+ if (isEmpty(value)) {
241
+ form.setFieldsValue({ refillThreshold: 1 });
242
+ form.validateFields(['refillThreshold']);
243
+ }
244
+ }, min: 1, max: refillUnit === RefillUnitType.PERCENT ? 100 : undefined, style: { width: '63px' } }) }));
135
245
  } }), _jsx(Form.Item, { noStyle: true, shouldUpdate: true, children: () => (_jsx(Form.Item, { name: "refillUnit", noStyle: true, rules: [
136
246
  { required: true, message: '' },
137
247
  {
@@ -139,5 +249,5 @@ export const CodeStructure = ({ initialData, onChange }) => {
139
249
  form.validateFields(['refillThreshold']);
140
250
  },
141
251
  },
142
- ], children: _jsx(Select, { options: REFILL_UNIT_OPTIONS, style: { width: '63px' }, onClick: e => e.preventDefault() }) })) }), "remaining"] }) })] }) })] }) }));
143
- };
252
+ ], children: _jsx(Select, { defaultValue: RefillUnitType.CODES, options: REFILL_UNIT_OPTIONS, style: { width: '63px' }, onClick: e => e.preventDefault() }) })) }), translate(translations._POOL_SHOPIFY_CODE_REFILL_AUTO_TEXT, 'remaining')] }) })] }) })] }) }));
253
+ });
@@ -30,8 +30,8 @@ export const CAPITALIZATION_OPTIONS = [
30
30
  label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP_LOW, 'lowercase'),
31
31
  },
32
32
  {
33
- value: CapitalizationType.TITLE_CASE,
34
- label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CAP_TITL, 'Title case'),
33
+ value: CapitalizationType.RANDOM,
34
+ label: translate(translations._POOL_RULE_SETTING_CODE_STRUCTURE_CHAC_ORDER_RANDOM, 'Random'),
35
35
  },
36
36
  ];
37
37
  export const CHARACTER_ORDER_OPTIONS = [
@@ -1 +1,4 @@
1
1
  export declare const CodeStructureWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
2
+ export declare const BlockAbsolute: import("styled-components").StyledComponent<"div", any, {
3
+ left?: number | undefined;
4
+ }, never>;
@@ -1,2 +1,8 @@
1
1
  import styled from 'styled-components';
2
2
  export const CodeStructureWrapper = styled.div ``;
3
+ export const BlockAbsolute = styled.div `
4
+ position: absolute;
5
+ left: ${p => p.left || 75}px;
6
+ white-space: nowrap;
7
+ margin-bottom: 15px;
8
+ `;
@@ -11,7 +11,7 @@ export declare enum CharacterOrderType {
11
11
  export declare enum CapitalizationType {
12
12
  UPPERCASE = "upper",
13
13
  LOWERCASE = "lower",
14
- TITLE_CASE = "title"
14
+ RANDOM = "random"
15
15
  }
16
16
  export declare enum SeparatorType {
17
17
  HYPHEN = "hyphen",
@@ -24,7 +24,7 @@ export declare enum RefillType {
24
24
  MANUAL = "manual"
25
25
  }
26
26
  export declare enum RefillUnitType {
27
- CODES = "code",
27
+ CODES = "codes",
28
28
  PERCENT = "percent"
29
29
  }
30
30
  export interface CodeStructureData {
@@ -14,7 +14,7 @@ export var CapitalizationType;
14
14
  (function (CapitalizationType) {
15
15
  CapitalizationType["UPPERCASE"] = "upper";
16
16
  CapitalizationType["LOWERCASE"] = "lower";
17
- CapitalizationType["TITLE_CASE"] = "title";
17
+ CapitalizationType["RANDOM"] = "random";
18
18
  })(CapitalizationType || (CapitalizationType = {}));
19
19
  export var SeparatorType;
20
20
  (function (SeparatorType) {
@@ -30,6 +30,6 @@ export var RefillType;
30
30
  })(RefillType || (RefillType = {}));
31
31
  export var RefillUnitType;
32
32
  (function (RefillUnitType) {
33
- RefillUnitType["CODES"] = "code";
33
+ RefillUnitType["CODES"] = "codes";
34
34
  RefillUnitType["PERCENT"] = "percent";
35
35
  })(RefillUnitType || (RefillUnitType = {}));
@@ -1,4 +1,14 @@
1
1
  import { CharacterType, CodeStructureData, SeparatorType } from './type';
2
- export declare const generateRandomCodeWithConfig: ({ characterType, digitalNumbers, alphabetLetters, capitalization, characterOrder, }: CodeStructureData) => string;
2
+ export declare const generateRandomCodeWithConfig: ({ characterType, digitalNumbers, alphabetLetters, capitalization, characterOrder, }: {
3
+ characterType: CodeStructureData['characterType'];
4
+ digitalNumbers: CodeStructureData['digitalNumbers'];
5
+ alphabetLetters: CodeStructureData['alphabetLetters'];
6
+ capitalization: CodeStructureData['capitalization'];
7
+ characterOrder: CodeStructureData['characterOrder'];
8
+ }) => string;
3
9
  export declare const generateCodeWithPrefixAndSuffix: (code: string, prefix: string, suffix: string, separator: SeparatorType) => string;
4
- export declare const calculateTotalCodes: (numberOfLetters: number, numberOfDigits: number, characterType: CharacterType) => number;
10
+ export declare const calculateTotalCodes: ({ numberOfLetters, numberOfDigits, characterType, }: {
11
+ numberOfLetters: number;
12
+ numberOfDigits: number;
13
+ characterType: CharacterType;
14
+ }) => number;