@antscorp/antsomi-ui 1.3.5-beta.783 → 1.3.5-beta.785

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.
@@ -21,8 +21,7 @@ import { acceptablePatternChecking, getCachedRegex, getPersonalizeTagInfo, patte
21
21
  import { EMOJI, PERSONALIZE_PTN, SHORT_LINK, defaultCssVariables, tagifyDefaultProps, } from './constants';
22
22
  const TagifyInput = forwardRef((props, ref) => {
23
23
  // Props
24
- const { initialValue, readonly, disabled, maxLength, placeholder, acceptableTagPattern, mapAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
25
- console.count('------------ re-render ------------');
24
+ const { initialValue, status, readonly, disabled, maxLength, placeholder, acceptableTagPattern, mapAttributes, maxPersonalizeTags, name, children, cssTagifyVariables, onTagClick, onChange, } = props;
26
25
  // States
27
26
  const [inputTypeDebounce, , setInputTyping] = useDebounce(initialValue, 450);
28
27
  // Refs
@@ -86,10 +85,23 @@ const TagifyInput = forwardRef((props, ref) => {
86
85
  // Check readonly
87
86
  if (readonly)
88
87
  return;
88
+ const currentTagData = tagifyRef.current.getSetTagData(currentTagEle);
89
+ const currentTagValue = currentTagData?.value;
90
+ const newTagValue = newTag.value;
91
+ const spaceEle = tagifyRef.current.insertAfterTag(currentTagEle, '\u00A0'); // <- adds space after the tag to keep valid caret positioning
89
92
  tagifyRef.current.replaceTag(currentTagEle, newTag);
93
+ // Only update data if value is changed
94
+ if (currentTagValue !== newTagValue) {
95
+ // Change data out
96
+ const inputValue = tagifyRef.current.getInputValue();
97
+ const convertedValue = convertInputStringToOriginal(inputValue);
98
+ onChange(convertedValue);
99
+ }
100
+ tagifyRef.current.placeCaretAfterNode(spaceEle); // <- restore the caret after the edited tag
90
101
  }
91
102
  },
92
103
  }), [onChange]);
104
+ console.log('tagifyRef', tagifyRef);
93
105
  const onTagItemClick = useCallback((event) => {
94
106
  if (event.detail && onTagClick) {
95
107
  const { tagify } = event.detail;
@@ -291,7 +303,7 @@ const TagifyInput = forwardRef((props, ref) => {
291
303
  }
292
304
  };
293
305
  }, []);
294
- return (_jsxs(TagifyWrapper, { ref: tagifyWrapperRef, "$cssTagifyVariables": cssVariablesMemoized, className: "tagify-container", id: "tagify-container", "data-test": "tagify-wrapper", children: [_jsx(TagTextArea, { id: "tagify-textarea", ref: inputRef, name: name, defaultValue: parsedDefaultValue, "data-test": "tagify-input" }), _jsx(WrapperPlaceHolder, { ref: placeHolderRef, "$isShow": !!children, children: children })] }));
306
+ return (_jsxs(TagifyWrapper, { ref: tagifyWrapperRef, "$cssTagifyVariables": cssVariablesMemoized, className: "tagify-container", id: "tagify-container", "data-test": "tagify-wrapper", "$status": status, children: [_jsx(TagTextArea, { id: "tagify-textarea", ref: inputRef, name: name, defaultValue: parsedDefaultValue, "data-test": "tagify-input" }), _jsx(WrapperPlaceHolder, { ref: placeHolderRef, "$isShow": !!children, children: children })] }));
295
307
  });
296
308
  TagifyInput.defaultProps = tagifyDefaultProps;
297
309
  export default memo(TagifyInput);
@@ -1,12 +1,13 @@
1
1
  /* eslint-disable react-hooks/exhaustive-deps */
2
2
  // Libraries
3
- import { useLayoutEffect } from 'react';
3
+ import { useEffect, useLayoutEffect } from 'react';
4
4
  export const useSettingsTagify = (tagifyInstance, settings) => {
5
5
  const { readonly, disabled, placeholder, maxPersonalizeTags } = settings;
6
6
  // Set read only
7
- useLayoutEffect(() => {
7
+ useEffect(() => {
8
8
  if (tagifyInstance && typeof readonly !== 'undefined') {
9
9
  tagifyInstance.setReadonly(readonly);
10
+ console.log('newReadonly', readonly, tagifyInstance);
10
11
  }
11
12
  }, [readonly]);
12
13
  // Set disabled
@@ -1,9 +1,10 @@
1
- import type { TagifyInputProps } from './types';
1
+ import type { StatusType, TagifyInputProps } from './types';
2
2
  export declare const WrapperPlaceHolder: import("styled-components").StyledComponent<"div", any, {
3
3
  $isShow?: boolean | undefined;
4
4
  }, never>;
5
5
  export declare const TagifyWrapper: import("styled-components").StyledComponent<"div", any, {
6
6
  $cssTagifyVariables?: TagifyInputProps['cssTagifyVariables'];
7
+ $status?: StatusType | undefined;
7
8
  }, never>;
8
9
  export declare const TagInput: import("styled-components").StyledComponent<"input", any, {}, never>;
9
10
  export declare const TagTextArea: import("styled-components").StyledComponent<"textarea", any, {}, never>;
@@ -4,7 +4,7 @@ import styled, { css } from 'styled-components';
4
4
  import { globalToken } from '@antscorp/antsomi-ui/es/constants';
5
5
  import { MIN_H_WRAPPER, TAG_H } from './constants';
6
6
  // Utils
7
- import { getStyledTags } from './utils';
7
+ import { getBackgroundInputStatus, getStyledTags } from './utils';
8
8
  export const WrapperPlaceHolder = styled.div `
9
9
  ${({ $isShow }) => $isShow
10
10
  ? css `
@@ -17,7 +17,7 @@ export const WrapperPlaceHolder = styled.div `
17
17
  `;
18
18
  export const TagifyWrapper = styled.div `
19
19
  background: ${globalToken?.bw0};
20
- border-bottom: 1px solid ${globalToken?.blue1 || '#B8CFE6'};
20
+ border-bottom: 1px solid ${({ $status }) => getBackgroundInputStatus($status)};
21
21
  min-height: ${MIN_H_WRAPPER}px;
22
22
  width: 100%;
23
23
 
@@ -3,6 +3,7 @@
3
3
  import { ClassNameSettings, TagData, TagifySettings } from '@yaireo/tagify';
4
4
  import { EMOJI_COLLECTIONS, PATTERN_CACHE_TYPE, SHORT_LINK_TYPE, TAG_TYPE } from './constants';
5
5
  export type MapAttributesProps = Record<string, Record<string, any>>;
6
+ export type StatusType = 'error' | 'success' | 'warning';
6
7
  /**
7
8
  * Interface defining the properties for the Tagify input component.
8
9
  * Provides configuration options and event handlers to manage Tagify's behavior and appearance.
@@ -37,6 +38,7 @@ export interface TagifyInputProps {
37
38
  * Helps enforce constraints by limiting the number of tags a user can input.
38
39
  */
39
40
  maxPersonalizeTags?: TagifySettings['maxTags'];
41
+ status?: StatusType;
40
42
  /**
41
43
  * Defines acceptable patterns or validation rules for tags.
42
44
  * Ensures only tags matching specified patterns can be added, enforcing content rules.
@@ -1,4 +1,4 @@
1
- import { AcceptablePattern, EmojiCollection, EmojiTag, TagType } from './types';
1
+ import { AcceptablePattern, EmojiCollection, EmojiTag, StatusType, TagType } from './types';
2
2
  /**
3
3
  * Parses the input string and replaces matching patterns with processed tags.
4
4
  * This function iterates over predefined regex patterns and replaces each match
@@ -45,3 +45,4 @@ export declare const emojiManufacturer: (text: string, collectionType: EmojiColl
45
45
  export declare const getEmojiTag: ({ src, emoji, code }: EmojiTag) => string;
46
46
  export declare const getStyledTags: () => string;
47
47
  export declare const isPersonalizeTagType: (type: TagType) => boolean;
48
+ export declare const getBackgroundInputStatus: (status?: StatusType) => string;
@@ -3,6 +3,7 @@ import stringReplaceToArray from 'string-replace-to-array';
3
3
  // Constants
4
4
  import { CUSTOMER, CUSTOM_FN, EMOJI, EMOJI_COLLECTIONS, EVENT, OBJECT_WIDGET, PREFIX_PATTERN_LINE_MESSAGE, PROMOTION_CODE, TAG_COLOR, TAG_TYPE, VISITOR, } from './constants';
5
5
  import { iconsViber } from './iconsViber';
6
+ import { globalToken } from '@antscorp/antsomi-ui/es/constants';
6
7
  // Utils
7
8
  import { acceptablePatternChecking, getCachedRegex, patternHandlers, tagRegexStringPattern, } from './patternHandlers';
8
9
  /**
@@ -327,3 +328,16 @@ export const getStyledTags = () => {
327
328
  return styledTags.join('');
328
329
  };
329
330
  export const isPersonalizeTagType = (type) => [CUSTOMER, VISITOR, EVENT, PROMOTION_CODE, OBJECT_WIDGET, CUSTOM_FN].includes(type);
331
+ export const getBackgroundInputStatus = (status) => {
332
+ switch (status) {
333
+ case 'error':
334
+ return globalToken?.colorError || '#EF3340';
335
+ case 'warning':
336
+ return globalToken?.colorWarning || '#faad14';
337
+ case 'success':
338
+ return globalToken?.colorSuccess || '#12B800';
339
+ default: {
340
+ return globalToken?.blue1 || '#B8CFE6';
341
+ }
342
+ }
343
+ };
@@ -5,10 +5,9 @@ import { StyledNoData, StyldTitle, StyledRoot, TimelineBottom } from './styled';
5
5
  import { Flex, Spin } from '../../atoms';
6
6
  import { ItemEvent, TimeLineTitle, ItemGroupEvent } from './components';
7
7
  import { useInView } from 'react-intersection-observer';
8
- import { translate, translations } from '@antscorp/antsomi-ui/es/locales';
8
+ import { translate, translations } from '@antscorp/antsomi-locales';
9
9
  import { isEmpty } from 'lodash';
10
10
  import { differenceInMonths, formatDateTZ, startOfMonth, subMonths, } from '@antscorp/antsomi-ui/es/utils/date';
11
- import { getTranslateMessage } from '@antscorp/antsomi-ui/es/locales/i18n';
12
11
  import { EmptyData } from '../../molecules';
13
12
  export const ActivityTimeline = (props) => {
14
13
  const { timelines = [], isLoading = false, title = translate(translations._BLOCK_TIMELINE_CUS), timezone = Intl.DateTimeFormat().resolvedOptions().timeZone, objectName = '_THIS_PERSON_UPPERCASE', onFetchMore, eventTracking: eventTrackingProp = [], header, className, } = props;
@@ -92,7 +91,7 @@ export const ActivityTimeline = (props) => {
92
91
  return (_jsxs(_Fragment, { children: [header, _jsx(Flex, { style: { height: 240 }, align: "center", justify: "center", children: _jsx(Spin, { indicatorSize: 24 }) })] }));
93
92
  }
94
93
  if (!timelines.length) {
95
- return (_jsxs(_Fragment, { children: [header, _jsx(StyledNoData, { style: { height: 240 }, align: "center", justify: "center", children: _jsx(EmptyData, { showIcon: false, description: getTranslateMessage(translations.noData).toString() }) })] }));
94
+ return (_jsxs(_Fragment, { children: [header, _jsx(StyledNoData, { align: "center", justify: "center", children: _jsx(EmptyData, { showIcon: false, title: translate(translations._PROFILES_NO_DATA), description: translate(translations._PROFILES_MESSAGE_NO_DATA_TIMELINE).toString() }) })] }));
96
95
  }
97
96
  return (_jsxs(_Fragment, { children: [header, showMainContent(timelines, objectName), showBottomComponent()] }));
98
97
  };
@@ -14,10 +14,13 @@ export const ImgPanel = styled.div `
14
14
  height: 6.25rem;
15
15
  position: relative;
16
16
  border: 1px solid rgb(230, 230, 230);
17
+ border-radius: 10px;
18
+
17
19
  @media screen and (max-width: 767px) {
18
20
  width: 80px;
19
21
  height: 80px;
20
22
  }
23
+
21
24
  &:before {
22
25
  content: '';
23
26
  position: absolute;
@@ -42,9 +45,11 @@ export const ImgPanel = styled.div `
42
45
  }
43
46
  }
44
47
  }
48
+
45
49
  a {
46
50
  width: 100%;
47
51
  height: 100%;
52
+
48
53
  & > span {
49
54
  display: block;
50
55
  width: 100%;
@@ -80,15 +85,5 @@ export const LinkExtendTitle = styled(Typography.Link) `
80
85
  `;
81
86
  export const PlainCard = styled.div `
82
87
  font-size: 0.875rem;
83
-
84
- /* font-size: 0.75rem; */
85
-
86
88
  line-height: 1.25;
87
- /* &:last-of-type {
88
- /* margin-top: 2.375rem;
89
- margin-top: 3rem;
90
- @media screen and (max-width: 767px) {
91
- margin-top: 12px;
92
- }
93
- } */
94
89
  `;
@@ -1,11 +1,17 @@
1
1
  import { Flex } from 'antd';
2
2
  import styled from 'styled-components';
3
- export const StyledRoot = styled.div ``;
3
+ export const StyledRoot = styled.div `
4
+ display: flex;
5
+ flex-direction: column;
6
+ height: 100%;
7
+ `;
4
8
  export const StyldTitle = styled.div `
5
9
  font-size: 16px;
6
10
  font-weight: bold;
7
11
  `;
8
- export const StyledNoData = styled(Flex) ``;
12
+ export const StyledNoData = styled(Flex) `
13
+ height: 100%;
14
+ `;
9
15
  export const WrapperContainerRedeem = styled.div `
10
16
  display: flex;
11
17
  justify-content: space-between;
@@ -2613,12 +2613,12 @@
2613
2613
  "_PROFILES_WIDGET_1": "Customer information",
2614
2614
  "_PROFILES_WIDGET_2": "Item recommendation",
2615
2615
  "_PROFILES_WIDGET_3": "User activity",
2616
- "_PROFILES_WIDGET_4": "Visitor Information",
2616
+ "_PROFILES_WIDGET_4": "Visitor information",
2617
2617
  "_PROFILES_WIDGET_5": "Extended visualizations",
2618
2618
  "_PROFILES_SETTINGS_TAB": "Data",
2619
2619
  "_PROFILES_SETTINGS_1": "Avatar",
2620
2620
  "_PROFILES_SETTINGS_2": "Full name",
2621
- "_PROFILES_BTN_ADD_SOCIAL_GR": "Add Social Group",
2621
+ "_PROFILES_BTN_ADD_SOCIAL_GR": "Add social group",
2622
2622
  "_PROFILES_AUDIENCE_INFO_1": "Customer since",
2623
2623
  "_PROFILES_AUDIENCE_INFO_2": "Last activity",
2624
2624
  "_PROFILES_BTN_ADD_ATT": "Add attribute",
@@ -2630,10 +2630,17 @@
2630
2630
  "_PROFILES_DEFAULT_TEMP_TOOLTIP": "Default template",
2631
2631
  "_PROFILES_MESSAGE_NO_TEMP": "You don't have any templates to visualize profiles",
2632
2632
  "_PROFILES_USER_GUIDE_2": "Click the button to create a template",
2633
+ "_PROFILES_MESSAGE_NO_DATA_TIMELINE": "Modify the visualization to configure displayed events",
2634
+ "_PROFILES_MESSAGE_NO_DATA_INFOR": "Modify the visualization to configure displayed attributes",
2635
+ "_PROFILES_MESSAGE_NO_DATA_GROUP": "Please add attributes you want to display",
2636
+ "_PROFILES_ADD_EVENT": "Add event",
2633
2637
  "_COOKIE_DM_DEFINITION": "What is it?",
2634
2638
  "_COOKIE_DM_INSTRUCTION": "Instruction",
2635
2639
  "_COOKIE_DM_DEFINITION_1": "The cookie domain allows you to specify a domain where tracking cookies will be set, ensuring seamless data collection across subdomains. This helps maintain a consistent User ID, enabling accurate cross-subdomain tracking and preventing fragmented customer profiles. ",
2636
2640
  "_COOKIE_DM_DEFINITION_2": "By ensuring unified data collection, it enhances personalization, improves analytics, and provides a clearer view of customer behavior across your entire web ecosystem.",
2637
- "_COOKIE_DM_INSTRUCTION_1": "Identify the Primary Domain: \nThis is the base domain for all subdomains you want to track. \nExample: https://antsomi.com",
2638
- "_COOKIE_DM_INSTRUCTION_2": "Configure the Cookie Domain: \nInput .antsomi.com to track data across all subdomains (eg: shop.antsomi.com or blog.antsomi.com)"
2641
+ "_COOKIE_DM_INSTRUCTION_1_SUM": "Identify the Primary Domain: ",
2642
+ "_COOKIE_DM_INSTRUCTION_1_DES_1": "This is the base domain for all subdomains you want to track. ",
2643
+ "_COOKIE_DM_INSTRUCTION_1_DES_2": "Example: {{x}}",
2644
+ "_COOKIE_DM_INSTRUCTION_2_SUM": "Configure the Cookie Domain:",
2645
+ "_COOKIE_DM_INSTRUCTION_2_DES_1": "Input {{x}} to track data across all subdomains (eg: {{y}} or {{y}})"
2639
2646
  }
@@ -2632,12 +2632,19 @@ export declare const translationsJson: {
2632
2632
  _PROFILES_DEFAULT_TEMP_TOOLTIP: string;
2633
2633
  _PROFILES_MESSAGE_NO_TEMP: string;
2634
2634
  _PROFILES_USER_GUIDE_2: string;
2635
+ _PROFILES_MESSAGE_NO_DATA_TIMELINE: string;
2636
+ _PROFILES_MESSAGE_NO_DATA_INFOR: string;
2637
+ _PROFILES_MESSAGE_NO_DATA_GROUP: string;
2638
+ _PROFILES_ADD_EVENT: string;
2635
2639
  _COOKIE_DM_DEFINITION: string;
2636
2640
  _COOKIE_DM_INSTRUCTION: string;
2637
2641
  _COOKIE_DM_DEFINITION_1: string;
2638
2642
  _COOKIE_DM_DEFINITION_2: string;
2639
- _COOKIE_DM_INSTRUCTION_1: string;
2640
- _COOKIE_DM_INSTRUCTION_2: string;
2643
+ _COOKIE_DM_INSTRUCTION_1_SUM: string;
2644
+ _COOKIE_DM_INSTRUCTION_1_DES_1: string;
2645
+ _COOKIE_DM_INSTRUCTION_1_DES_2: string;
2646
+ _COOKIE_DM_INSTRUCTION_2_SUM: string;
2647
+ _COOKIE_DM_INSTRUCTION_2_DES_1: string;
2641
2648
  global: {
2642
2649
  minus: string;
2643
2650
  plus: string;
@@ -5956,12 +5963,19 @@ export declare const translationsJson: {
5956
5963
  _PROFILES_DEFAULT_TEMP_TOOLTIP: string;
5957
5964
  _PROFILES_MESSAGE_NO_TEMP: string;
5958
5965
  _PROFILES_USER_GUIDE_2: string;
5966
+ _PROFILES_MESSAGE_NO_DATA_TIMELINE: string;
5967
+ _PROFILES_MESSAGE_NO_DATA_INFOR: string;
5968
+ _PROFILES_MESSAGE_NO_DATA_GROUP: string;
5969
+ _PROFILES_ADD_EVENT: string;
5959
5970
  _COOKIE_DM_DEFINITION: string;
5960
5971
  _COOKIE_DM_INSTRUCTION: string;
5961
5972
  _COOKIE_DM_DEFINITION_1: string;
5962
5973
  _COOKIE_DM_DEFINITION_2: string;
5963
- _COOKIE_DM_INSTRUCTION_1: string;
5964
- _COOKIE_DM_INSTRUCTION_2: string;
5974
+ _COOKIE_DM_INSTRUCTION_1_SUM: string;
5975
+ _COOKIE_DM_INSTRUCTION_1_DES_1: string;
5976
+ _COOKIE_DM_INSTRUCTION_1_DES_2: string;
5977
+ _COOKIE_DM_INSTRUCTION_2_SUM: string;
5978
+ _COOKIE_DM_INSTRUCTION_2_DES_1: string;
5965
5979
  global: {
5966
5980
  minus: string;
5967
5981
  plus: string;
@@ -8819,12 +8833,19 @@ export declare const translationsJson: {
8819
8833
  _PROFILES_DEFAULT_TEMP_TOOLTIP: string;
8820
8834
  _PROFILES_MESSAGE_NO_TEMP: string;
8821
8835
  _PROFILES_USER_GUIDE_2: string;
8836
+ _PROFILES_MESSAGE_NO_DATA_TIMELINE: string;
8837
+ _PROFILES_MESSAGE_NO_DATA_INFOR: string;
8838
+ _PROFILES_MESSAGE_NO_DATA_GROUP: string;
8839
+ _PROFILES_ADD_EVENT: string;
8822
8840
  _COOKIE_DM_DEFINITION: string;
8823
8841
  _COOKIE_DM_INSTRUCTION: string;
8824
8842
  _COOKIE_DM_DEFINITION_1: string;
8825
8843
  _COOKIE_DM_DEFINITION_2: string;
8826
- _COOKIE_DM_INSTRUCTION_1: string;
8827
- _COOKIE_DM_INSTRUCTION_2: string;
8844
+ _COOKIE_DM_INSTRUCTION_1_SUM: string;
8845
+ _COOKIE_DM_INSTRUCTION_1_DES_1: string;
8846
+ _COOKIE_DM_INSTRUCTION_1_DES_2: string;
8847
+ _COOKIE_DM_INSTRUCTION_2_SUM: string;
8848
+ _COOKIE_DM_INSTRUCTION_2_DES_1: string;
8828
8849
  };
8829
8850
  };
8830
8851
  };