@antscorp/antsomi-ui 1.3.5-beta.13 → 1.3.5-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +78 -78
- package/es/assets/css/main.scss +4 -4
- package/es/assets/images/feedback.svg +3 -3
- package/es/components/atoms/Alert/Alert.d.ts +4 -4
- package/es/components/atoms/Alert/Alert.js +19 -19
- package/es/components/atoms/Alert/index.d.ts +1 -1
- package/es/components/atoms/Alert/index.js +1 -1
- package/es/components/atoms/Button/Button.d.ts +1 -1
- package/es/components/atoms/Button/Button.js +1 -1
- package/es/components/atoms/Button/index.d.ts +4 -4
- package/es/components/atoms/Button/index.js +2 -2
- package/es/components/atoms/Button/test.d.ts +3 -3
- package/es/components/atoms/Button/test.js +99 -99
- package/es/components/atoms/Checkbox/Checkbox.d.ts +1 -1
- package/es/components/atoms/Checkbox/Checkbox.js +1 -1
- package/es/components/atoms/Checkbox/index.d.ts +1 -1
- package/es/components/atoms/Checkbox/index.js +1 -1
- package/es/components/atoms/Divider/Divider.d.ts +1 -1
- package/es/components/atoms/Divider/Divider.js +1 -1
- package/es/components/atoms/Divider/index.d.ts +1 -1
- package/es/components/atoms/Divider/index.js +1 -1
- package/es/components/atoms/DividerPure/DividerPure.d.ts +10 -10
- package/es/components/atoms/DividerPure/DividerPure.js +27 -27
- package/es/components/atoms/DividerPure/index.d.ts +1 -1
- package/es/components/atoms/DividerPure/index.js +1 -1
- package/es/components/atoms/DividerPure/styled.d.ts +1 -1
- package/es/components/atoms/DividerPure/styled.js +41 -41
- package/es/components/atoms/Empty/Empty.d.ts +6 -6
- package/es/components/atoms/Empty/Empty.js +8 -8
- package/es/components/atoms/Empty/index.d.ts +1 -1
- package/es/components/atoms/Empty/index.js +1 -1
- package/es/components/atoms/Flex/Flex.d.ts +2 -2
- package/es/components/atoms/Flex/Flex.js +1 -1
- package/es/components/atoms/Flex/index.d.ts +1 -1
- package/es/components/atoms/Flex/index.js +1 -1
- package/es/components/atoms/FloatButton/FloatButton.d.ts +1 -1
- package/es/components/atoms/FloatButton/FloatButton.js +1 -1
- package/es/components/atoms/FloatButton/index.d.ts +1 -1
- package/es/components/atoms/FloatButton/index.js +2 -2
- package/es/components/atoms/Grid/Grid.d.ts +3 -3
- package/es/components/atoms/Grid/Grid.js +3 -3
- package/es/components/atoms/Grid/index.d.ts +1 -1
- package/es/components/atoms/Grid/index.js +1 -1
- package/es/components/atoms/Icon/index.d.ts +10 -10
- package/es/components/atoms/Icon/index.js +36 -36
- package/es/components/atoms/Input/Input.d.ts +31 -31
- package/es/components/atoms/Input/Input.js +96 -96
- package/es/components/atoms/Input/index.d.ts +2 -2
- package/es/components/atoms/Input/index.js +1 -1
- package/es/components/atoms/Input/styled.d.ts +11 -11
- package/es/components/atoms/Input/styled.js +109 -109
- package/es/components/atoms/InputDynamic/EditCaretPositioning.d.ts +2 -2
- package/es/components/atoms/InputDynamic/EditCaretPositioning.js +89 -89
- package/es/components/atoms/InputDynamic/InputDynamic.d.ts +10 -10
- package/es/components/atoms/InputDynamic/InputDynamic.js +516 -516
- package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +16 -16
- package/es/components/atoms/InputDynamic/PopupShortLink.js +85 -85
- package/es/components/atoms/InputDynamic/constants.d.ts +71 -71
- package/es/components/atoms/InputDynamic/constants.js +71 -71
- package/es/components/atoms/InputDynamic/index.d.ts +2 -2
- package/es/components/atoms/InputDynamic/index.js +1 -1
- package/es/components/atoms/InputDynamic/styled.d.ts +13 -13
- package/es/components/atoms/InputDynamic/styled.js +293 -293
- package/es/components/atoms/InputDynamic/types.d.ts +116 -116
- package/es/components/atoms/InputDynamic/types.js +1 -1
- package/es/components/atoms/InputDynamic/utils.d.ts +30 -30
- package/es/components/atoms/InputDynamic/utils.js +874 -874
- package/es/components/atoms/InputNumber/InputNumber.d.ts +6 -6
- package/es/components/atoms/InputNumber/InputNumber.js +27 -27
- package/es/components/atoms/InputNumber/index.d.ts +1 -1
- package/es/components/atoms/InputNumber/index.js +1 -1
- package/es/components/atoms/Message/Message.d.ts +1 -1
- package/es/components/atoms/Message/Message.js +1 -1
- package/es/components/atoms/Message/index.d.ts +1 -1
- package/es/components/atoms/Message/index.js +1 -1
- package/es/components/atoms/MobileFrame/MobileFrame.d.ts +4 -4
- package/es/components/atoms/MobileFrame/MobileFrame.js +22 -22
- package/es/components/atoms/MobileFrame/constants.d.ts +4 -4
- package/es/components/atoms/MobileFrame/constants.js +4 -4
- package/es/components/atoms/MobileFrame/index.d.ts +2 -2
- package/es/components/atoms/MobileFrame/index.js +1 -1
- package/es/components/atoms/MobileFrame/styled.d.ts +3 -3
- package/es/components/atoms/MobileFrame/styled.js +33 -33
- package/es/components/atoms/Notification/Notification.d.ts +1 -1
- package/es/components/atoms/Notification/Notification.js +1 -1
- package/es/components/atoms/Notification/index.d.ts +1 -1
- package/es/components/atoms/Notification/index.js +1 -1
- package/es/components/atoms/Pagination/Pagination.d.ts +2 -2
- package/es/components/atoms/Pagination/Pagination.js +2 -2
- package/es/components/atoms/Pagination/index.d.ts +2 -2
- package/es/components/atoms/Pagination/index.js +1 -1
- package/es/components/atoms/Popover/Popover.d.ts +4 -4
- package/es/components/atoms/Popover/Popover.js +2 -2
- package/es/components/atoms/Popover/index.d.ts +1 -1
- package/es/components/atoms/Popover/index.js +1 -1
- package/es/components/atoms/Popover/styled.d.ts +4 -4
- package/es/components/atoms/Popover/styled.js +5 -5
- package/es/components/atoms/PreviewTabs/PreviewTabs.d.ts +7 -7
- package/es/components/atoms/PreviewTabs/PreviewTabs.js +67 -67
- package/es/components/atoms/PreviewTabs/index.d.ts +2 -2
- package/es/components/atoms/PreviewTabs/index.js +1 -1
- package/es/components/atoms/PreviewTabs/styled.d.ts +6 -6
- package/es/components/atoms/PreviewTabs/styled.js +79 -79
- package/es/components/atoms/Progress/Progress.d.ts +2 -2
- package/es/components/atoms/Progress/Progress.js +2 -2
- package/es/components/atoms/Progress/index.d.ts +1 -1
- package/es/components/atoms/Progress/index.js +1 -1
- package/es/components/atoms/Radio/Radio.d.ts +1 -1
- package/es/components/atoms/Radio/Radio.js +1 -1
- package/es/components/atoms/Radio/index.d.ts +7 -7
- package/es/components/atoms/Radio/index.js +25 -25
- package/es/components/atoms/Rate/Rate.d.ts +2 -2
- package/es/components/atoms/Rate/Rate.js +2 -2
- package/es/components/atoms/Rate/index.d.ts +1 -1
- package/es/components/atoms/Rate/index.js +1 -1
- package/es/components/atoms/RateV2/RateV2.d.ts +18 -18
- package/es/components/atoms/RateV2/RateV2.js +73 -73
- package/es/components/atoms/RateV2/index.d.ts +1 -1
- package/es/components/atoms/RateV2/index.js +1 -1
- package/es/components/atoms/RequiredLabel/index.d.ts +8 -8
- package/es/components/atoms/RequiredLabel/index.js +25 -25
- package/es/components/atoms/RequiredLabel/styled.d.ts +2 -2
- package/es/components/atoms/RequiredLabel/styled.js +10 -10
- package/es/components/atoms/ScrollBox/index.d.ts +9 -9
- package/es/components/atoms/ScrollBox/index.js +51 -51
- package/es/components/atoms/Segmented/Segmented.d.ts +2 -2
- package/es/components/atoms/Segmented/Segmented.js +2 -2
- package/es/components/atoms/Segmented/index.d.ts +1 -1
- package/es/components/atoms/Segmented/index.js +1 -1
- package/es/components/atoms/Skeleton/Skeleton.d.ts +8 -8
- package/es/components/atoms/Skeleton/Skeleton.js +2 -2
- package/es/components/atoms/Skeleton/index.d.ts +1 -1
- package/es/components/atoms/Skeleton/index.js +1 -1
- package/es/components/atoms/SlideBar/SlideBar.d.ts +34 -34
- package/es/components/atoms/SlideBar/SlideBar.js +283 -283
- package/es/components/atoms/SlideBar/constants.d.ts +10 -10
- package/es/components/atoms/SlideBar/constants.js +10 -10
- package/es/components/atoms/SlideBar/index.d.ts +1 -1
- package/es/components/atoms/SlideBar/index.js +1 -1
- package/es/components/atoms/SlideBar/styled.d.ts +20 -20
- package/es/components/atoms/SlideBar/styled.js +136 -136
- package/es/components/atoms/Slider/index.d.ts +6 -6
- package/es/components/atoms/Slider/index.js +30 -30
- package/es/components/atoms/Slider/styled.d.ts +7 -7
- package/es/components/atoms/Slider/styled.js +44 -44
- package/es/components/atoms/SliderV2/index.d.ts +6 -6
- package/es/components/atoms/SliderV2/index.js +21 -21
- package/es/components/atoms/Space/Space.d.ts +6 -6
- package/es/components/atoms/Space/Space.js +9 -9
- package/es/components/atoms/Space/index.d.ts +1 -1
- package/es/components/atoms/Space/index.js +1 -1
- package/es/components/atoms/Spin/Spin.d.ts +10 -10
- package/es/components/atoms/Spin/Spin.js +28 -28
- package/es/components/atoms/Spin/index.d.ts +1 -1
- package/es/components/atoms/Spin/index.js +1 -1
- package/es/components/atoms/Spin/styled.d.ts +1 -1
- package/es/components/atoms/Spin/styled.js +7 -7
- package/es/components/atoms/Statistic/Statistic.d.ts +1 -1
- package/es/components/atoms/Statistic/Statistic.js +2 -2
- package/es/components/atoms/Statistic/index.d.ts +1 -1
- package/es/components/atoms/Statistic/index.js +1 -1
- package/es/components/atoms/Steps/Steps.d.ts +4 -4
- package/es/components/atoms/Steps/Steps.js +2 -2
- package/es/components/atoms/Steps/index.d.ts +1 -1
- package/es/components/atoms/Steps/index.js +1 -1
- package/es/components/atoms/Switch/Switch.d.ts +2 -2
- package/es/components/atoms/Switch/Switch.js +2 -2
- package/es/components/atoms/Switch/index.d.ts +1 -1
- package/es/components/atoms/Switch/index.js +1 -1
- package/es/components/atoms/Tag/Tag.d.ts +1 -1
- package/es/components/atoms/Tag/Tag.js +1 -1
- package/es/components/atoms/Tag/index.d.ts +1 -1
- package/es/components/atoms/Tag/index.js +1 -1
- package/es/components/atoms/Text/index.d.ts +10 -10
- package/es/components/atoms/Text/index.js +27 -27
- package/es/components/atoms/Text/styled.d.ts +7 -7
- package/es/components/atoms/Text/styled.js +52 -52
- package/es/components/atoms/Timeline/Timeline.d.ts +4 -4
- package/es/components/atoms/Timeline/Timeline.js +2 -2
- package/es/components/atoms/Timeline/index.d.ts +1 -1
- package/es/components/atoms/Timeline/index.js +1 -1
- package/es/components/atoms/Tooltip/Tooltip.d.ts +1 -1
- package/es/components/atoms/Tooltip/Tooltip.js +1 -1
- package/es/components/atoms/Tooltip/index.d.ts +1 -1
- package/es/components/atoms/Tooltip/index.js +1 -1
- package/es/components/atoms/Typography/Text.d.ts +1 -1
- package/es/components/atoms/Typography/Text.js +1 -1
- package/es/components/atoms/Typography/index.d.ts +1 -1
- package/es/components/atoms/Typography/index.js +1 -1
- package/es/components/atoms/Watermark/Watermark.d.ts +2 -2
- package/es/components/atoms/Watermark/Watermark.js +2 -2
- package/es/components/atoms/Watermark/index.d.ts +1 -1
- package/es/components/atoms/Watermark/index.js +1 -1
- package/es/components/atoms/index.d.ts +42 -42
- package/es/components/atoms/index.js +39 -39
- package/es/components/common/ConfigProvider/ConfigProvider.d.ts +11 -11
- package/es/components/common/ConfigProvider/ConfigProvider.js +54 -54
- package/es/components/common/ConfigProvider/GlobalStyle.d.ts +5 -5
- package/es/components/common/ConfigProvider/GlobalStyle.js +782 -782
- package/es/components/common/ConfigProvider/index.d.ts +1 -1
- package/es/components/common/ConfigProvider/index.js +1 -1
- package/es/components/common/index.d.ts +1 -1
- package/es/components/common/index.js +1 -1
- package/es/components/icons/AccountCircle.d.ts +3 -3
- package/es/components/icons/AccountCircle.js +3 -3
- package/es/components/icons/AddShoppingCart.d.ts +3 -3
- package/es/components/icons/AddShoppingCart.js +3 -3
- package/es/components/icons/ArrowGrowIcon.d.ts +2 -2
- package/es/components/icons/ArrowGrowIcon.js +4 -4
- package/es/components/icons/AssignmentInd.d.ts +3 -3
- package/es/components/icons/AssignmentInd.js +3 -3
- package/es/components/icons/AudioRecordIcon.d.ts +2 -2
- package/es/components/icons/AudioRecordIcon.js +4 -4
- package/es/components/icons/BugIcon.d.ts +2 -2
- package/es/components/icons/BugIcon.js +4 -4
- package/es/components/icons/Call.d.ts +3 -3
- package/es/components/icons/Call.js +3 -3
- package/es/components/icons/CameraIcon.d.ts +2 -2
- package/es/components/icons/CameraIcon.js +4 -4
- package/es/components/icons/CaptureIcon.d.ts +2 -2
- package/es/components/icons/CaptureIcon.js +4 -4
- package/es/components/icons/Category.d.ts +3 -3
- package/es/components/icons/Category.js +5 -5
- package/es/components/icons/ChatBubbleOutline.d.ts +3 -3
- package/es/components/icons/ChatBubbleOutline.js +3 -3
- package/es/components/icons/CheckSlimIcon.d.ts +2 -2
- package/es/components/icons/CheckSlimIcon.js +4 -4
- package/es/components/icons/CircleNotifications.d.ts +3 -3
- package/es/components/icons/CircleNotifications.js +3 -3
- package/es/components/icons/CloseIcon.d.ts +4 -4
- package/es/components/icons/CloseIcon.js +22 -22
- package/es/components/icons/CommentIcon.d.ts +2 -2
- package/es/components/icons/CommentIcon.js +4 -4
- package/es/components/icons/ConfirmationNumber.d.ts +3 -3
- package/es/components/icons/ConfirmationNumber.js +3 -3
- package/es/components/icons/DesktopWindows.d.ts +3 -3
- package/es/components/icons/DesktopWindows.js +3 -3
- package/es/components/icons/EventIcon.d.ts +4 -4
- package/es/components/icons/EventIcon.js +18 -18
- package/es/components/icons/FactCheck.d.ts +3 -3
- package/es/components/icons/FactCheck.js +3 -3
- package/es/components/icons/FreeDrawIcon.d.ts +2 -2
- package/es/components/icons/FreeDrawIcon.js +4 -4
- package/es/components/icons/GPTIcon.d.ts +2 -2
- package/es/components/icons/GPTIcon.js +18 -18
- package/es/components/icons/GPTIconV2.d.ts +2 -2
- package/es/components/icons/GPTIconV2.js +18 -18
- package/es/components/icons/GPTIconV3.d.ts +2 -2
- package/es/components/icons/GPTIconV3.js +5 -5
- package/es/components/icons/HighlightIcon.d.ts +2 -2
- package/es/components/icons/HighlightIcon.js +4 -4
- package/es/components/icons/HightlightAlt.d.ts +3 -3
- package/es/components/icons/HightlightAlt.js +3 -3
- package/es/components/icons/HowToReg.d.ts +3 -3
- package/es/components/icons/HowToReg.js +3 -3
- package/es/components/icons/IdeaIcon.d.ts +2 -2
- package/es/components/icons/IdeaIcon.js +4 -4
- package/es/components/icons/Interactive.d.ts +3 -3
- package/es/components/icons/Interactive.js +3 -3
- package/es/components/icons/InvisibleIcon.d.ts +2 -2
- package/es/components/icons/InvisibleIcon.js +5 -5
- package/es/components/icons/List.d.ts +3 -3
- package/es/components/icons/List.js +3 -3
- package/es/components/icons/LocalMallIcon.d.ts +3 -3
- package/es/components/icons/LocalMallIcon.js +3 -3
- package/es/components/icons/MobileFriendly.d.ts +3 -3
- package/es/components/icons/MobileFriendly.js +3 -3
- package/es/components/icons/MuteIcon.d.ts +2 -2
- package/es/components/icons/MuteIcon.js +4 -4
- package/es/components/icons/NotificationsActive.d.ts +3 -3
- package/es/components/icons/NotificationsActive.js +3 -3
- package/es/components/icons/OpenUrlIcon.d.ts +2 -2
- package/es/components/icons/OpenUrlIcon.js +4 -4
- package/es/components/icons/PauseIcon.d.ts +2 -2
- package/es/components/icons/PauseIcon.js +4 -4
- package/es/components/icons/Payment.d.ts +3 -3
- package/es/components/icons/Payment.js +3 -3
- package/es/components/icons/PersonAddDisabled.d.ts +3 -3
- package/es/components/icons/PersonAddDisabled.js +4 -4
- package/es/components/icons/PhoneCallback.d.ts +3 -3
- package/es/components/icons/PhoneCallback.js +3 -3
- package/es/components/icons/PlaneIcon.d.ts +2 -2
- package/es/components/icons/PlaneIcon.js +8 -8
- package/es/components/icons/Preview.d.ts +3 -3
- package/es/components/icons/Preview.js +3 -3
- package/es/components/icons/Redeem.d.ts +3 -3
- package/es/components/icons/Redeem.js +3 -3
- package/es/components/icons/RemoveRedEye.d.ts +3 -3
- package/es/components/icons/RemoveRedEye.js +3 -3
- package/es/components/icons/RemoveShoppingCart.d.ts +3 -3
- package/es/components/icons/RemoveShoppingCart.js +3 -3
- package/es/components/icons/RequestIcon.d.ts +2 -2
- package/es/components/icons/RequestIcon.js +4 -4
- package/es/components/icons/Search.d.ts +3 -3
- package/es/components/icons/Search.js +3 -3
- package/es/components/icons/ShoppingBag.d.ts +3 -3
- package/es/components/icons/ShoppingBag.js +3 -3
- package/es/components/icons/ShoppingCart.d.ts +3 -3
- package/es/components/icons/ShoppingCart.js +3 -3
- package/es/components/icons/StopRecordIcon.d.ts +2 -2
- package/es/components/icons/StopRecordIcon.js +4 -4
- package/es/components/icons/Store.d.ts +3 -3
- package/es/components/icons/Store.js +3 -3
- package/es/components/icons/UserIcon.d.ts +2 -2
- package/es/components/icons/UserIcon.js +8 -8
- package/es/components/icons/VerticalDotsIcon.d.ts +2 -2
- package/es/components/icons/VerticalDotsIcon.js +4 -4
- package/es/components/icons/WarningIcon.d.ts +2 -2
- package/es/components/icons/WarningIcon.js +4 -4
- package/es/components/icons/Web.d.ts +3 -3
- package/es/components/icons/Web.js +3 -3
- package/es/components/icons/WebAsset.d.ts +3 -3
- package/es/components/icons/WebAsset.js +3 -3
- package/es/components/icons/index.d.ts +54 -54
- package/es/components/icons/index.js +54 -54
- package/es/components/icons/type.d.ts +3 -3
- package/es/components/icons/type.js +1 -1
- package/es/components/index.d.ts +5 -5
- package/es/components/index.js +5 -5
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.d.ts +35 -35
- package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +1248 -1248
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +12 -12
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.js +25 -25
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/index.d.ts +3 -3
- package/es/components/molecules/AddDynamicContent/components/DisplayFormat/index.js +3 -3
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/FormatDatetime.d.ts +19 -19
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/FormatDatetime.js +100 -100
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/index.d.ts +1 -1
- package/es/components/molecules/AddDynamicContent/components/FormatDatetime/index.js +1 -1
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/FormatNumber.d.ts +52 -52
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/FormatNumber.js +132 -132
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/index.d.ts +1 -1
- package/es/components/molecules/AddDynamicContent/components/FormatNumber/index.js +1 -1
- package/es/components/molecules/AddDynamicContent/components/index.d.ts +3 -3
- package/es/components/molecules/AddDynamicContent/components/index.js +3 -3
- package/es/components/molecules/AddDynamicContent/constants.d.ts +101 -101
- package/es/components/molecules/AddDynamicContent/constants.js +152 -152
- package/es/components/molecules/AddDynamicContent/currencies.json +1523 -1523
- package/es/components/molecules/AddDynamicContent/index.d.ts +2 -2
- package/es/components/molecules/AddDynamicContent/index.js +2 -2
- package/es/components/molecules/AddDynamicContent/styled.d.ts +12 -12
- package/es/components/molecules/AddDynamicContent/styled.js +30 -30
- package/es/components/molecules/AddDynamicContent/types.d.ts +13 -13
- package/es/components/molecules/AddDynamicContent/types.js +1 -1
- package/es/components/molecules/AddDynamicContent/utils.d.ts +41 -41
- package/es/components/molecules/AddDynamicContent/utils.js +396 -396
- package/es/components/molecules/AlignSetting/index.d.ts +19 -19
- package/es/components/molecules/AlignSetting/index.js +52 -52
- package/es/components/molecules/AlignSetting/styled.d.ts +1 -1
- package/es/components/molecules/AlignSetting/styled.js +7 -7
- package/es/components/molecules/AlignSetting/utils.d.ts +3 -3
- package/es/components/molecules/AlignSetting/utils.js +19 -19
- package/es/components/molecules/CalendarSelection/CalendarSelection.d.ts +3 -3
- package/es/components/molecules/CalendarSelection/CalendarSelection.js +45 -45
- package/es/components/molecules/CalendarSelection/actions.d.ts +55 -55
- package/es/components/molecules/CalendarSelection/actions.js +39 -39
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.d.ts +7 -7
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/AutoUpdateTo.js +24 -24
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/AutoUpdateTo/styled.js +10 -10
- package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.d.ts +3 -3
- package/es/components/molecules/CalendarSelection/components/CustomPicker/CustomPicker.js +89 -89
- package/es/components/molecules/CalendarSelection/components/CustomPicker/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/CustomPicker/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.d.ts +6 -6
- package/es/components/molecules/CalendarSelection/components/CustomPicker/styled.js +141 -141
- package/es/components/molecules/CalendarSelection/components/CustomPicker/types.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/CustomPicker/types.js +1 -1
- package/es/components/molecules/CalendarSelection/components/Footer/Footer.d.ts +2 -2
- package/es/components/molecules/CalendarSelection/components/Footer/Footer.js +11 -11
- package/es/components/molecules/CalendarSelection/components/Footer/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/Footer/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/Footer/styled.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/Footer/styled.js +6 -6
- package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.d.ts +5 -5
- package/es/components/molecules/CalendarSelection/components/RangePicker/RangePicker.js +4 -4
- package/es/components/molecules/CalendarSelection/components/RangePicker/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/RangePicker/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/RangePicker/styled.d.ts +5 -5
- package/es/components/molecules/CalendarSelection/components/RangePicker/styled.js +13 -13
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.d.ts +3 -3
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/RangeSelectOptions.js +23 -23
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.d.ts +2 -2
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/NumOfDaysRanges.js +41 -41
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/NumOfDaysRanges/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.d.ts +11 -11
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/Option.js +40 -40
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/Option/styled.js +29 -29
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.d.ts +2 -2
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/components/index.js +2 -2
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/index.js +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.d.ts +3 -3
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/styled.js +34 -34
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/RangeSelectOptions/types.js +1 -1
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.d.ts +5 -5
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/TimeRangeDisplay.js +45 -45
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.d.ts +2 -2
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/index.js +2 -2
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.d.ts +1 -1
- package/es/components/molecules/CalendarSelection/components/TimeRangeDisplay/styled.js +70 -70
- package/es/components/molecules/CalendarSelection/components/index.d.ts +5 -5
- package/es/components/molecules/CalendarSelection/components/index.js +5 -5
- package/es/components/molecules/CalendarSelection/constants.d.ts +97 -97
- package/es/components/molecules/CalendarSelection/constants.js +183 -183
- package/es/components/molecules/CalendarSelection/context.d.ts +4 -4
- package/es/components/molecules/CalendarSelection/context.js +6 -6
- package/es/components/molecules/CalendarSelection/hooks/index.d.ts +2 -2
- package/es/components/molecules/CalendarSelection/hooks/index.js +2 -2
- package/es/components/molecules/CalendarSelection/hooks/useStateContext.d.ts +4 -4
- package/es/components/molecules/CalendarSelection/hooks/useStateContext.js +13 -13
- package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.d.ts +9 -9
- package/es/components/molecules/CalendarSelection/hooks/useTriggerOut.js +19 -19
- package/es/components/molecules/CalendarSelection/index.d.ts +25 -25
- package/es/components/molecules/CalendarSelection/index.js +6 -6
- package/es/components/molecules/CalendarSelection/reducer.d.ts +3 -3
- package/es/components/molecules/CalendarSelection/reducer.js +121 -121
- package/es/components/molecules/CalendarSelection/styled.d.ts +5 -5
- package/es/components/molecules/CalendarSelection/styled.js +10 -10
- package/es/components/molecules/CalendarSelection/types.d.ts +98 -98
- package/es/components/molecules/CalendarSelection/types.js +1 -1
- package/es/components/molecules/CalendarSelection/utils.d.ts +48 -48
- package/es/components/molecules/CalendarSelection/utils.js +300 -300
- package/es/components/molecules/CaptureScreen/CaptureScreen.d.ts +16 -16
- package/es/components/molecules/CaptureScreen/CaptureScreen.js +834 -834
- package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.d.ts +17 -17
- package/es/components/molecules/CaptureScreen/components/CommentBox/CommentBox.js +80 -80
- package/es/components/molecules/CaptureScreen/components/CommentBox/index.d.ts +1 -1
- package/es/components/molecules/CaptureScreen/components/CommentBox/index.js +1 -1
- package/es/components/molecules/CaptureScreen/components/CommentBox/styled.d.ts +12 -12
- package/es/components/molecules/CaptureScreen/components/CommentBox/styled.js +136 -136
- package/es/components/molecules/CaptureScreen/components/CommentBox/types.d.ts +15 -15
- package/es/components/molecules/CaptureScreen/components/CommentBox/types.js +1 -1
- package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.d.ts +4 -4
- package/es/components/molecules/CaptureScreen/components/Cursor/Cursor.js +17 -17
- package/es/components/molecules/CaptureScreen/components/Cursor/index.d.ts +1 -1
- package/es/components/molecules/CaptureScreen/components/Cursor/index.js +1 -1
- package/es/components/molecules/CaptureScreen/components/Cursor/styled.d.ts +7 -7
- package/es/components/molecules/CaptureScreen/components/Cursor/styled.js +79 -79
- package/es/components/molecules/CaptureScreen/components/Cursor/types.d.ts +10 -10
- package/es/components/molecules/CaptureScreen/components/Cursor/types.js +1 -1
- package/es/components/molecules/CaptureScreen/constants.d.ts +41 -41
- package/es/components/molecules/CaptureScreen/constants.js +118 -118
- package/es/components/molecules/CaptureScreen/hooks/useImageEditor.d.ts +5 -5
- package/es/components/molecules/CaptureScreen/hooks/useImageEditor.js +103 -103
- package/es/components/molecules/CaptureScreen/index.d.ts +1 -1
- package/es/components/molecules/CaptureScreen/index.js +1 -1
- package/es/components/molecules/CaptureScreen/styled.d.ts +26 -26
- package/es/components/molecules/CaptureScreen/styled.js +255 -255
- package/es/components/molecules/CaptureScreen/themes/black.d.ts +54 -54
- package/es/components/molecules/CaptureScreen/themes/black.js +64 -64
- package/es/components/molecules/CaptureScreen/themes/white.d.ts +54 -54
- package/es/components/molecules/CaptureScreen/themes/white.js +64 -64
- package/es/components/molecules/CaptureScreen/types.d.ts +108 -108
- package/es/components/molecules/CaptureScreen/types.js +1 -1
- package/es/components/molecules/CaptureScreen/utils.d.ts +13 -13
- package/es/components/molecules/CaptureScreen/utils.js +62 -62
- package/es/components/molecules/Card/Card.d.ts +1 -1
- package/es/components/molecules/Card/Card.js +2 -2
- package/es/components/molecules/Card/index.d.ts +1 -1
- package/es/components/molecules/Card/index.js +1 -1
- package/es/components/molecules/Cascader/Cascader.d.ts +1 -1
- package/es/components/molecules/Cascader/Cascader.js +1 -1
- package/es/components/molecules/Cascader/index.d.ts +1 -1
- package/es/components/molecules/Cascader/index.js +1 -1
- package/es/components/molecules/ChatBox/ChatBox.d.ts +3 -3
- package/es/components/molecules/ChatBox/ChatBox.js +188 -188
- package/es/components/molecules/ChatBox/MessageItem.d.ts +5 -5
- package/es/components/molecules/ChatBox/MessageItem.js +66 -66
- package/es/components/molecules/ChatBox/constants.d.ts +6 -6
- package/es/components/molecules/ChatBox/constants.js +51 -51
- package/es/components/molecules/ChatBox/index.d.ts +1 -1
- package/es/components/molecules/ChatBox/index.js +1 -1
- package/es/components/molecules/ChatBox/styled.d.ts +10 -10
- package/es/components/molecules/ChatBox/styled.js +280 -280
- package/es/components/molecules/ChatBox/types.d.ts +32 -32
- package/es/components/molecules/ChatBox/types.js +1 -1
- package/es/components/molecules/Collapse/Collapse.d.ts +4 -4
- package/es/components/molecules/Collapse/Collapse.js +11 -11
- package/es/components/molecules/Collapse/index.d.ts +1 -1
- package/es/components/molecules/Collapse/index.js +1 -1
- package/es/components/molecules/ColorPicker/ChromePicker/index.d.ts +1 -1
- package/es/components/molecules/ColorPicker/ChromePicker/index.js +3 -3
- package/es/components/molecules/ColorPicker/ChromePicker/styled.d.ts +1 -1
- package/es/components/molecules/ColorPicker/ChromePicker/styled.js +15 -15
- package/es/components/molecules/ColorPicker/CustomPicker/index.d.ts +2 -2
- package/es/components/molecules/ColorPicker/CustomPicker/index.js +117 -117
- package/es/components/molecules/ColorPicker/CustomPicker/styled.d.ts +9 -9
- package/es/components/molecules/ColorPicker/CustomPicker/styled.js +104 -104
- package/es/components/molecules/ColorPicker/SketchPicker/index.d.ts +10 -10
- package/es/components/molecules/ColorPicker/SketchPicker/index.js +5 -5
- package/es/components/molecules/ColorPicker/SketchPicker/styled.d.ts +1 -1
- package/es/components/molecules/ColorPicker/SketchPicker/styled.js +10 -10
- package/es/components/molecules/ColorPicker/index.d.ts +14 -14
- package/es/components/molecules/ColorPicker/index.js +96 -96
- package/es/components/molecules/ColorPicker/styled.d.ts +1 -1
- package/es/components/molecules/ColorPicker/styled.js +10 -10
- package/es/components/molecules/ColorSetting/index.d.ts +14 -14
- package/es/components/molecules/ColorSetting/index.js +97 -97
- package/es/components/molecules/ColorSetting/styled.d.ts +7 -7
- package/es/components/molecules/ColorSetting/styled.js +42 -42
- package/es/components/molecules/DatePicker/DatePicker.d.ts +8 -8
- package/es/components/molecules/DatePicker/DatePicker.js +8 -8
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.d.ts +32 -32
- package/es/components/molecules/DatePicker/components/AdvancedPicker/AdvancedPicker.js +439 -439
- package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.d.ts +106 -106
- package/es/components/molecules/DatePicker/components/AdvancedPicker/constants.js +197 -197
- package/es/components/molecules/DatePicker/components/AdvancedPicker/index.d.ts +3 -3
- package/es/components/molecules/DatePicker/components/AdvancedPicker/index.js +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.d.ts +9 -9
- package/es/components/molecules/DatePicker/components/AdvancedPicker/styled.js +100 -100
- package/es/components/molecules/DatePicker/components/AdvancedPicker/types.d.ts +36 -36
- package/es/components/molecules/DatePicker/components/AdvancedPicker/types.js +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.d.ts +39 -39
- package/es/components/molecules/DatePicker/components/AdvancedPicker/utils.js +211 -211
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.d.ts +18 -18
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/AdvancedRangePicker.js +83 -83
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.d.ts +5 -5
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/constants.js +5 -5
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/index.d.ts +2 -2
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/index.js +1 -1
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/types.d.ts +18 -18
- package/es/components/molecules/DatePicker/components/AdvancedRangePicker/types.js +1 -1
- package/es/components/molecules/DatePicker/components/DropdownLabel/DropdownLabel.d.ts +13 -13
- package/es/components/molecules/DatePicker/components/DropdownLabel/DropdownLabel.js +87 -87
- package/es/components/molecules/DatePicker/components/ErrorMessage/ErrorMessage.d.ts +6 -6
- package/es/components/molecules/DatePicker/components/ErrorMessage/ErrorMessage.js +12 -12
- package/es/components/molecules/DatePicker/index.d.ts +3 -3
- package/es/components/molecules/DatePicker/index.js +1 -1
- package/es/components/molecules/Drawer/Drawer.d.ts +5 -5
- package/es/components/molecules/Drawer/Drawer.js +4 -4
- package/es/components/molecules/Drawer/index.d.ts +2 -2
- package/es/components/molecules/Drawer/index.js +1 -1
- package/es/components/molecules/Dropdown/Dropdown.d.ts +1 -1
- package/es/components/molecules/Dropdown/Dropdown.js +1 -1
- package/es/components/molecules/Dropdown/index.d.ts +1 -1
- package/es/components/molecules/Dropdown/index.js +1 -1
- package/es/components/molecules/EdgeSetting/index.d.ts +39 -39
- package/es/components/molecules/EdgeSetting/index.js +192 -192
- package/es/components/molecules/EdgeSetting/styled.d.ts +3 -3
- package/es/components/molecules/EdgeSetting/styled.js +18 -18
- package/es/components/molecules/EditorScript/EditorScript.d.ts +25 -14
- package/es/components/molecules/EditorScript/EditorScript.js +89 -89
- package/es/components/molecules/EditorScript/index.d.ts +1 -1
- package/es/components/molecules/EditorScript/index.js +1 -1
- package/es/components/molecules/EditorScript/styled.d.ts +1 -1
- package/es/components/molecules/EditorScript/styled.js +3 -3
- package/es/components/molecules/FontFamilySelect/constants.d.ts +307 -307
- package/es/components/molecules/FontFamilySelect/constants.js +257 -257
- package/es/components/molecules/FontFamilySelect/index.d.ts +17 -17
- package/es/components/molecules/FontFamilySelect/index.js +53 -53
- package/es/components/molecules/FontSetting/constants.d.ts +3 -3
- package/es/components/molecules/FontSetting/constants.js +22 -22
- package/es/components/molecules/FontSetting/index.d.ts +24 -24
- package/es/components/molecules/FontSetting/index.js +54 -54
- package/es/components/molecules/FontSetting/types.d.ts +22 -22
- package/es/components/molecules/FontSetting/types.js +1 -1
- package/es/components/molecules/FontWeightSelect/constants.d.ts +28 -28
- package/es/components/molecules/FontWeightSelect/constants.js +11 -11
- package/es/components/molecules/FontWeightSelect/index.d.ts +9 -9
- package/es/components/molecules/FontWeightSelect/index.js +39 -39
- package/es/components/molecules/Form/Form.d.ts +1 -1
- package/es/components/molecules/Form/Form.js +1 -1
- package/es/components/molecules/Form/index.d.ts +1 -1
- package/es/components/molecules/Form/index.js +1 -1
- package/es/components/molecules/GradientSetting/index.d.ts +36 -36
- package/es/components/molecules/GradientSetting/index.js +99 -99
- package/es/components/molecules/GradientSetting/styled.d.ts +1 -1
- package/es/components/molecules/GradientSetting/styled.js +59 -59
- package/es/components/molecules/IconSelection/components/Icon/index.d.ts +10 -10
- package/es/components/molecules/IconSelection/components/Icon/index.js +28 -28
- package/es/components/molecules/IconSelection/constants.d.ts +56 -56
- package/es/components/molecules/IconSelection/constants.js +89 -89
- package/es/components/molecules/IconSelection/index.d.ts +3 -3
- package/es/components/molecules/IconSelection/index.js +143 -143
- package/es/components/molecules/IconSelection/styled.d.ts +8 -8
- package/es/components/molecules/IconSelection/styled.js +80 -80
- package/es/components/molecules/IconSelection/types.d.ts +26 -26
- package/es/components/molecules/IconSelection/types.js +2 -2
- package/es/components/molecules/IconSelection/utils.d.ts +4 -4
- package/es/components/molecules/IconSelection/utils.js +13 -13
- package/es/components/molecules/InputNumber/index.d.ts +9 -9
- package/es/components/molecules/InputNumber/index.js +81 -81
- package/es/components/molecules/InputNumberWithUnit/index.d.ts +31 -31
- package/es/components/molecules/InputNumberWithUnit/index.js +37 -37
- package/es/components/molecules/InputNumberWithUnit/styled.d.ts +1 -1
- package/es/components/molecules/InputNumberWithUnit/styled.js +20 -20
- package/es/components/molecules/InputSearch/index.d.ts +7 -7
- package/es/components/molecules/InputSearch/index.js +23 -23
- package/es/components/molecules/InputSearch/styled.d.ts +1 -1
- package/es/components/molecules/InputSearch/styled.js +48 -48
- package/es/components/molecules/Modal/Modal.d.ts +23 -23
- package/es/components/molecules/Modal/Modal.js +26 -26
- package/es/components/molecules/Modal/index.d.ts +2 -2
- package/es/components/molecules/Modal/index.js +1 -1
- package/es/components/molecules/Modal/styled.d.ts +15 -15
- package/es/components/molecules/Modal/styled.js +80 -80
- package/es/components/molecules/ModalV2/ModalV2.d.ts +5 -5
- package/es/components/molecules/ModalV2/ModalV2.js +26 -26
- package/es/components/molecules/ModalV2/index.d.ts +2 -2
- package/es/components/molecules/ModalV2/index.js +1 -1
- package/es/components/molecules/ModalV2/styled.d.ts +7 -7
- package/es/components/molecules/ModalV2/styled.js +22 -22
- package/es/components/molecules/Popconfirm/Popconfirm.d.ts +4 -4
- package/es/components/molecules/Popconfirm/Popconfirm.js +2 -2
- package/es/components/molecules/Popconfirm/index.d.ts +1 -1
- package/es/components/molecules/Popconfirm/index.js +1 -1
- package/es/components/molecules/PopupDraggable/PopupDraggable.d.ts +6 -6
- package/es/components/molecules/PopupDraggable/PopupDraggable.js +52 -52
- package/es/components/molecules/PopupDraggable/index.d.ts +1 -1
- package/es/components/molecules/PopupDraggable/index.js +1 -1
- package/es/components/molecules/PopupDraggable/styled.d.ts +5 -5
- package/es/components/molecules/PopupDraggable/styled.js +52 -52
- package/es/components/molecules/PopupDraggable/types.d.ts +15 -15
- package/es/components/molecules/PopupDraggable/types.js +1 -1
- package/es/components/molecules/PreviewModal/PreviewModal.d.ts +7 -7
- package/es/components/molecules/PreviewModal/PreviewModal.js +30 -30
- package/es/components/molecules/PreviewModal/index.d.ts +2 -2
- package/es/components/molecules/PreviewModal/index.js +1 -1
- package/es/components/molecules/PreviewModal/styled.d.ts +4 -4
- package/es/components/molecules/PreviewModal/styled.js +39 -39
- package/es/components/molecules/RadioGroup/index.d.ts +7 -7
- package/es/components/molecules/RadioGroup/index.js +23 -23
- package/es/components/molecules/RadioGroup/styled.d.ts +3 -3
- package/es/components/molecules/RadioGroup/styled.js +14 -14
- package/es/components/molecules/ResizeGrid/ResizeGrid.d.ts +3 -3
- package/es/components/molecules/ResizeGrid/ResizeGrid.js +736 -736
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.d.ts +3 -3
- package/es/components/molecules/ResizeGrid/components/Cell/Cell.js +87 -87
- package/es/components/molecules/ResizeGrid/components/Cell/index.d.ts +1 -1
- package/es/components/molecules/ResizeGrid/components/Cell/index.js +1 -1
- package/es/components/molecules/ResizeGrid/components/Cell/styled.d.ts +3 -3
- package/es/components/molecules/ResizeGrid/components/Cell/styled.js +80 -80
- package/es/components/molecules/ResizeGrid/constant.d.ts +35 -35
- package/es/components/molecules/ResizeGrid/constant.js +111 -111
- package/es/components/molecules/ResizeGrid/index.d.ts +2 -2
- package/es/components/molecules/ResizeGrid/index.js +1 -1
- package/es/components/molecules/ResizeGrid/styled.d.ts +10 -10
- package/es/components/molecules/ResizeGrid/styled.js +56 -56
- package/es/components/molecules/ResizeGrid/types.d.ts +148 -148
- package/es/components/molecules/ResizeGrid/types.js +1 -1
- package/es/components/molecules/Result/Result.d.ts +1 -1
- package/es/components/molecules/Result/Result.js +2 -2
- package/es/components/molecules/Result/index.d.ts +1 -1
- package/es/components/molecules/Result/index.js +1 -1
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.d.ts +14 -14
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuBlock.js +53 -53
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.d.ts +18 -18
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/index.js +110 -110
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.d.ts +20 -20
- package/es/components/molecules/RichMenu/RichMenuBlock/RichMenuCell/styled.js +135 -135
- package/es/components/molecules/RichMenu/RichMenuBlock/constants.d.ts +2 -2
- package/es/components/molecules/RichMenu/RichMenuBlock/constants.js +765 -765
- package/es/components/molecules/RichMenu/RichMenuBlock/index.d.ts +3 -3
- package/es/components/molecules/RichMenu/RichMenuBlock/index.js +2 -2
- package/es/components/molecules/RichMenu/RichMenuBlock/styled.d.ts +9 -9
- package/es/components/molecules/RichMenu/RichMenuBlock/styled.js +17 -17
- package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.d.ts +10 -10
- package/es/components/molecules/RichMenu/RichMenuChatBar/RichMenuChatBar.js +32 -32
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.d.ts +6 -6
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/index.js +15 -15
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.d.ts +4 -4
- package/es/components/molecules/RichMenu/RichMenuChatBar/TypingChat/styled.js +47 -47
- package/es/components/molecules/RichMenu/RichMenuChatBar/index.d.ts +2 -2
- package/es/components/molecules/RichMenu/RichMenuChatBar/index.js +1 -1
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.d.ts +9 -9
- package/es/components/molecules/RichMenu/RichMenuChatBar/styled.js +37 -37
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.d.ts +11 -11
- package/es/components/molecules/RichMenu/RichMenuMobileView/RichMenuMobileView.js +37 -37
- package/es/components/molecules/RichMenu/RichMenuMobileView/index.d.ts +1 -1
- package/es/components/molecules/RichMenu/RichMenuMobileView/index.js +1 -1
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.d.ts +6 -6
- package/es/components/molecules/RichMenu/RichMenuMobileView/styled.js +20 -20
- package/es/components/molecules/RichMenu/index.d.ts +3 -3
- package/es/components/molecules/RichMenu/index.js +3 -3
- package/es/components/molecules/Select/Select.d.ts +17 -17
- package/es/components/molecules/Select/Select.js +50 -50
- package/es/components/molecules/Select/Test.d.ts +3 -3
- package/es/components/molecules/Select/Test.js +22 -22
- package/es/components/molecules/Select/index.d.ts +2 -2
- package/es/components/molecules/Select/index.js +1 -1
- package/es/components/molecules/Select/styled.d.ts +4 -4
- package/es/components/molecules/Select/styled.js +41 -41
- package/es/components/molecules/SettingWrapper/index.d.ts +12 -12
- package/es/components/molecules/SettingWrapper/index.js +20 -20
- package/es/components/molecules/SettingWrapper/styled.d.ts +5 -5
- package/es/components/molecules/SettingWrapper/styled.js +17 -17
- package/es/components/molecules/SettingWrapperPopover/index.d.ts +16 -16
- package/es/components/molecules/SettingWrapperPopover/index.js +17 -17
- package/es/components/molecules/ShareAccess/ShareAccess.d.ts +3 -3
- package/es/components/molecules/ShareAccess/ShareAccess.js +23 -23
- package/es/components/molecules/ShareAccess/actions.d.ts +16 -16
- package/es/components/molecules/ShareAccess/actions.js +12 -12
- package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.d.ts +2 -2
- package/es/components/molecules/ShareAccess/components/GeneralAccess/GeneralAccess.js +78 -78
- package/es/components/molecules/ShareAccess/components/GeneralAccess/index.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/GeneralAccess/index.js +1 -1
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/GeneralAccess/styled.js +57 -57
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.d.ts +3 -3
- package/es/components/molecules/ShareAccess/components/LayoutContent/LayoutContent.js +19 -19
- package/es/components/molecules/ShareAccess/components/LayoutContent/index.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/LayoutContent/index.js +1 -1
- package/es/components/molecules/ShareAccess/components/LayoutContent/styled.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/LayoutContent/styled.js +7 -7
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/ModalTransferOwnerShip.d.ts +2 -2
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/ModalTransferOwnerShip.js +43 -43
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/index.js +1 -1
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.d.ts +7 -7
- package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.js +18 -18
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.d.ts +5 -5
- package/es/components/molecules/ShareAccess/components/PeopleAccess/PeopleAccess.js +97 -97
- package/es/components/molecules/ShareAccess/components/PeopleAccess/index.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/PeopleAccess/index.js +1 -1
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/PeopleAccess/styled.js +46 -46
- package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.d.ts +5 -5
- package/es/components/molecules/ShareAccess/components/SearchUser/SearchUser.js +73 -73
- package/es/components/molecules/ShareAccess/components/SearchUser/index.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/SearchUser/index.js +1 -1
- package/es/components/molecules/ShareAccess/components/SearchUser/styled.d.ts +2 -2
- package/es/components/molecules/ShareAccess/components/SearchUser/styled.js +29 -29
- package/es/components/molecules/ShareAccess/components/index.d.ts +1 -1
- package/es/components/molecules/ShareAccess/components/index.js +1 -1
- package/es/components/molecules/ShareAccess/constants.d.ts +67 -67
- package/es/components/molecules/ShareAccess/constants.js +85 -85
- package/es/components/molecules/ShareAccess/context.d.ts +4 -4
- package/es/components/molecules/ShareAccess/context.js +3 -3
- package/es/components/molecules/ShareAccess/hooks/index.d.ts +1 -1
- package/es/components/molecules/ShareAccess/hooks/index.js +1 -1
- package/es/components/molecules/ShareAccess/hooks/useShareAccess.d.ts +18 -18
- package/es/components/molecules/ShareAccess/hooks/useShareAccess.js +29 -29
- package/es/components/molecules/ShareAccess/index.d.ts +4 -3
- package/es/components/molecules/ShareAccess/index.js +4 -3
- package/es/components/molecules/ShareAccess/reducer.d.ts +2 -2
- package/es/components/molecules/ShareAccess/reducer.js +19 -19
- package/es/components/molecules/ShareAccess/types.d.ts +55 -55
- package/es/components/molecules/ShareAccess/types.js +1 -1
- package/es/components/molecules/ShareAccess/utils.d.ts +38 -38
- package/es/components/molecules/ShareAccess/utils.js +57 -57
- package/es/components/molecules/SliderWithInputNumber/index.d.ts +11 -11
- package/es/components/molecules/SliderWithInputNumber/index.js +62 -62
- package/es/components/molecules/SliderWithInputNumber/styled.d.ts +1 -1
- package/es/components/molecules/SliderWithInputNumber/styled.js +8 -8
- package/es/components/molecules/Tabs/Tabs.d.ts +1 -1
- package/es/components/molecules/Tabs/Tabs.js +1 -1
- package/es/components/molecules/Tabs/index.d.ts +1 -1
- package/es/components/molecules/Tabs/index.js +1 -1
- package/es/components/molecules/TextDecorationSelect/constants.d.ts +19 -19
- package/es/components/molecules/TextDecorationSelect/constants.js +26 -26
- package/es/components/molecules/TextDecorationSelect/index.d.ts +15 -15
- package/es/components/molecules/TextDecorationSelect/index.js +45 -45
- package/es/components/molecules/TextTransformSelect/constants.d.ts +13 -13
- package/es/components/molecules/TextTransformSelect/constants.js +19 -19
- package/es/components/molecules/TextTransformSelect/index.d.ts +9 -9
- package/es/components/molecules/TextTransformSelect/index.js +39 -39
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.d.ts +3 -3
- package/es/components/molecules/ThumbnailCard/ThumbnailCard.js +72 -72
- package/es/components/molecules/ThumbnailCard/constants.d.ts +3 -3
- package/es/components/molecules/ThumbnailCard/constants.js +3 -3
- package/es/components/molecules/ThumbnailCard/index.d.ts +2 -2
- package/es/components/molecules/ThumbnailCard/index.js +2 -2
- package/es/components/molecules/ThumbnailCard/styled.d.ts +1 -1
- package/es/components/molecules/ThumbnailCard/styled.js +89 -89
- package/es/components/molecules/ThumbnailCard/types.d.ts +20 -20
- package/es/components/molecules/ThumbnailCard/types.js +1 -1
- package/es/components/molecules/TreeSelect/TreeSelect.d.ts +11 -11
- package/es/components/molecules/TreeSelect/TreeSelect.js +2 -2
- package/es/components/molecules/TreeSelect/index.d.ts +1 -1
- package/es/components/molecules/TreeSelect/index.js +1 -1
- package/es/components/molecules/UploadImage/MediaIcon.d.ts +3 -3
- package/es/components/molecules/UploadImage/MediaIcon.js +8 -8
- package/es/components/molecules/UploadImage/MediaThumb.d.ts +8 -8
- package/es/components/molecules/UploadImage/MediaThumb.js +15 -15
- package/es/components/molecules/UploadImage/VideoThumbnail.d.ts +4 -4
- package/es/components/molecules/UploadImage/VideoThumbnail.js +43 -43
- package/es/components/molecules/UploadImage/index.d.ts +37 -37
- package/es/components/molecules/UploadImage/index.js +386 -386
- package/es/components/molecules/UploadImage/styled.d.ts +13 -13
- package/es/components/molecules/UploadImage/styled.js +130 -130
- package/es/components/molecules/UploadImage/utils.d.ts +3 -3
- package/es/components/molecules/UploadImage/utils.js +24 -24
- package/es/components/molecules/index.d.ts +48 -48
- package/es/components/molecules/index.js +41 -41
- package/es/components/organism/GenerativeInsights/constants.d.ts +1 -1
- package/es/components/organism/GenerativeInsights/constants.js +1 -1
- package/es/components/organism/GenerativeInsights/index.d.ts +11 -11
- package/es/components/organism/GenerativeInsights/index.js +57 -57
- package/es/components/organism/GenerativeInsights/styled.d.ts +12 -12
- package/es/components/organism/GenerativeInsights/styled.js +66 -66
- package/es/components/organism/GenerativeInsights/utils.d.ts +13 -13
- package/es/components/organism/GenerativeInsights/utils.js +50 -50
- package/es/components/organism/Help/Help.d.ts +5 -5
- package/es/components/organism/Help/Help.js +1005 -1005
- package/es/components/organism/Help/constants.d.ts +140 -140
- package/es/components/organism/Help/constants.js +1653 -1653
- package/es/components/organism/Help/index.d.ts +1 -1
- package/es/components/organism/Help/index.js +1 -1
- package/es/components/organism/Help/styled.d.ts +71 -71
- package/es/components/organism/Help/styled.js +264 -264
- package/es/components/organism/Help/types.d.ts +67 -67
- package/es/components/organism/Help/types.js +1 -1
- package/es/components/organism/Help/utils.d.ts +15 -15
- package/es/components/organism/Help/utils.js +82 -82
- package/es/components/organism/Menu/Menu.d.ts +1 -1
- package/es/components/organism/Menu/Menu.js +1 -1
- package/es/components/organism/Menu/index.d.ts +1 -1
- package/es/components/organism/Menu/index.js +3 -3
- package/es/components/organism/PositionSetting/config.d.ts +10 -10
- package/es/components/organism/PositionSetting/config.js +10 -10
- package/es/components/organism/PositionSetting/index.d.ts +15 -15
- package/es/components/organism/PositionSetting/index.js +62 -62
- package/es/components/organism/PositionSetting/styled.d.ts +1 -1
- package/es/components/organism/PositionSetting/styled.js +3 -3
- package/es/components/organism/PositionSetting/types.d.ts +10 -10
- package/es/components/organism/PositionSetting/types.js +1 -1
- package/es/components/organism/Table/CrossTabTable/CrossTabTable.d.ts +18 -18
- package/es/components/organism/Table/CrossTabTable/CrossTabTable.js +305 -305
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/CustomCell.d.ts +11 -11
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/CustomCell.js +22 -22
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/index.d.ts +1 -1
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/index.js +1 -1
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.d.ts +1 -1
- package/es/components/organism/Table/CrossTabTable/components/CustomCell/styled.js +13 -13
- package/es/components/organism/Table/CrossTabTable/constants.d.ts +75 -75
- package/es/components/organism/Table/CrossTabTable/constants.js +1525 -1525
- package/es/components/organism/Table/CrossTabTable/index.d.ts +1 -1
- package/es/components/organism/Table/CrossTabTable/index.js +1 -1
- package/es/components/organism/Table/CrossTabTable/styled.d.ts +1 -1
- package/es/components/organism/Table/CrossTabTable/styled.js +13 -13
- package/es/components/organism/Table/CrossTabTable/types.d.ts +1 -1
- package/es/components/organism/Table/CrossTabTable/types.js +1 -1
- package/es/components/organism/Table/CrossTabTable/utils.d.ts +1 -1
- package/es/components/organism/Table/CrossTabTable/utils.js +1 -1
- package/es/components/organism/Table/ExplorePivotTable/ExplorePivotTable.d.ts +11 -11
- package/es/components/organism/Table/ExplorePivotTable/ExplorePivotTable.js +51 -51
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/CustomCell.d.ts +12 -12
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/CustomCell.js +41 -41
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/index.d.ts +1 -1
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/index.js +1 -1
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.d.ts +3 -3
- package/es/components/organism/Table/ExplorePivotTable/components/CustomCell/styled.js +21 -21
- package/es/components/organism/Table/ExplorePivotTable/constants.d.ts +4 -4
- package/es/components/organism/Table/ExplorePivotTable/constants.js +84 -84
- package/es/components/organism/Table/ExplorePivotTable/index.d.ts +2 -2
- package/es/components/organism/Table/ExplorePivotTable/index.js +2 -2
- package/es/components/organism/Table/ExplorePivotTable/styled.d.ts +12 -12
- package/es/components/organism/Table/ExplorePivotTable/styled.js +15 -15
- package/es/components/organism/Table/ExplorePivotTable/types.d.ts +17 -17
- package/es/components/organism/Table/ExplorePivotTable/types.js +1 -1
- package/es/components/organism/Table/ExplorePivotTable/utils.d.ts +4 -4
- package/es/components/organism/Table/ExplorePivotTable/utils.js +154 -154
- package/es/components/organism/Table/Table.d.ts +1 -1
- package/es/components/organism/Table/Table.js +1 -1
- package/es/components/organism/Table/index.d.ts +2 -2
- package/es/components/organism/Table/index.js +2 -2
- package/es/components/organism/index.d.ts +5 -5
- package/es/components/organism/index.js +5 -5
- package/es/components/template/TemplateListing/components/BlankTemplate/index.d.ts +3 -3
- package/es/components/template/TemplateListing/components/BlankTemplate/index.js +17 -17
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.d.ts +2 -2
- package/es/components/template/TemplateListing/components/BlankTemplate/styled.js +26 -26
- package/es/components/template/TemplateListing/components/CategoryListing/index.d.ts +3 -3
- package/es/components/template/TemplateListing/components/CategoryListing/index.js +108 -108
- package/es/components/template/TemplateListing/components/CategoryListing/styled.d.ts +7 -7
- package/es/components/template/TemplateListing/components/CategoryListing/styled.js +77 -77
- package/es/components/template/TemplateListing/components/CategoryListing/types.d.ts +11 -11
- package/es/components/template/TemplateListing/components/CategoryListing/types.js +1 -1
- package/es/components/template/TemplateListing/components/index.d.ts +2 -2
- package/es/components/template/TemplateListing/components/index.js +2 -2
- package/es/components/template/TemplateListing/constants/defaultProps.d.ts +10 -10
- package/es/components/template/TemplateListing/constants/defaultProps.js +22 -22
- package/es/components/template/TemplateListing/constants/index.d.ts +2 -2
- package/es/components/template/TemplateListing/constants/index.js +2 -2
- package/es/components/template/TemplateListing/constants/mockData.d.ts +2 -2
- package/es/components/template/TemplateListing/constants/mockData.js +101 -101
- package/es/components/template/TemplateListing/index.d.ts +3 -3
- package/es/components/template/TemplateListing/index.js +21 -21
- package/es/components/template/TemplateListing/styled/index.d.ts +2 -2
- package/es/components/template/TemplateListing/styled/index.js +16 -16
- package/es/components/template/TemplateListing/types/BlankTemplate.d.ts +9 -9
- package/es/components/template/TemplateListing/types/BlankTemplate.js +1 -1
- package/es/components/template/TemplateListing/types/CategoryListing.d.ts +18 -18
- package/es/components/template/TemplateListing/types/CategoryListing.js +1 -1
- package/es/components/template/TemplateListing/types/TemplateListing.d.ts +16 -16
- package/es/components/template/TemplateListing/types/TemplateListing.js +1 -1
- package/es/components/template/TemplateListing/types/index.d.ts +3 -3
- package/es/components/template/TemplateListing/types/index.js +3 -3
- package/es/components/template/index.d.ts +2 -2
- package/es/components/template/index.js +2 -2
- package/es/constants/gradientSetting.d.ts +83 -83
- package/es/constants/gradientSetting.js +86 -86
- package/es/constants/index.d.ts +4 -4
- package/es/constants/index.js +4 -4
- package/es/constants/keyCode.d.ts +387 -387
- package/es/constants/keyCode.js +394 -394
- package/es/constants/queries.d.ts +14 -14
- package/es/constants/queries.js +21 -21
- package/es/constants/richMenu.d.ts +19 -19
- package/es/constants/richMenu.js +19 -19
- package/es/constants/storybook.d.ts +17 -17
- package/es/constants/storybook.js +36 -36
- package/es/constants/theme.d.ts +12 -12
- package/es/constants/theme.js +173 -173
- package/es/hooks/index.d.ts +3 -3
- package/es/hooks/index.js +22 -22
- package/es/hooks/useDebounce.d.ts +3 -3
- package/es/hooks/useDebounce.js +15 -15
- package/es/hooks/useDebounceCallback.d.ts +1 -1
- package/es/hooks/useDebounceCallback.js +5 -5
- package/es/hooks/useDebounceV2.d.ts +1 -1
- package/es/hooks/useDebounceV2.js +11 -11
- package/es/hooks/useDeepCompareEffect.d.ts +1 -1
- package/es/hooks/useDeepCompareEffect.js +21 -21
- package/es/hooks/useDeepCompareMemo.d.ts +2 -2
- package/es/hooks/useDeepCompareMemo.js +21 -21
- package/es/hooks/useOutsideClick.d.ts +4 -4
- package/es/hooks/useOutsideClick.js +18 -18
- package/es/hooks/usePrevious.d.ts +2 -2
- package/es/hooks/usePrevious.js +9 -9
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/locales/en/translation.json +232 -232
- package/es/locales/i18n.d.ts +307 -307
- package/es/locales/i18n.js +38 -38
- package/es/locales/translations.d.ts +236 -236
- package/es/locales/translations.js +35 -35
- package/es/locales/types.d.ts +15 -15
- package/es/locales/types.js +1 -1
- package/es/locales/vi/translation.json +67 -67
- package/es/models/BusinessObject.d.ts +116 -116
- package/es/models/BusinessObject.js +113 -113
- package/es/models/Currency.d.ts +9 -9
- package/es/models/Currency.js +10 -10
- package/es/models/CustomFunction.d.ts +19 -19
- package/es/models/CustomFunction.js +25 -25
- package/es/models/DynamicContentAttribute.d.ts +34 -34
- package/es/models/DynamicContentAttribute.js +9 -9
- package/es/models/EventTrackingAttribute.d.ts +11 -11
- package/es/models/EventTrackingAttribute.js +13 -13
- package/es/models/PromotionPool.d.ts +11 -11
- package/es/models/PromotionPool.js +12 -12
- package/es/models/SavedMedia.d.ts +34 -34
- package/es/models/SavedMedia.js +30 -30
- package/es/models/Upload.d.ts +34 -34
- package/es/models/Upload.js +24 -24
- package/es/models/model.d.ts +8 -8
- package/es/models/model.js +5 -5
- package/es/queries/BusinessObject/index.d.ts +6 -6
- package/es/queries/BusinessObject/index.js +6 -6
- package/es/queries/BusinessObject/useGetListAllEvents.d.ts +11 -11
- package/es/queries/BusinessObject/useGetListAllEvents.js +14 -14
- package/es/queries/BusinessObject/useGetListAttributeBO.d.ts +17 -17
- package/es/queries/BusinessObject/useGetListAttributeBO.js +41 -41
- package/es/queries/BusinessObject/useGetListBO.d.ts +6 -6
- package/es/queries/BusinessObject/useGetListBO.js +19 -19
- package/es/queries/BusinessObject/useGetListEventAttr.d.ts +4 -4
- package/es/queries/BusinessObject/useGetListEventAttr.js +15 -15
- package/es/queries/BusinessObject/useGetListPromotionCodeAttr.d.ts +6 -6
- package/es/queries/BusinessObject/useGetListPromotionCodeAttr.js +26 -26
- package/es/queries/BusinessObject/useGetListSourceByEvent.d.ts +13 -13
- package/es/queries/BusinessObject/useGetListSourceByEvent.js +11 -11
- package/es/queries/CustomFunction/index.d.ts +2 -2
- package/es/queries/CustomFunction/index.js +2 -2
- package/es/queries/CustomFunction/useCustomFunction.d.ts +19 -19
- package/es/queries/CustomFunction/useCustomFunction.js +53 -53
- package/es/queries/DynamicContentAttribute/index.d.ts +1 -1
- package/es/queries/DynamicContentAttribute/index.js +1 -1
- package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.d.ts +10 -10
- package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.js +21 -21
- package/es/queries/PromotionPool/index.d.ts +1 -1
- package/es/queries/PromotionPool/index.js +1 -1
- package/es/queries/PromotionPool/useGetListPromotionPool.d.ts +9 -9
- package/es/queries/PromotionPool/useGetListPromotionPool.js +62 -62
- package/es/queries/ThirdParty/index.d.ts +1 -1
- package/es/queries/ThirdParty/index.js +1 -1
- package/es/queries/ThirdParty/useGetEventTrackingAttributes.d.ts +14 -14
- package/es/queries/ThirdParty/useGetEventTrackingAttributes.js +15 -15
- package/es/queries/configs.d.ts +4 -4
- package/es/queries/configs.js +13 -13
- package/es/queries/index.d.ts +6 -6
- package/es/queries/index.js +6 -6
- package/es/services/MediaTemplateDesign/BusinessObject/index.d.ts +8 -8
- package/es/services/MediaTemplateDesign/BusinessObject/index.js +100 -100
- package/es/services/MediaTemplateDesign/CustomFunction/index.d.ts +15 -15
- package/es/services/MediaTemplateDesign/CustomFunction/index.js +135 -135
- package/es/services/MediaTemplateDesign/DynamicContentAttribute/index.d.ts +4 -4
- package/es/services/MediaTemplateDesign/DynamicContentAttribute/index.js +39 -39
- package/es/services/MediaTemplateDesign/ListCurrency/index.d.ts +6 -6
- package/es/services/MediaTemplateDesign/ListCurrency/index.js +34 -34
- package/es/services/MediaTemplateDesign/PromotionPool/index.d.ts +3 -3
- package/es/services/MediaTemplateDesign/PromotionPool/index.js +31 -31
- package/es/services/MediaTemplateDesign/UploadFile/index.d.ts +6 -6
- package/es/services/MediaTemplateDesign/UploadFile/index.js +93 -93
- package/es/services/ThirParty/index.d.ts +8 -8
- package/es/services/ThirParty/index.js +26 -26
- package/es/services/Ticket.d.ts +67 -67
- package/es/services/Ticket.js +73 -73
- package/es/services/constants.d.ts +20 -20
- package/es/services/constants.js +21 -21
- package/es/services/index.d.ts +18 -18
- package/es/services/index.js +108 -108
- package/es/test.d.ts +14 -14
- package/es/test.js +376 -376
- package/es/types/index.d.ts +23 -23
- package/es/types/index.js +2 -2
- package/es/types/richMenu.d.ts +214 -214
- package/es/types/richMenu.js +1 -1
- package/es/types/variables.d.ts +2 -2
- package/es/types/variables.js +1 -1
- package/es/utils/color.d.ts +10 -10
- package/es/utils/color.js +61 -61
- package/es/utils/common.d.ts +58 -58
- package/es/utils/common.js +379 -379
- package/es/utils/handleError.d.ts +32 -32
- package/es/utils/handleError.js +44 -44
- package/es/utils/index.d.ts +3 -3
- package/es/utils/index.js +3 -3
- package/es/utils/loadable.d.ts +7 -7
- package/es/utils/loadable.js +10 -10
- package/es/utils/web.d.ts +10 -10
- package/es/utils/web.js +26 -26
- package/package.json +204 -204
|
@@ -1,1248 +1,1248 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
/* eslint-disable no-case-declarations */
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
14
|
-
// Libraries
|
|
15
|
-
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
|
16
|
-
import { omit, isEmpty, flatMapDeep, set, get, isNaN } from 'lodash';
|
|
17
|
-
// Hooks
|
|
18
|
-
import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
19
|
-
// Components
|
|
20
|
-
import { TreeNode } from 'rc-tree-select';
|
|
21
|
-
import { Button, Checkbox, Text, Spin } from '../../atoms';
|
|
22
|
-
import { TreeSelect, Form, Select } from 'antd';
|
|
23
|
-
// Locales
|
|
24
|
-
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
25
|
-
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
26
|
-
// Query
|
|
27
|
-
import { useGetDynamicContentAttr, useGetListPromotionPool, useGetListEventAttr, useGetListPromotionCodeAttr, useGetListBO, useGetListAllEvents, useGetListSourceByEvent, useGetListAttributeBO, useGetCustomFunction, useAddSavedCSFunction, useUpdateCSFunction, } from '@antscorp/antsomi-ui/es/queries';
|
|
28
|
-
import { useGetEventTrackingAttributes } from '@antscorp/antsomi-ui/es/queries/ThirdParty';
|
|
29
|
-
// Queries config
|
|
30
|
-
import { queryClientAntsomiUI } from '@antscorp/antsomi-ui/es/queries/configs';
|
|
31
|
-
import { QUERY_KEYS } from '@antscorp/antsomi-ui/es/constants/queries';
|
|
32
|
-
import { dateExample } from './components/FormatDatetime';
|
|
33
|
-
import DisplayFormat from './components/DisplayFormat';
|
|
34
|
-
// Constants
|
|
35
|
-
import { DYNAMIC_CONTENT_SETTING_KEY, DYNAMIC_CONTENT_TYPE, DYNAMIC_CONTENT_ATTR_DF_TYPE, DATA_TYPE, ATTRIBUTE_TYPE, } from './constants';
|
|
36
|
-
// Utils
|
|
37
|
-
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
38
|
-
import { formatDatetimeDF, formatNumberDF, getAvailableAttrs, getStringFormatDateDF, regexCSType, serilizeBOAttr, serializeCSSelectedString, serilizeDynamicContentAttr, serilizeEventAttr, serilizePromotionPool, buildOptionAttrArchive, checkStatusAttr, serializeLabelToCode, buildMappingFields, CUSTOM_TYPE, } from './utils';
|
|
39
|
-
// Style
|
|
40
|
-
import { InputSuggestion, ModalCustom } from './styled';
|
|
41
|
-
import { EditorScript } from '../EditorScript';
|
|
42
|
-
const getMembers = (member) => {
|
|
43
|
-
if (!member.children || !member.children.length) {
|
|
44
|
-
return member;
|
|
45
|
-
}
|
|
46
|
-
return [member, member.children];
|
|
47
|
-
};
|
|
48
|
-
const PATH = 'src/components/molecules/AddDynamicContent/AddDynamicContent.tsx';
|
|
49
|
-
const initNumberDFSettings = {
|
|
50
|
-
grouping: ',',
|
|
51
|
-
decimal: '.',
|
|
52
|
-
decimalPlaces: 2,
|
|
53
|
-
isCompact: false,
|
|
54
|
-
currencyCode: 'USD',
|
|
55
|
-
prefixType: 'code',
|
|
56
|
-
};
|
|
57
|
-
const initDatetimeDFSettings = {
|
|
58
|
-
hasDateFormat: true,
|
|
59
|
-
hasTimeFormat: true,
|
|
60
|
-
dateParseOption: 'medium',
|
|
61
|
-
timeParseOption: 'medium',
|
|
62
|
-
dateParseFormat: 'MM/DD/YYYY',
|
|
63
|
-
timeParseFormat: '12hour',
|
|
64
|
-
};
|
|
65
|
-
const defaultDynamicTypes = [...Object.values(DYNAMIC_CONTENT_TYPE)]
|
|
66
|
-
.filter((i) => i.value !== 'bo-settings')
|
|
67
|
-
.sort((a, b) => a.index - b.index);
|
|
68
|
-
const optionDataType = [...Object.values(DATA_TYPE)];
|
|
69
|
-
export const AddDynamicContent = props => {
|
|
70
|
-
//* Props
|
|
71
|
-
const { defaultData = {}, defaultDynamicIndex = 1, visible, showDisplayFormat, showIndex, journeySettings, contentSources, APIConfig, isShowCustomFunction = false, modalTitle, } = props;
|
|
72
|
-
const { accountId, userId, token, domain, slug } = APIConfig;
|
|
73
|
-
const infos = { accountId, userId, token };
|
|
74
|
-
const { onCancel, onOk, additionalAttrProperties = [] } = props;
|
|
75
|
-
const url = useMemo(() => `${domain}${slug}`, [domain, slug]);
|
|
76
|
-
// Hook Queries
|
|
77
|
-
const { mutate: addSavedCSFunction } = useAddSavedCSFunction();
|
|
78
|
-
const { data: customFunction } = useGetCustomFunction({ url }, infos);
|
|
79
|
-
const { mutate: updateCSFunction } = useUpdateCSFunction();
|
|
80
|
-
//* Hooks
|
|
81
|
-
const { t, language } = i18nInstance;
|
|
82
|
-
//* Selectors
|
|
83
|
-
const { triggerEvent } = journeySettings;
|
|
84
|
-
const [itemTypeId, setItemTypeId] = useState(null);
|
|
85
|
-
// Form states
|
|
86
|
-
const [form] = Form.useForm();
|
|
87
|
-
const selectedDynamicContentType = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE, form);
|
|
88
|
-
const selectedAttr = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, form);
|
|
89
|
-
const selectedDFType = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE, form);
|
|
90
|
-
const selectedEventSource = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.EVENT, form);
|
|
91
|
-
const selectedSource = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.SOURCE, form);
|
|
92
|
-
const selectedBoIndex = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.INDEX, form);
|
|
93
|
-
const [formSubmitDisabled, setFormSubmitDisabled] = useState(true);
|
|
94
|
-
const [saveAsTemplate, setsaveAsTemplate] = useState(false);
|
|
95
|
-
const [hasError, setHasError] = useState({
|
|
96
|
-
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: false,
|
|
97
|
-
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: false,
|
|
98
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
|
|
99
|
-
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false,
|
|
100
|
-
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false,
|
|
101
|
-
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: false,
|
|
102
|
-
[DYNAMIC_CONTENT_SETTING_KEY.PERNAME]: false,
|
|
103
|
-
});
|
|
104
|
-
// Queries
|
|
105
|
-
const { data: listBO } = useGetListBO({ url }, infos);
|
|
106
|
-
// defaultSettings
|
|
107
|
-
const [defaultAttrDFSetings, setDefaultAttrDFSetings] = useState(null);
|
|
108
|
-
// Variables
|
|
109
|
-
const [eventActionId, eventCategoryId] = (selectedEventSource === null || selectedEventSource === void 0 ? void 0 : selectedEventSource.split(':').map(Number)) || [];
|
|
110
|
-
// Selection Options states
|
|
111
|
-
const [listDynamicContentTypes, setListDynamicContentTypes] = useState(defaultDynamicTypes);
|
|
112
|
-
const [listCustomerAttributes, setListCustomerAttributes] = useState([]);
|
|
113
|
-
const [listVisitorAttributes, setListVisitorAttributes] = useState([]);
|
|
114
|
-
const [listCustomTemplates, setlistCustomTemplates] = useState([]);
|
|
115
|
-
const [listCustomTemplatesSearch, setlistCustomTemplatesSearch] = useState([]);
|
|
116
|
-
const [searchValue, setSearchValue] = useState('');
|
|
117
|
-
// Expanded keys in tree select
|
|
118
|
-
const [expandedEventAttributes, setExpandedEventAttributes] = useState([]);
|
|
119
|
-
const [isActionArchive, setActionArchive] = useState(false);
|
|
120
|
-
const [errorMessageAttr, setErrorMessageAttr] = useState();
|
|
121
|
-
// Number Display format
|
|
122
|
-
const [showDetailEditDF, setShowDetailEditDF] = useState(false);
|
|
123
|
-
const [formatedAttr, setFormatedAttr] = useState('');
|
|
124
|
-
const [attrDFSettings, setAttrDFSettings] = useState(undefined);
|
|
125
|
-
const [templateName, setTemplateName] = useState('');
|
|
126
|
-
const [attrDFOptions, setAttrDFOptions] = useState([]);
|
|
127
|
-
// Template Custom
|
|
128
|
-
const [templateId, settemplateId] = useState();
|
|
129
|
-
const { data: listBoAttributes = [], isFetching: isFetchingListBoAttr, isError: isErrorBoAttr, } = useGetListAttributeBO({
|
|
130
|
-
url,
|
|
131
|
-
itemTypeIds: itemTypeId ? [itemTypeId] : [],
|
|
132
|
-
options: {
|
|
133
|
-
onSuccess: (data) => {
|
|
134
|
-
setHasError({
|
|
135
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
|
|
136
|
-
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: false,
|
|
137
|
-
});
|
|
138
|
-
if (data.length &&
|
|
139
|
-
selectedDynamicContentType &&
|
|
140
|
-
regexCSType.test(selectedDynamicContentType)) {
|
|
141
|
-
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE) &&
|
|
142
|
-
form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.INDEX))
|
|
143
|
-
return;
|
|
144
|
-
form.setFieldsValue({
|
|
145
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: data[0],
|
|
146
|
-
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex,
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
select: (data) => serilizeBOAttr(data, additionalAttrProperties),
|
|
151
|
-
onError: (error) => {
|
|
152
|
-
setHasError({
|
|
153
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
|
|
154
|
-
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: true,
|
|
155
|
-
});
|
|
156
|
-
handleError(error, {
|
|
157
|
-
path: PATH,
|
|
158
|
-
name: 'useGetListAttributeBO',
|
|
159
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
160
|
-
});
|
|
161
|
-
},
|
|
162
|
-
enabled: !!itemTypeId,
|
|
163
|
-
},
|
|
164
|
-
}, infos);
|
|
165
|
-
const { data: dynamicContentAttr, isFetching: isFetchingDynamicContentAttr, isError: isErrorDynamicContentAttr, } = useGetDynamicContentAttr({ url }, infos, {
|
|
166
|
-
onSuccess: () => {
|
|
167
|
-
setHasError({
|
|
168
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
|
|
169
|
-
});
|
|
170
|
-
},
|
|
171
|
-
onError: (error) => {
|
|
172
|
-
setHasError({
|
|
173
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
|
|
174
|
-
});
|
|
175
|
-
handleError(error, {
|
|
176
|
-
path: PATH,
|
|
177
|
-
name: 'useGetDynamicContentAttr',
|
|
178
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
179
|
-
});
|
|
180
|
-
},
|
|
181
|
-
});
|
|
182
|
-
const { data: listSources, isFetching: isFetchingSourceBO } = useGetListSourceByEvent({
|
|
183
|
-
apiConfig: {
|
|
184
|
-
url,
|
|
185
|
-
},
|
|
186
|
-
infos,
|
|
187
|
-
eventActionId,
|
|
188
|
-
eventCategoryId,
|
|
189
|
-
options: {
|
|
190
|
-
onSuccess: () => {
|
|
191
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false });
|
|
192
|
-
},
|
|
193
|
-
select: (data) => {
|
|
194
|
-
const { rows } = data || {};
|
|
195
|
-
return rows.map((row) => ({
|
|
196
|
-
label: row.label,
|
|
197
|
-
value: row.value,
|
|
198
|
-
}));
|
|
199
|
-
},
|
|
200
|
-
onError: (error) => {
|
|
201
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: true });
|
|
202
|
-
handleError(error, {
|
|
203
|
-
path: PATH,
|
|
204
|
-
name: 'useGetListSourceBO',
|
|
205
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
const { data: listEvents, isFetching: isFetchingEventBySource } = useGetListAllEvents({
|
|
211
|
-
apiConfig: {
|
|
212
|
-
url,
|
|
213
|
-
},
|
|
214
|
-
infos,
|
|
215
|
-
options: {
|
|
216
|
-
onSuccess: (data) => {
|
|
217
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: false });
|
|
218
|
-
if (!isEmpty(data) &&
|
|
219
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
220
|
-
form.setFieldsValue({
|
|
221
|
-
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: data[0].value,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
onError: (error) => {
|
|
226
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: true });
|
|
227
|
-
handleError(error, {
|
|
228
|
-
path: PATH,
|
|
229
|
-
name: 'useGetListEventBySource',
|
|
230
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
231
|
-
});
|
|
232
|
-
},
|
|
233
|
-
select: (data) => {
|
|
234
|
-
const { rows = [] } = data || {};
|
|
235
|
-
return rows.map((event) => ({
|
|
236
|
-
label: event.label,
|
|
237
|
-
value: `${event.eventActionId}:${event.eventCategoryId}`,
|
|
238
|
-
}));
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
});
|
|
242
|
-
const { data: listEventAttributes, isFetching: isFetchingEventAttr, isError: isErrorEventAttr, } = useGetListEventAttr({ url }, infos, selectedEventSource || '', Array.isArray(selectedSource) ? selectedSource.join(',') : selectedSource || '', {
|
|
243
|
-
onSuccess: () => setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false }),
|
|
244
|
-
onError: (error) => {
|
|
245
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
|
|
246
|
-
handleError(error, {
|
|
247
|
-
path: PATH,
|
|
248
|
-
name: 'useGetListEventAttr',
|
|
249
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
250
|
-
});
|
|
251
|
-
},
|
|
252
|
-
select: (data) => serilizeEventAttr(data, language, additionalAttrProperties),
|
|
253
|
-
});
|
|
254
|
-
const { data: listPromotionPools, isFetching: isFetchingPromotionPool } = useGetListPromotionPool({ url }, infos, {
|
|
255
|
-
onSuccess: () => {
|
|
256
|
-
setHasError({
|
|
257
|
-
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false,
|
|
258
|
-
});
|
|
259
|
-
},
|
|
260
|
-
select: (data) => serilizePromotionPool(data, additionalAttrProperties),
|
|
261
|
-
onError: (error) => {
|
|
262
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
|
|
263
|
-
handleError(error, {
|
|
264
|
-
path: PATH,
|
|
265
|
-
name: 'useGetListPromotionPool',
|
|
266
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
267
|
-
});
|
|
268
|
-
},
|
|
269
|
-
});
|
|
270
|
-
const { data: listPromotionCodeAttributes, isFetching: isFetchingPromotionCodeAttr, isError: isErrorListPromotionCodeAttr, } = useGetListPromotionCodeAttr({ url }, infos, {
|
|
271
|
-
onSuccess: () => {
|
|
272
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
|
|
273
|
-
},
|
|
274
|
-
select: (data) => data
|
|
275
|
-
.filter((attr) => +(attr === null || attr === void 0 ? void 0 : attr.status) === 1)
|
|
276
|
-
.map((attr) => ({
|
|
277
|
-
label: attr.propertyDisplayMultilang[language] ||
|
|
278
|
-
attr.propertyDisplayMultilang[get(attr, "propertyDisplayMultilang['DEFAULT_LANG']", 'EN')],
|
|
279
|
-
value: attr.itemPropertyName,
|
|
280
|
-
dataType: attr.dataType,
|
|
281
|
-
disabled: parseInt(attr.status) === 4,
|
|
282
|
-
status: attr.status,
|
|
283
|
-
})),
|
|
284
|
-
onError: (error) => {
|
|
285
|
-
setHasError({
|
|
286
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
|
|
287
|
-
});
|
|
288
|
-
handleError(error, {
|
|
289
|
-
path: PATH,
|
|
290
|
-
name: 'useGetPromotionCodeAttr',
|
|
291
|
-
args: error === null || error === void 0 ? void 0 : error.message,
|
|
292
|
-
});
|
|
293
|
-
},
|
|
294
|
-
});
|
|
295
|
-
const { data: eventTrackingAttributes } = useGetEventTrackingAttributes({
|
|
296
|
-
apiConfig: { url },
|
|
297
|
-
infos,
|
|
298
|
-
eventActionId,
|
|
299
|
-
eventCategoryId,
|
|
300
|
-
});
|
|
301
|
-
// Memo
|
|
302
|
-
const isShowEventIndexField = useDeepCompareMemo(() => {
|
|
303
|
-
if (selectedAttr && selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
304
|
-
if (selectedAttr.itemTypeId) {
|
|
305
|
-
return !!get(selectedAttr, 'eventPropertySyntax', '').includes('items');
|
|
306
|
-
}
|
|
307
|
-
return selectedAttr.type === ATTRIBUTE_TYPE.ITEM;
|
|
308
|
-
}
|
|
309
|
-
return false;
|
|
310
|
-
}, [selectedAttr, selectedDynamicContentType, eventTrackingAttributes === null || eventTrackingAttributes === void 0 ? void 0 : eventTrackingAttributes.mainObjects]);
|
|
311
|
-
const itemTypeName = useMemo(() => {
|
|
312
|
-
var _a;
|
|
313
|
-
let draftItemTypeName = '';
|
|
314
|
-
if (itemTypeId) {
|
|
315
|
-
draftItemTypeName = ((_a = listBO === null || listBO === void 0 ? void 0 : listBO.find((bo) => bo.id === itemTypeId)) === null || _a === void 0 ? void 0 : _a.name) || '';
|
|
316
|
-
}
|
|
317
|
-
return draftItemTypeName;
|
|
318
|
-
}, [itemTypeId, listBO]);
|
|
319
|
-
// Add BO settings (if exists) to list Dynamic content Type, or removed from the previous states
|
|
320
|
-
useEffect(() => {
|
|
321
|
-
const temp = [...defaultDynamicTypes];
|
|
322
|
-
contentSources.groups.forEach((g) => {
|
|
323
|
-
if (!g.itemTypeId)
|
|
324
|
-
return;
|
|
325
|
-
temp.push({
|
|
326
|
-
index: temp.length,
|
|
327
|
-
label: `${g.groupName} (${g.itemTypeDisplay})`,
|
|
328
|
-
value: `content-source::${g.groupId}::${g.itemTypeId}`,
|
|
329
|
-
});
|
|
330
|
-
});
|
|
331
|
-
if (isShowCustomFunction) {
|
|
332
|
-
temp.push(Object.assign(Object.assign({}, CUSTOM_TYPE), { index: temp.length }));
|
|
333
|
-
}
|
|
334
|
-
setListDynamicContentTypes(temp);
|
|
335
|
-
}, [contentSources.groups, isShowCustomFunction]);
|
|
336
|
-
useEffect(() => {
|
|
337
|
-
if (Array.isArray(customFunction) && customFunction.length) {
|
|
338
|
-
const temp = [];
|
|
339
|
-
customFunction.forEach(item => {
|
|
340
|
-
temp.push(Object.assign(Object.assign({}, item), { label: item.template_name, value: item.template_name }));
|
|
341
|
-
});
|
|
342
|
-
setlistCustomTemplates(temp);
|
|
343
|
-
}
|
|
344
|
-
}, [customFunction, visible]);
|
|
345
|
-
useDeepCompareEffect(() => {
|
|
346
|
-
if (dynamicContentAttr) {
|
|
347
|
-
const { customer, visitor } = dynamicContentAttr;
|
|
348
|
-
const dynamicContentType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
349
|
-
const parseCustomers = serilizeDynamicContentAttr(customer, language, additionalAttrProperties);
|
|
350
|
-
const parseVisitors = serilizeDynamicContentAttr(visitor, language, additionalAttrProperties);
|
|
351
|
-
setListCustomerAttributes(parseCustomers);
|
|
352
|
-
setListVisitorAttributes(parseVisitors);
|
|
353
|
-
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE))
|
|
354
|
-
return;
|
|
355
|
-
if (dynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value) {
|
|
356
|
-
form.setFieldsValue({
|
|
357
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(parseVisitors)[0],
|
|
358
|
-
});
|
|
359
|
-
}
|
|
360
|
-
if (dynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value) {
|
|
361
|
-
form.setFieldsValue({
|
|
362
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(parseCustomers)[0],
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}, [dynamicContentAttr, form, language]);
|
|
367
|
-
useDeepCompareEffect(() => {
|
|
368
|
-
if (listSources && selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
369
|
-
if (!isEmpty(form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.SOURCE)))
|
|
370
|
-
return;
|
|
371
|
-
const defaultValue = listSources[0] ? [listSources[0].value] : [];
|
|
372
|
-
form.setFieldsValue({
|
|
373
|
-
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: defaultValue,
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
}, [selectedEventSource, listSources, form, selectedDynamicContentType]);
|
|
377
|
-
useDeepCompareEffect(() => {
|
|
378
|
-
var _a, _b;
|
|
379
|
-
if (listEventAttributes &&
|
|
380
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
381
|
-
const initEventAttr = ((_a = listEventAttributes[0]) === null || _a === void 0 ? void 0 : _a.children.length)
|
|
382
|
-
? getAvailableAttrs((_b = listEventAttributes[0]) === null || _b === void 0 ? void 0 : _b.children)[0]
|
|
383
|
-
: listEventAttributes[0];
|
|
384
|
-
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE)) {
|
|
385
|
-
const eventAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
386
|
-
setExpandedEventAttributes([eventAttr.value.split('.')[0]]);
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
form.setFieldsValue({
|
|
390
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: initEventAttr,
|
|
391
|
-
});
|
|
392
|
-
setExpandedEventAttributes([initEventAttr.value.split('.')[0]]);
|
|
393
|
-
}
|
|
394
|
-
}, [selectedSource, selectedEventSource, listEventAttributes, form, selectedDynamicContentType]);
|
|
395
|
-
useDeepCompareEffect(() => {
|
|
396
|
-
if (listPromotionCodeAttributes &&
|
|
397
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value) {
|
|
398
|
-
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE))
|
|
399
|
-
return;
|
|
400
|
-
form.setFieldsValue({
|
|
401
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listPromotionCodeAttributes)[0],
|
|
402
|
-
});
|
|
403
|
-
}
|
|
404
|
-
}, [selectedDynamicContentType, listPromotionCodeAttributes, form]);
|
|
405
|
-
// Update form field data with default data/ or reset it to initial states
|
|
406
|
-
const resetStateAndFormValueDF = useCallback(() => {
|
|
407
|
-
setShowDetailEditDF(false);
|
|
408
|
-
setAttrDFSettings(undefined);
|
|
409
|
-
setAttrDFOptions([]);
|
|
410
|
-
setFormatedAttr('');
|
|
411
|
-
setsaveAsTemplate(false);
|
|
412
|
-
setTemplateName('');
|
|
413
|
-
setSearchValue('');
|
|
414
|
-
form.setFieldsValue({
|
|
415
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: undefined,
|
|
416
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: undefined,
|
|
417
|
-
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: undefined,
|
|
418
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: optionDataType[0].value,
|
|
419
|
-
});
|
|
420
|
-
}, [form]);
|
|
421
|
-
useEffect(() => {
|
|
422
|
-
if (!visible) {
|
|
423
|
-
setTimeout(() => {
|
|
424
|
-
resetStateAndFormValueDF();
|
|
425
|
-
}, 200);
|
|
426
|
-
}
|
|
427
|
-
}, [visible, resetStateAndFormValueDF]);
|
|
428
|
-
useEffect(() => {
|
|
429
|
-
let listTmp = [];
|
|
430
|
-
switch (true) {
|
|
431
|
-
case selectedDynamicContentType && regexCSType.test(selectedDynamicContentType):
|
|
432
|
-
listTmp = [...listBoAttributes];
|
|
433
|
-
break;
|
|
434
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value:
|
|
435
|
-
listTmp = listPromotionCodeAttributes ? [...listPromotionCodeAttributes] : [];
|
|
436
|
-
break;
|
|
437
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value:
|
|
438
|
-
listTmp = [...listCustomerAttributes];
|
|
439
|
-
break;
|
|
440
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value:
|
|
441
|
-
listTmp = [...listVisitorAttributes];
|
|
442
|
-
break;
|
|
443
|
-
default:
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
const { errorMessage, isDisable } = checkStatusAttr({
|
|
447
|
-
listBO: listBO,
|
|
448
|
-
itemTypeId: itemTypeId || 0,
|
|
449
|
-
listAttribute: listTmp,
|
|
450
|
-
field: selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.value,
|
|
451
|
-
});
|
|
452
|
-
setActionArchive(isDisable);
|
|
453
|
-
setErrorMessageAttr(errorMessage);
|
|
454
|
-
}, [selectedAttr]);
|
|
455
|
-
useEffect(() => {
|
|
456
|
-
var _a;
|
|
457
|
-
if (!visible) {
|
|
458
|
-
return;
|
|
459
|
-
}
|
|
460
|
-
if ((_a = Object.keys(Object.assign({}, defaultData))) === null || _a === void 0 ? void 0 : _a.length) {
|
|
461
|
-
let draftDefaultData = Object.assign({}, defaultData);
|
|
462
|
-
if (draftDefaultData.type !== 'custom') {
|
|
463
|
-
if (triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.eventActionId) {
|
|
464
|
-
draftDefaultData = omit(draftDefaultData, ['event', 'source']);
|
|
465
|
-
}
|
|
466
|
-
form.setFieldsValue(draftDefaultData);
|
|
467
|
-
const defaultDMType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
468
|
-
const defaultAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
469
|
-
if (defaultDMType && regexCSType.test(defaultDMType)) {
|
|
470
|
-
const { itemTypeId } = serializeCSSelectedString(defaultDMType);
|
|
471
|
-
if (!isNaN(itemTypeId))
|
|
472
|
-
setItemTypeId(itemTypeId);
|
|
473
|
-
}
|
|
474
|
-
if (defaultAttr) {
|
|
475
|
-
const defaultAttr = draftDefaultData[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE];
|
|
476
|
-
// eslint-disable-next-line no-prototype-builtins
|
|
477
|
-
if (!defaultAttr.hasOwnProperty('dataType'))
|
|
478
|
-
return;
|
|
479
|
-
let key = '';
|
|
480
|
-
if (defaultAttr.dataType === 'number') {
|
|
481
|
-
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_NUMBERIC_ATTR_FORMAT_SETTINGS;
|
|
482
|
-
}
|
|
483
|
-
if (defaultAttr.dataType === 'datetime') {
|
|
484
|
-
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_DATETIME_ATTR_FORMAT_SETTINGS;
|
|
485
|
-
}
|
|
486
|
-
if (key && defaultAttr[key]) {
|
|
487
|
-
const _b = defaultAttr[key], { type } = _b, settingValues = __rest(_b, ["type"]);
|
|
488
|
-
form.setFieldsValue({
|
|
489
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: type,
|
|
490
|
-
});
|
|
491
|
-
setDefaultAttrDFSetings({
|
|
492
|
-
itemPropertyName: defaultAttr.value,
|
|
493
|
-
settings: settingValues,
|
|
494
|
-
});
|
|
495
|
-
setAttrDFSettings(settingValues);
|
|
496
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === defaultAttr.dataType));
|
|
497
|
-
}
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
else {
|
|
501
|
-
const { customFunction } = draftDefaultData;
|
|
502
|
-
const { outputFormat } = customFunction;
|
|
503
|
-
form.setFieldsValue({
|
|
504
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: draftDefaultData.type,
|
|
505
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: outputFormat.type,
|
|
506
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: customFunction.outputDataType,
|
|
507
|
-
[DYNAMIC_CONTENT_SETTING_KEY.PERNAME]: customFunction.templateName,
|
|
508
|
-
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: customFunction.customFunction,
|
|
509
|
-
});
|
|
510
|
-
setTemplateName(customFunction.templateName);
|
|
511
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === customFunction.outputDataType));
|
|
512
|
-
setShowDetailEditDF(true);
|
|
513
|
-
setAttrDFSettings(customFunction.outputDataType === 'string' ? undefined : outputFormat.config);
|
|
514
|
-
}
|
|
515
|
-
// Check if trigger event of journey has event then don's set current event and source
|
|
516
|
-
}
|
|
517
|
-
else {
|
|
518
|
-
// Hard reset to Visitor attr
|
|
519
|
-
if (listVisitorAttributes) {
|
|
520
|
-
form.setFieldsValue({
|
|
521
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value,
|
|
522
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: listVisitorAttributes[0],
|
|
523
|
-
});
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
527
|
-
}, [defaultData, visible, form]);
|
|
528
|
-
useDeepCompareEffect(() => {
|
|
529
|
-
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
530
|
-
const { eventActionId, eventCategoryId, insightPropertyIds } = triggerEvent || {};
|
|
531
|
-
if (!!eventActionId && !!eventCategoryId) {
|
|
532
|
-
form.setFieldsValue({
|
|
533
|
-
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: `${eventActionId}:${eventCategoryId}`,
|
|
534
|
-
});
|
|
535
|
-
}
|
|
536
|
-
if (Array.isArray(insightPropertyIds) && insightPropertyIds.length) {
|
|
537
|
-
form.setFieldsValue({
|
|
538
|
-
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: insightPropertyIds,
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
}, [triggerEvent, selectedDynamicContentType]);
|
|
543
|
-
// Disable Apply button if there's any error
|
|
544
|
-
useLayoutEffect(() => {
|
|
545
|
-
setFormSubmitDisabled(Object.values(hasError).some(error => error));
|
|
546
|
-
}, [hasError]);
|
|
547
|
-
useLayoutEffect(() => {
|
|
548
|
-
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value ||
|
|
549
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value) {
|
|
550
|
-
setFormSubmitDisabled(isFetchingDynamicContentAttr);
|
|
551
|
-
}
|
|
552
|
-
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
553
|
-
setFormSubmitDisabled(isFetchingSourceBO || isFetchingEventBySource || isFetchingEventAttr);
|
|
554
|
-
}
|
|
555
|
-
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value) {
|
|
556
|
-
setFormSubmitDisabled(isFetchingPromotionPool || isFetchingPromotionCodeAttr);
|
|
557
|
-
}
|
|
558
|
-
if (selectedDynamicContentType && regexCSType.test(selectedDynamicContentType)) {
|
|
559
|
-
setFormSubmitDisabled(isFetchingListBoAttr);
|
|
560
|
-
}
|
|
561
|
-
}, [
|
|
562
|
-
isFetchingDynamicContentAttr,
|
|
563
|
-
selectedDynamicContentType,
|
|
564
|
-
isFetchingSourceBO,
|
|
565
|
-
isFetchingEventBySource,
|
|
566
|
-
isFetchingEventAttr,
|
|
567
|
-
isFetchingPromotionPool,
|
|
568
|
-
isFetchingPromotionCodeAttr,
|
|
569
|
-
isFetchingListBoAttr,
|
|
570
|
-
]);
|
|
571
|
-
useLayoutEffect(() => {
|
|
572
|
-
let formatedDFValue = '';
|
|
573
|
-
let settings = attrDFSettings;
|
|
574
|
-
const selectedAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
575
|
-
const dataType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE);
|
|
576
|
-
const dynamicType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
577
|
-
if ((Object.keys(defaultData).length > 0 && defaultData.type !== 'custom') ||
|
|
578
|
-
dynamicType !== 'custom') {
|
|
579
|
-
if (selectedAttr &&
|
|
580
|
-
selectedAttr.dataType &&
|
|
581
|
-
['datetime', 'number'].includes(selectedAttr.dataType)) {
|
|
582
|
-
/* when change select if attr selected is previous selected default attr, set settings as default settings */
|
|
583
|
-
if (!settings &&
|
|
584
|
-
(defaultAttrDFSetings === null || defaultAttrDFSetings === void 0 ? void 0 : defaultAttrDFSetings.itemPropertyName) === selectedAttr.value) {
|
|
585
|
-
// Visitor and Customer don't have additional field
|
|
586
|
-
let equalDefaultAttr = true;
|
|
587
|
-
// Event need check additional field source, event by soucre
|
|
588
|
-
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
589
|
-
const source = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.SOURCE);
|
|
590
|
-
const event = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.EVENT);
|
|
591
|
-
if (source !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.SOURCE] ||
|
|
592
|
-
event !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.EVENT])
|
|
593
|
-
equalDefaultAttr = false;
|
|
594
|
-
}
|
|
595
|
-
// Promotion need check additional field promotion pool
|
|
596
|
-
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value) {
|
|
597
|
-
const pool = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL);
|
|
598
|
-
if (pool !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL])
|
|
599
|
-
equalDefaultAttr = false;
|
|
600
|
-
}
|
|
601
|
-
// BO settings need check additional field index
|
|
602
|
-
if (selectedDynamicContentType && regexCSType.test(selectedDynamicContentType)) {
|
|
603
|
-
if (selectedBoIndex !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.INDEX])
|
|
604
|
-
equalDefaultAttr = false;
|
|
605
|
-
}
|
|
606
|
-
if (equalDefaultAttr) {
|
|
607
|
-
settings = defaultAttrDFSetings.settings;
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
// *********** //
|
|
611
|
-
// Numberic Attribute DF
|
|
612
|
-
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'number') {
|
|
613
|
-
settings = settings !== null && settings !== void 0 ? settings : initNumberDFSettings;
|
|
614
|
-
formatedDFValue = formatNumberDF(1234.56789, selectedDFType, settings);
|
|
615
|
-
}
|
|
616
|
-
// Datatime Attribute DF
|
|
617
|
-
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'datetime') {
|
|
618
|
-
settings = settings !== null && settings !== void 0 ? settings : Object.assign(Object.assign({}, initDatetimeDFSettings), { language });
|
|
619
|
-
formatedDFValue = formatDatetimeDF(dateExample, settings);
|
|
620
|
-
}
|
|
621
|
-
if (!attrDFOptions.length) {
|
|
622
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === selectedAttr.dataType));
|
|
623
|
-
}
|
|
624
|
-
setAttrDFSettings(settings);
|
|
625
|
-
setFormatedAttr(formatedDFValue);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
if (dataType && ['datetime', 'number'].includes(dataType) && dynamicType === 'custom') {
|
|
629
|
-
// Numberic Attribute DF
|
|
630
|
-
if (dataType === 'number') {
|
|
631
|
-
settings = settings !== null && settings !== void 0 ? settings : initNumberDFSettings;
|
|
632
|
-
formatedDFValue = formatNumberDF(1234.56789, selectedDFType, settings);
|
|
633
|
-
}
|
|
634
|
-
// Datatime Attribute DF
|
|
635
|
-
if (dataType === 'datetime') {
|
|
636
|
-
settings = settings !== null && settings !== void 0 ? settings : Object.assign(Object.assign({}, initDatetimeDFSettings), { language });
|
|
637
|
-
formatedDFValue = formatDatetimeDF(dateExample, settings);
|
|
638
|
-
}
|
|
639
|
-
if (!attrDFOptions.length) {
|
|
640
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === dataType));
|
|
641
|
-
}
|
|
642
|
-
setAttrDFSettings(settings);
|
|
643
|
-
setFormatedAttr(formatedDFValue);
|
|
644
|
-
}
|
|
645
|
-
}, [
|
|
646
|
-
attrDFSettings,
|
|
647
|
-
selectedDFType,
|
|
648
|
-
attrDFOptions.length,
|
|
649
|
-
language,
|
|
650
|
-
defaultAttrDFSetings,
|
|
651
|
-
form,
|
|
652
|
-
selectedAttr,
|
|
653
|
-
defaultData,
|
|
654
|
-
selectedDynamicContentType,
|
|
655
|
-
selectedBoIndex,
|
|
656
|
-
]);
|
|
657
|
-
//* Handlers
|
|
658
|
-
const handleOnCancelModal = () => {
|
|
659
|
-
if (onCancel) {
|
|
660
|
-
onCancel();
|
|
661
|
-
}
|
|
662
|
-
};
|
|
663
|
-
const onChangeDataInput = (value) => {
|
|
664
|
-
setTemplateName(value);
|
|
665
|
-
let tempState = [...listCustomTemplates];
|
|
666
|
-
if (value.length > 0) {
|
|
667
|
-
tempState = tempState.filter(item => item.label.toLowerCase().includes(value.trim().toLowerCase()));
|
|
668
|
-
}
|
|
669
|
-
setlistCustomTemplatesSearch(tempState);
|
|
670
|
-
setSearchValue(value);
|
|
671
|
-
};
|
|
672
|
-
const handleSelect = (data) => {
|
|
673
|
-
const dataTmp = listCustomTemplates.filter(each => each.value === data);
|
|
674
|
-
settemplateId(dataTmp[0].template_id);
|
|
675
|
-
let dataFormat = dataTmp[0].output_format.type.toLowerCase();
|
|
676
|
-
switch (dataTmp[0].output_format.type) {
|
|
677
|
-
case 'DATE_AND_TIME':
|
|
678
|
-
dataFormat = 'date_and_time';
|
|
679
|
-
break;
|
|
680
|
-
case 'RAW_STRING':
|
|
681
|
-
dataFormat = 'raw_string';
|
|
682
|
-
break;
|
|
683
|
-
default:
|
|
684
|
-
break;
|
|
685
|
-
}
|
|
686
|
-
form.setFieldsValue({
|
|
687
|
-
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: dataTmp[0].custom_function,
|
|
688
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: dataTmp[0].output_data_type,
|
|
689
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: dataFormat === 'date_and_time' ? 'datetime' : dataFormat,
|
|
690
|
-
});
|
|
691
|
-
setTemplateName(dataTmp[0].template_name);
|
|
692
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === dataTmp[0].output_data_type));
|
|
693
|
-
const format = dataTmp[0].output_format.config;
|
|
694
|
-
switch (dataFormat) {
|
|
695
|
-
case 'currency': {
|
|
696
|
-
setAttrDFSettings(Object.assign(Object.assign({}, initNumberDFSettings), { grouping: format.group || ',', decimal: format.decimal, decimalPlaces: format.decimalPlace, isCompact: format.isCompactNumber || false, currencyCode: format.currency || 'USD', prefixType: format.prefixType || 'code' }));
|
|
697
|
-
break;
|
|
698
|
-
}
|
|
699
|
-
case 'number':
|
|
700
|
-
case 'percentage': {
|
|
701
|
-
setAttrDFSettings(Object.assign(Object.assign({}, initNumberDFSettings), { grouping: format.group || ',', decimal: format.decimal, decimalPlaces: format.decimalPlace, isCompact: format.isCompactNumber || false }));
|
|
702
|
-
break;
|
|
703
|
-
}
|
|
704
|
-
case 'date_and_time': {
|
|
705
|
-
setAttrDFSettings(Object.assign(Object.assign({}, initDatetimeDFSettings), { language, hasDateFormat: format.date.check || true, hasTimeFormat: format.time.check || true, dateParseOption: format.date.value || 'medium', timeParseOption: format.time.value || 'medium', dateParseFormat: format.format || 'MM/DD/YYYY', timeParseFormat: `${format.time.timeFormat || 12}hour` }));
|
|
706
|
-
break;
|
|
707
|
-
}
|
|
708
|
-
case 'raw_string': {
|
|
709
|
-
setAttrDFSettings(undefined);
|
|
710
|
-
break;
|
|
711
|
-
}
|
|
712
|
-
default:
|
|
713
|
-
break;
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
const handleOnOkModal = () => {
|
|
717
|
-
if (isActionArchive &&
|
|
718
|
-
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
719
|
-
return;
|
|
720
|
-
}
|
|
721
|
-
form.validateFields().then((values) => {
|
|
722
|
-
var _a;
|
|
723
|
-
values = omit(values, 'dfType');
|
|
724
|
-
if (onOk) {
|
|
725
|
-
const type = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
726
|
-
if (type === 'custom') {
|
|
727
|
-
const outputFormat = {};
|
|
728
|
-
const perName = templateName;
|
|
729
|
-
const functionCustom = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.FUNCTION);
|
|
730
|
-
const dataType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE);
|
|
731
|
-
const displayFormat = form.getFieldValue([
|
|
732
|
-
DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE,
|
|
733
|
-
]);
|
|
734
|
-
if (templateId && !saveAsTemplate) {
|
|
735
|
-
try {
|
|
736
|
-
updateCSFunction({
|
|
737
|
-
url,
|
|
738
|
-
infos,
|
|
739
|
-
templateId,
|
|
740
|
-
name: perName,
|
|
741
|
-
dataType,
|
|
742
|
-
functionCustom,
|
|
743
|
-
dataFormat: attrDFSettings,
|
|
744
|
-
displayFormat,
|
|
745
|
-
outputFormat,
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
catch (error) {
|
|
749
|
-
handleError(error, {
|
|
750
|
-
path: PATH,
|
|
751
|
-
name: 'onClickSaveDynamicContent',
|
|
752
|
-
args: {},
|
|
753
|
-
});
|
|
754
|
-
}
|
|
755
|
-
}
|
|
756
|
-
else if (saveAsTemplate) {
|
|
757
|
-
try {
|
|
758
|
-
addSavedCSFunction({
|
|
759
|
-
url,
|
|
760
|
-
infos,
|
|
761
|
-
name: perName,
|
|
762
|
-
dataType,
|
|
763
|
-
functionCustom,
|
|
764
|
-
dataFormat: attrDFSettings,
|
|
765
|
-
displayFormat,
|
|
766
|
-
outputFormat,
|
|
767
|
-
});
|
|
768
|
-
}
|
|
769
|
-
catch (error) {
|
|
770
|
-
handleError(error, {
|
|
771
|
-
path: PATH,
|
|
772
|
-
name: 'onClickSaveDynamicContent',
|
|
773
|
-
args: {},
|
|
774
|
-
});
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
if (!showIndex) {
|
|
778
|
-
values = omit(values, 'index');
|
|
779
|
-
}
|
|
780
|
-
const config = Object.assign({}, attrDFSettings);
|
|
781
|
-
if (dataType === 'datetime') {
|
|
782
|
-
config.dateFormatString = getStringFormatDateDF(attrDFSettings);
|
|
783
|
-
}
|
|
784
|
-
onOk(Object.assign(Object.assign({}, values), { customFunction: {
|
|
785
|
-
outputFormat: {
|
|
786
|
-
type: displayFormat,
|
|
787
|
-
config,
|
|
788
|
-
},
|
|
789
|
-
templateCode: serializeLabelToCode(perName),
|
|
790
|
-
templateName: perName,
|
|
791
|
-
templateType: 'custom',
|
|
792
|
-
customFunction: functionCustom,
|
|
793
|
-
outputDataType: dataType,
|
|
794
|
-
}, attribute: {
|
|
795
|
-
label: perName,
|
|
796
|
-
value: serializeLabelToCode(perName),
|
|
797
|
-
}, mappingFields: `#{custom.${serializeLabelToCode(perName)}}` }));
|
|
798
|
-
}
|
|
799
|
-
else {
|
|
800
|
-
let key = '';
|
|
801
|
-
const otherField = {};
|
|
802
|
-
const selectedAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
803
|
-
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'number') {
|
|
804
|
-
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_NUMBERIC_ATTR_FORMAT_SETTINGS;
|
|
805
|
-
}
|
|
806
|
-
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'datetime') {
|
|
807
|
-
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_DATETIME_ATTR_FORMAT_SETTINGS;
|
|
808
|
-
otherField.dateFormatString = getStringFormatDateDF(attrDFSettings);
|
|
809
|
-
}
|
|
810
|
-
if (key && showDisplayFormat) {
|
|
811
|
-
values[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE][key] = Object.assign(Object.assign(Object.assign({}, attrDFSettings), otherField), { type: selectedDFType });
|
|
812
|
-
}
|
|
813
|
-
// Handle Merge tag for event attributes
|
|
814
|
-
if (values.type === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
815
|
-
if (values.index != null && !get(values, 'attribute.itemTypeName', null)) {
|
|
816
|
-
const itemTypeName = ((_a = listBO === null || listBO === void 0 ? void 0 : listBO.find(({ id }) => get(eventTrackingAttributes, 'mainObjects', []).some(({ itemTypeId }) => itemTypeId === id))) === null || _a === void 0 ? void 0 : _a.name) || null;
|
|
817
|
-
if (itemTypeName) {
|
|
818
|
-
set(values, 'attribute.itemTypeName', itemTypeName);
|
|
819
|
-
}
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
// Set itemTypeName if Selecting content source
|
|
823
|
-
if (regexCSType.test(values.type) && !!itemTypeName) {
|
|
824
|
-
set(values, 'attribute.itemTypeName', itemTypeName);
|
|
825
|
-
}
|
|
826
|
-
if (!showIndex) {
|
|
827
|
-
values = omit(values, 'index');
|
|
828
|
-
}
|
|
829
|
-
const mappingFields = buildMappingFields(values);
|
|
830
|
-
onOk(Object.assign(Object.assign({}, values), (mappingFields && { mappingFields })));
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
});
|
|
834
|
-
};
|
|
835
|
-
const handleOnClickParentNode = (item) => {
|
|
836
|
-
if (item.children.length) {
|
|
837
|
-
if (expandedEventAttributes.includes(item.value)) {
|
|
838
|
-
// close expand
|
|
839
|
-
const newExpandedKeys = expandedEventAttributes.filter(key => key !== item.value);
|
|
840
|
-
handleTreeExpand(newExpandedKeys);
|
|
841
|
-
}
|
|
842
|
-
else {
|
|
843
|
-
// open expand
|
|
844
|
-
handleTreeExpand((prev) => [...prev, item.value]);
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
};
|
|
848
|
-
const handleTreeExpand = (expandedKeys) => {
|
|
849
|
-
setExpandedEventAttributes(expandedKeys);
|
|
850
|
-
};
|
|
851
|
-
const handleSaveAsTemplate = () => {
|
|
852
|
-
setsaveAsTemplate(!saveAsTemplate);
|
|
853
|
-
};
|
|
854
|
-
const handleFormValuesChanges = (changedValues, _allValues) => {
|
|
855
|
-
var _a;
|
|
856
|
-
const [fieldName, fieldValue] = Object.entries(changedValues)[0];
|
|
857
|
-
switch (fieldName) {
|
|
858
|
-
case DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE:
|
|
859
|
-
resetStateAndFormValueDF();
|
|
860
|
-
switch (true) {
|
|
861
|
-
case fieldValue === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value:
|
|
862
|
-
form.setFieldsValue({
|
|
863
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listCustomerAttributes)[0],
|
|
864
|
-
});
|
|
865
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorDynamicContentAttr });
|
|
866
|
-
break;
|
|
867
|
-
case fieldValue === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value:
|
|
868
|
-
form.setFieldsValue({
|
|
869
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listVisitorAttributes)[0],
|
|
870
|
-
});
|
|
871
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorDynamicContentAttr });
|
|
872
|
-
break;
|
|
873
|
-
case fieldValue === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value:
|
|
874
|
-
if (!(listEvents === null || listEvents === void 0 ? void 0 : listEvents.length))
|
|
875
|
-
break;
|
|
876
|
-
form.setFieldsValue({
|
|
877
|
-
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: listEvents[0].value,
|
|
878
|
-
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: undefined,
|
|
879
|
-
});
|
|
880
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorEventAttr });
|
|
881
|
-
break;
|
|
882
|
-
case fieldValue === CUSTOM_TYPE.value:
|
|
883
|
-
if (!(listEvents === null || listEvents === void 0 ? void 0 : listEvents.length))
|
|
884
|
-
break;
|
|
885
|
-
let formatedDFValue = '';
|
|
886
|
-
let settings = attrDFSettings;
|
|
887
|
-
settings = settings !== null && settings !== void 0 ? settings : initNumberDFSettings;
|
|
888
|
-
formatedDFValue = formatNumberDF(1234.56789, selectedDFType, settings);
|
|
889
|
-
setFormatedAttr(formatedDFValue);
|
|
890
|
-
setAttrDFSettings(settings);
|
|
891
|
-
form.setFieldsValue({
|
|
892
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: optionDataType[0].value,
|
|
893
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: optionDataType[0].value,
|
|
894
|
-
});
|
|
895
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter(dfType => dfType.dataType === optionDataType[0].value));
|
|
896
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorEventAttr });
|
|
897
|
-
setShowDetailEditDF(true);
|
|
898
|
-
break;
|
|
899
|
-
case fieldValue === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value:
|
|
900
|
-
if (!listPromotionCodeAttributes || !listPromotionPools)
|
|
901
|
-
break;
|
|
902
|
-
form.setFieldsValue({
|
|
903
|
-
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: (_a = listPromotionPools[0]) === null || _a === void 0 ? void 0 : _a.value,
|
|
904
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listPromotionCodeAttributes)[0],
|
|
905
|
-
});
|
|
906
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorListPromotionCodeAttr });
|
|
907
|
-
break;
|
|
908
|
-
case regexCSType.test(fieldValue): {
|
|
909
|
-
const { itemTypeId: selectedItemTypeId } = serializeCSSelectedString(String(fieldValue));
|
|
910
|
-
if (isNaN(selectedItemTypeId))
|
|
911
|
-
break;
|
|
912
|
-
setItemTypeId(Number(selectedItemTypeId));
|
|
913
|
-
const key = [QUERY_KEYS.GET_EVENT_ATTRIBUTE_BO, [selectedItemTypeId]];
|
|
914
|
-
const listAttBOByItemTypeId = serilizeBOAttr(queryClientAntsomiUI.getQueryData(key));
|
|
915
|
-
if (listAttBOByItemTypeId.length) {
|
|
916
|
-
form.setFieldsValue({
|
|
917
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: listAttBOByItemTypeId[0],
|
|
918
|
-
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex,
|
|
919
|
-
});
|
|
920
|
-
}
|
|
921
|
-
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorBoAttr });
|
|
922
|
-
break;
|
|
923
|
-
}
|
|
924
|
-
default: {
|
|
925
|
-
break;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
break;
|
|
929
|
-
case DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE:
|
|
930
|
-
let listAttributes = [];
|
|
931
|
-
switch (true) {
|
|
932
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value:
|
|
933
|
-
if (!listEventAttributes)
|
|
934
|
-
break;
|
|
935
|
-
let newSelectEventAttr = listEventAttributes.find((row) => {
|
|
936
|
-
if (row === null || row === void 0 ? void 0 : row.children.length) {
|
|
937
|
-
return row.children.find((item) => item.value === fieldValue.value);
|
|
938
|
-
}
|
|
939
|
-
return row.value === fieldValue.value;
|
|
940
|
-
});
|
|
941
|
-
if (newSelectEventAttr === null || newSelectEventAttr === void 0 ? void 0 : newSelectEventAttr.children.length) {
|
|
942
|
-
newSelectEventAttr = newSelectEventAttr.children.find((item) => item.value === fieldValue.value);
|
|
943
|
-
}
|
|
944
|
-
listAttributes = flatMapDeep(listEventAttributes, getMembers);
|
|
945
|
-
form.setFieldsValue({ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex });
|
|
946
|
-
break;
|
|
947
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value:
|
|
948
|
-
listAttributes = listCustomerAttributes;
|
|
949
|
-
break;
|
|
950
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value:
|
|
951
|
-
listAttributes = listPromotionCodeAttributes !== null && listPromotionCodeAttributes !== void 0 ? listPromotionCodeAttributes : [];
|
|
952
|
-
break;
|
|
953
|
-
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value:
|
|
954
|
-
listAttributes = listVisitorAttributes;
|
|
955
|
-
break;
|
|
956
|
-
case selectedDynamicContentType && regexCSType.test(selectedDynamicContentType):
|
|
957
|
-
form.setFieldsValue({ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex });
|
|
958
|
-
if (!listBoAttributes)
|
|
959
|
-
break;
|
|
960
|
-
listAttributes = listBoAttributes;
|
|
961
|
-
break;
|
|
962
|
-
default: {
|
|
963
|
-
break;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
// add dataType to
|
|
967
|
-
if (listAttributes.length) {
|
|
968
|
-
const attr = listAttributes.find(attr => {
|
|
969
|
-
if (attr.value === fieldValue.value) {
|
|
970
|
-
return attr;
|
|
971
|
-
}
|
|
972
|
-
return null;
|
|
973
|
-
});
|
|
974
|
-
form.setFieldsValue({
|
|
975
|
-
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: attr,
|
|
976
|
-
});
|
|
977
|
-
// set new value for options display format
|
|
978
|
-
if (attr) {
|
|
979
|
-
const newAttrDFOptions = DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === attr.dataType);
|
|
980
|
-
if (newAttrDFOptions.length) {
|
|
981
|
-
form.setFieldsValue({
|
|
982
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: newAttrDFOptions[0].value,
|
|
983
|
-
});
|
|
984
|
-
setAttrDFOptions(newAttrDFOptions);
|
|
985
|
-
}
|
|
986
|
-
// reset detail display format settings
|
|
987
|
-
setAttrDFSettings(undefined);
|
|
988
|
-
setShowDetailEditDF(false);
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
break;
|
|
992
|
-
case DYNAMIC_CONTENT_SETTING_KEY.INDEX:
|
|
993
|
-
break;
|
|
994
|
-
case DYNAMIC_CONTENT_SETTING_KEY.FUNCTION:
|
|
995
|
-
form.setFieldsValue({
|
|
996
|
-
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: fieldValue,
|
|
997
|
-
});
|
|
998
|
-
break;
|
|
999
|
-
case DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE:
|
|
1000
|
-
form.setFieldsValue({
|
|
1001
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: fieldValue,
|
|
1002
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: fieldValue === 'string' ? 'raw_string' : fieldValue,
|
|
1003
|
-
});
|
|
1004
|
-
let settings = attrDFSettings;
|
|
1005
|
-
// Datatime Attribute DF
|
|
1006
|
-
if (fieldValue === 'datetime') {
|
|
1007
|
-
settings = Object.assign(Object.assign({}, initDatetimeDFSettings), { language });
|
|
1008
|
-
}
|
|
1009
|
-
else if (fieldValue === 'string') {
|
|
1010
|
-
settings = undefined;
|
|
1011
|
-
}
|
|
1012
|
-
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === fieldValue));
|
|
1013
|
-
setAttrDFSettings(settings);
|
|
1014
|
-
break;
|
|
1015
|
-
case DYNAMIC_CONTENT_SETTING_KEY.EVENT:
|
|
1016
|
-
form.setFieldsValue({
|
|
1017
|
-
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: undefined,
|
|
1018
|
-
});
|
|
1019
|
-
resetStateAndFormValueDF();
|
|
1020
|
-
break;
|
|
1021
|
-
case DYNAMIC_CONTENT_SETTING_KEY.SOURCE:
|
|
1022
|
-
resetStateAndFormValueDF();
|
|
1023
|
-
break;
|
|
1024
|
-
case DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE:
|
|
1025
|
-
switch (fieldValue) {
|
|
1026
|
-
case 'currency': {
|
|
1027
|
-
setAttrDFSettings(Object.assign(Object.assign({}, initNumberDFSettings), { decimalPlaces: 1 }));
|
|
1028
|
-
break;
|
|
1029
|
-
}
|
|
1030
|
-
case 'number':
|
|
1031
|
-
case 'percentage': {
|
|
1032
|
-
setAttrDFSettings(initNumberDFSettings);
|
|
1033
|
-
break;
|
|
1034
|
-
}
|
|
1035
|
-
case 'datetime': {
|
|
1036
|
-
setAttrDFSettings(Object.assign(Object.assign({}, initDatetimeDFSettings), { language }));
|
|
1037
|
-
break;
|
|
1038
|
-
}
|
|
1039
|
-
case 'raw_string': {
|
|
1040
|
-
setAttrDFSettings(undefined);
|
|
1041
|
-
break;
|
|
1042
|
-
}
|
|
1043
|
-
default: {
|
|
1044
|
-
break;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
break;
|
|
1048
|
-
default: {
|
|
1049
|
-
break;
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
};
|
|
1053
|
-
//* Render functions
|
|
1054
|
-
const renderBoAttrFields = () => {
|
|
1055
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1056
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.boAttr)));
|
|
1057
|
-
}
|
|
1058
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.attribute), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1059
|
-
React.createElement(Select, { loading: isFetchingListBoAttr, style: { height: '28px' }, labelInValue: true, options: buildOptionAttrArchive(listBoAttributes || [], selectedAttr),
|
|
1060
|
-
// errorArchive={errorMessageAttr}
|
|
1061
|
-
disabled: isActionArchive, showSearch: true })));
|
|
1062
|
-
};
|
|
1063
|
-
const renderIndexFields = ({ disabled = false, loading = false }) => {
|
|
1064
|
-
if (!showIndex)
|
|
1065
|
-
return null;
|
|
1066
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1067
|
-
return null;
|
|
1068
|
-
}
|
|
1069
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.index), name: DYNAMIC_CONTENT_SETTING_KEY.INDEX, required: true },
|
|
1070
|
-
React.createElement(Select, { disabled: disabled, loading: loading, style: { height: '28px' }, options: Array.from({ length: 90 }, (_, i) => ({ value: i + 1, label: i + 1 })), showSearch: true })));
|
|
1071
|
-
};
|
|
1072
|
-
const renderCustomFunctionFields = () => {
|
|
1073
|
-
const dataType = form.getFieldValue([DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]);
|
|
1074
|
-
return (React.createElement(React.Fragment, null,
|
|
1075
|
-
React.createElement(Form.Item, { label: t(translations.dynamicContent.modal.label.personalizationName), name: DYNAMIC_CONTENT_SETTING_KEY.PERNAME, style: { alignItems: 'center' }, required: true },
|
|
1076
|
-
React.createElement(InputSuggestion, { onSelect: handleSelect, placeholder: "Custom function name...", options: searchValue.length > 0 ? listCustomTemplatesSearch : listCustomTemplates, onChange: onChangeDataInput, value: templateName }),
|
|
1077
|
-
hasError[DYNAMIC_CONTENT_SETTING_KEY.PERNAME] && (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.perName)))),
|
|
1078
|
-
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.function), name: DYNAMIC_CONTENT_SETTING_KEY.FUNCTION, required: true },
|
|
1079
|
-
React.createElement(EditorScript, { mode: "javascript", hideExpand: true })),
|
|
1080
|
-
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.ouputDataType), name: DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE, required: true },
|
|
1081
|
-
React.createElement(Select, { style: { height: 28 }, options: optionDataType })),
|
|
1082
|
-
React.createElement(Form.Item, { style: { alignItems: 'start' }, required: true, label: t(translations.dynamicContent.modal.label.ouputFormat), name: DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE, extra: React.createElement("div", { style: {
|
|
1083
|
-
display: 'flex',
|
|
1084
|
-
flexWrap: 'wrap',
|
|
1085
|
-
alignItems: 'center',
|
|
1086
|
-
gap: '8px',
|
|
1087
|
-
marginTop: '16px',
|
|
1088
|
-
} },
|
|
1089
|
-
dataType !== 'raw_string' ? (React.createElement(Text, { color: "#555", dangerouslySetInnerHTML: {
|
|
1090
|
-
__html: `${t(translations.dynamicContent.modal.label.displayFormat)}: <bdo dir='ltr'>${formatedAttr}</bdo>`,
|
|
1091
|
-
} })) : null,
|
|
1092
|
-
!showDetailEditDF && (React.createElement(Button, { disabled: isActionArchive &&
|
|
1093
|
-
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, type: "text", style: { display: 'inline-block' }, onClick: () => setShowDetailEditDF(prevShow => !prevShow) }, t(translations.edit.title)))) },
|
|
1094
|
-
React.createElement(Select, { disabled: isActionArchive &&
|
|
1095
|
-
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, style: { height: 28 }, options: attrDFOptions }))));
|
|
1096
|
-
};
|
|
1097
|
-
const renderCustomerAttrFields = () => {
|
|
1098
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1099
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.customerAttr)));
|
|
1100
|
-
}
|
|
1101
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, initialValue: listCustomerAttributes[0], label: t(translations.dynamicContent.modal.label.attribute), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1102
|
-
React.createElement(Select, { loading: isFetchingDynamicContentAttr, style: { height: 28 }, labelInValue: true,
|
|
1103
|
-
// errorArchive={errorMessageAttr}
|
|
1104
|
-
disabled: isActionArchive, options: buildOptionAttrArchive(listCustomerAttributes, selectedAttr), showSearch: true })));
|
|
1105
|
-
};
|
|
1106
|
-
const renderEventAttrFields = () => {
|
|
1107
|
-
var _a;
|
|
1108
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1109
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.eventAttr)));
|
|
1110
|
-
}
|
|
1111
|
-
return (React.createElement(React.Fragment, null,
|
|
1112
|
-
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.selectEventAttr), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1113
|
-
React.createElement(TreeSelect, { loading: isFetchingEventAttr || !(listEvents === null || listEvents === void 0 ? void 0 : listEvents.length), style: { height: 28 }, labelInValue: true, showSearch: true }, listEventAttributes &&
|
|
1114
|
-
listEventAttributes.map((attr) => {
|
|
1115
|
-
var _a, _b, _c;
|
|
1116
|
-
return (React.createElement(TreeNode, { key: attr.value, value: attr.value, selectable: !((_a = attr === null || attr === void 0 ? void 0 : attr.children) === null || _a === void 0 ? void 0 : _a.length), title: ((_b = attr.children) === null || _b === void 0 ? void 0 : _b.length) ? (React.createElement("div", { onClick: () => handleOnClickParentNode(attr) }, attr.label)) : (attr.label) }, (_c = buildOptionAttrArchive(attr === null || attr === void 0 ? void 0 : attr.children, selectedAttr)) === null || _c === void 0 ? void 0 : _c.map((item) => (React.createElement(TreeNode, { key: item.value, value: item.value, title: item.label })))));
|
|
1117
|
-
}))),
|
|
1118
|
-
form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE) &&
|
|
1119
|
-
((_a = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE)) === null || _a === void 0 ? void 0 : _a.status) !== 1 && (React.createElement(Text, { type: "warning" }, t(translations.dynamicContent.modal.message.selectDisableEventAttr)))));
|
|
1120
|
-
};
|
|
1121
|
-
const renderEventFields = () => {
|
|
1122
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.EVENT]) {
|
|
1123
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.eventBySource)));
|
|
1124
|
-
}
|
|
1125
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.selectEvent), name: DYNAMIC_CONTENT_SETTING_KEY.EVENT, required: true, preserve: false },
|
|
1126
|
-
React.createElement(Select, { disabled: !!(triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.eventActionId) && !!(triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.eventCategoryId), loading: isFetchingEventBySource, style: { height: 28 }, options: listEvents, showSearch: true })));
|
|
1127
|
-
};
|
|
1128
|
-
const renderSourceFields = () => {
|
|
1129
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]) {
|
|
1130
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.source)));
|
|
1131
|
-
}
|
|
1132
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.selectSource), name: DYNAMIC_CONTENT_SETTING_KEY.SOURCE, required: true },
|
|
1133
|
-
React.createElement(Select, { disabled: !isEmpty(triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.insightPropertyIds), mode: "multiple", loading: isFetchingSourceBO, options: listSources, showSearch: true })));
|
|
1134
|
-
};
|
|
1135
|
-
const renderPromotionCodeAttr = () => {
|
|
1136
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1137
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.promotionCodeAttr)));
|
|
1138
|
-
}
|
|
1139
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.promotionCodeAttr), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1140
|
-
React.createElement(Select, { loading: isFetchingPromotionCodeAttr, style: { height: 28 }, labelInValue: true, options: buildOptionAttrArchive(listPromotionCodeAttributes || [], selectedAttr), showSearch: true,
|
|
1141
|
-
// errorArchive={errorMessageAttr}
|
|
1142
|
-
disabled: isActionArchive })));
|
|
1143
|
-
};
|
|
1144
|
-
const renderPromotionPoolFields = () => {
|
|
1145
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]) {
|
|
1146
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.promotionPools)));
|
|
1147
|
-
}
|
|
1148
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.promotionPools), name: DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL, required: true },
|
|
1149
|
-
React.createElement(Select, { loading: isFetchingPromotionPool, style: { height: 28 }, options: listPromotionPools, showSearch: true })));
|
|
1150
|
-
};
|
|
1151
|
-
const renderVisitorAttrFields = () => {
|
|
1152
|
-
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1153
|
-
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.visitorAttr)));
|
|
1154
|
-
}
|
|
1155
|
-
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, initialValue: listVisitorAttributes[0], label: t(translations.dynamicContent.modal.label.attribute), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1156
|
-
React.createElement(Select, { loading: isFetchingDynamicContentAttr, style: { height: 28 }, labelInValue: true, options: buildOptionAttrArchive(listVisitorAttributes, selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.value), showSearch: true,
|
|
1157
|
-
// errorArchive={errorMessageAttr}
|
|
1158
|
-
disabled: isActionArchive })));
|
|
1159
|
-
};
|
|
1160
|
-
const renderDisplayFormat = () => {
|
|
1161
|
-
const selectedAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
1162
|
-
if (formSubmitDisabled ||
|
|
1163
|
-
!attrDFSettings ||
|
|
1164
|
-
isEmpty(attrDFSettings) ||
|
|
1165
|
-
!(selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) ||
|
|
1166
|
-
!attrDFOptions.length)
|
|
1167
|
-
return null;
|
|
1168
|
-
if (selectedAttr.dataType === 'number' || selectedAttr.dataType === 'datetime')
|
|
1169
|
-
return (React.createElement(Form.Item, { initialValue: attrDFOptions[0].value, style: { alignItems: 'start' }, label: t(translations.dynamicContent.modal.label.displayFormat), name: DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE, extra: React.createElement("div", { style: {
|
|
1170
|
-
display: 'flex',
|
|
1171
|
-
flexWrap: 'wrap',
|
|
1172
|
-
alignItems: 'center',
|
|
1173
|
-
gap: '8px',
|
|
1174
|
-
marginTop: '16px',
|
|
1175
|
-
} },
|
|
1176
|
-
React.createElement(Text, { color: "#555", dangerouslySetInnerHTML: {
|
|
1177
|
-
__html: `${t(translations.dynamicContent.modal.label.displayFormat)}: <bdo dir='ltr'>${formatedAttr}</bdo>`,
|
|
1178
|
-
} }),
|
|
1179
|
-
!showDetailEditDF && (React.createElement(Button, { disabled: isActionArchive &&
|
|
1180
|
-
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, type: "text", style: { display: 'inline-block' }, onClick: () => setShowDetailEditDF(prevShow => !prevShow) }, t(translations.edit.title)))) },
|
|
1181
|
-
React.createElement(Select, { disabled: isActionArchive &&
|
|
1182
|
-
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, style: { height: 28 }, options: attrDFOptions })));
|
|
1183
|
-
return null;
|
|
1184
|
-
};
|
|
1185
|
-
const renderDetailDFSettings = () => {
|
|
1186
|
-
if (showDetailEditDF && selectedDFType && attrDFSettings)
|
|
1187
|
-
return (React.createElement("div", { style: {
|
|
1188
|
-
border: '1px solid #9e9e9e',
|
|
1189
|
-
borderRadius: '2px',
|
|
1190
|
-
padding: '8px',
|
|
1191
|
-
marginTop: '8px',
|
|
1192
|
-
display: 'flex',
|
|
1193
|
-
flexDirection: 'column',
|
|
1194
|
-
gap: '8px',
|
|
1195
|
-
} },
|
|
1196
|
-
React.createElement(DisplayFormat, { infos: infos, url: url, displayFormatType: selectedDFType, formatSettings: attrDFSettings, onSettingsChange: (values) => setAttrDFSettings(values), dynamicContentType: form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE) })));
|
|
1197
|
-
};
|
|
1198
|
-
return (React.createElement(ModalCustom, { closable: false, destroyOnClose: true, forceRender: true, mask: true, okButtonProps: { disabled: formSubmitDisabled }, title: modalTitle || t(translations.dynamicContent.modal.title.addDynamicContent), visible: visible, onCancel: handleOnCancelModal, onOk: handleOnOkModal },
|
|
1199
|
-
React.createElement(Spin, { spinning: isFetchingSourceBO ||
|
|
1200
|
-
isFetchingListBoAttr ||
|
|
1201
|
-
isFetchingEventAttr ||
|
|
1202
|
-
isFetchingPromotionPool ||
|
|
1203
|
-
isFetchingPromotionCodeAttr ||
|
|
1204
|
-
isFetchingDynamicContentAttr },
|
|
1205
|
-
React.createElement(Form, { style: { width: '100%' }, form: form, labelAlign: "left", labelCol: { span: 9 }, wrapperCol: { span: 15 }, onValuesChange: handleFormValuesChanges, initialValues: {
|
|
1206
|
-
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: listDynamicContentTypes[0].value,
|
|
1207
|
-
} },
|
|
1208
|
-
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.contentSource), name: DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE, required: true },
|
|
1209
|
-
React.createElement(Select, { style: { height: 28 }, options: listDynamicContentTypes })),
|
|
1210
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value && (React.createElement(React.Fragment, null, renderVisitorAttrFields())),
|
|
1211
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value && (React.createElement(React.Fragment, null, renderCustomerAttrFields())),
|
|
1212
|
-
selectedDynamicContentType === CUSTOM_TYPE.value && React.createElement(React.Fragment, null, renderCustomFunctionFields()),
|
|
1213
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value && (React.createElement(React.Fragment, null,
|
|
1214
|
-
renderEventFields(),
|
|
1215
|
-
renderSourceFields(),
|
|
1216
|
-
renderEventAttrFields(),
|
|
1217
|
-
isShowEventIndexField
|
|
1218
|
-
? renderIndexFields({ disabled: false, loading: false })
|
|
1219
|
-
: null)),
|
|
1220
|
-
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value && (React.createElement(React.Fragment, null,
|
|
1221
|
-
renderPromotionPoolFields(),
|
|
1222
|
-
renderPromotionCodeAttr())),
|
|
1223
|
-
selectedDynamicContentType && regexCSType.test(selectedDynamicContentType) && (React.createElement(React.Fragment, null,
|
|
1224
|
-
renderBoAttrFields(),
|
|
1225
|
-
renderIndexFields({ disabled: isActionArchive, loading: isFetchingListBoAttr }))),
|
|
1226
|
-
showDisplayFormat && renderDisplayFormat()),
|
|
1227
|
-
showDisplayFormat && renderDisplayFormat() !== null && renderDetailDFSettings(),
|
|
1228
|
-
isShowCustomFunction && selectedDynamicContentType === CUSTOM_TYPE.value && (React.createElement("div", { style: {
|
|
1229
|
-
display: 'flex',
|
|
1230
|
-
alignItems: 'center',
|
|
1231
|
-
justifyContent: 'start',
|
|
1232
|
-
marginBottom: '8px',
|
|
1233
|
-
marginTop: '10px',
|
|
1234
|
-
} },
|
|
1235
|
-
React.createElement(Checkbox, { onChange: handleSaveAsTemplate, checked: saveAsTemplate },
|
|
1236
|
-
React.createElement("span", { style: { fontSize: '12px' } }, t(translations.dynamicContent.modal.label.saveTemplate))))))));
|
|
1237
|
-
};
|
|
1238
|
-
AddDynamicContent.defaultProps = {
|
|
1239
|
-
showDisplayFormat: true,
|
|
1240
|
-
showIndex: true,
|
|
1241
|
-
APIConfig: {
|
|
1242
|
-
domain: 'https://sandbox-media-template.antsomi.com',
|
|
1243
|
-
slug: '/api/v1',
|
|
1244
|
-
token: '',
|
|
1245
|
-
userId: '',
|
|
1246
|
-
accountId: '',
|
|
1247
|
-
},
|
|
1248
|
-
};
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
/* eslint-disable no-case-declarations */
|
|
13
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
14
|
+
// Libraries
|
|
15
|
+
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
|
16
|
+
import { omit, isEmpty, flatMapDeep, set, get, isNaN } from 'lodash';
|
|
17
|
+
// Hooks
|
|
18
|
+
import { useDeepCompareEffect, useDeepCompareMemo } from '@antscorp/antsomi-ui/es/hooks';
|
|
19
|
+
// Components
|
|
20
|
+
import { TreeNode } from 'rc-tree-select';
|
|
21
|
+
import { Button, Checkbox, Text, Spin } from '../../atoms';
|
|
22
|
+
import { TreeSelect, Form, Select } from 'antd';
|
|
23
|
+
// Locales
|
|
24
|
+
import i18nInstance from '@antscorp/antsomi-ui/es/locales/i18n';
|
|
25
|
+
import { translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
26
|
+
// Query
|
|
27
|
+
import { useGetDynamicContentAttr, useGetListPromotionPool, useGetListEventAttr, useGetListPromotionCodeAttr, useGetListBO, useGetListAllEvents, useGetListSourceByEvent, useGetListAttributeBO, useGetCustomFunction, useAddSavedCSFunction, useUpdateCSFunction, } from '@antscorp/antsomi-ui/es/queries';
|
|
28
|
+
import { useGetEventTrackingAttributes } from '@antscorp/antsomi-ui/es/queries/ThirdParty';
|
|
29
|
+
// Queries config
|
|
30
|
+
import { queryClientAntsomiUI } from '@antscorp/antsomi-ui/es/queries/configs';
|
|
31
|
+
import { QUERY_KEYS } from '@antscorp/antsomi-ui/es/constants/queries';
|
|
32
|
+
import { dateExample } from './components/FormatDatetime';
|
|
33
|
+
import DisplayFormat from './components/DisplayFormat';
|
|
34
|
+
// Constants
|
|
35
|
+
import { DYNAMIC_CONTENT_SETTING_KEY, DYNAMIC_CONTENT_TYPE, DYNAMIC_CONTENT_ATTR_DF_TYPE, DATA_TYPE, ATTRIBUTE_TYPE, } from './constants';
|
|
36
|
+
// Utils
|
|
37
|
+
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
38
|
+
import { formatDatetimeDF, formatNumberDF, getAvailableAttrs, getStringFormatDateDF, regexCSType, serilizeBOAttr, serializeCSSelectedString, serilizeDynamicContentAttr, serilizeEventAttr, serilizePromotionPool, buildOptionAttrArchive, checkStatusAttr, serializeLabelToCode, buildMappingFields, CUSTOM_TYPE, } from './utils';
|
|
39
|
+
// Style
|
|
40
|
+
import { InputSuggestion, ModalCustom } from './styled';
|
|
41
|
+
import { EditorScript } from '../EditorScript';
|
|
42
|
+
const getMembers = (member) => {
|
|
43
|
+
if (!member.children || !member.children.length) {
|
|
44
|
+
return member;
|
|
45
|
+
}
|
|
46
|
+
return [member, member.children];
|
|
47
|
+
};
|
|
48
|
+
const PATH = 'src/components/molecules/AddDynamicContent/AddDynamicContent.tsx';
|
|
49
|
+
const initNumberDFSettings = {
|
|
50
|
+
grouping: ',',
|
|
51
|
+
decimal: '.',
|
|
52
|
+
decimalPlaces: 2,
|
|
53
|
+
isCompact: false,
|
|
54
|
+
currencyCode: 'USD',
|
|
55
|
+
prefixType: 'code',
|
|
56
|
+
};
|
|
57
|
+
const initDatetimeDFSettings = {
|
|
58
|
+
hasDateFormat: true,
|
|
59
|
+
hasTimeFormat: true,
|
|
60
|
+
dateParseOption: 'medium',
|
|
61
|
+
timeParseOption: 'medium',
|
|
62
|
+
dateParseFormat: 'MM/DD/YYYY',
|
|
63
|
+
timeParseFormat: '12hour',
|
|
64
|
+
};
|
|
65
|
+
const defaultDynamicTypes = [...Object.values(DYNAMIC_CONTENT_TYPE)]
|
|
66
|
+
.filter((i) => i.value !== 'bo-settings')
|
|
67
|
+
.sort((a, b) => a.index - b.index);
|
|
68
|
+
const optionDataType = [...Object.values(DATA_TYPE)];
|
|
69
|
+
export const AddDynamicContent = props => {
|
|
70
|
+
//* Props
|
|
71
|
+
const { defaultData = {}, defaultDynamicIndex = 1, visible, showDisplayFormat, showIndex, journeySettings, contentSources, APIConfig, isShowCustomFunction = false, modalTitle, } = props;
|
|
72
|
+
const { accountId, userId, token, domain, slug } = APIConfig;
|
|
73
|
+
const infos = { accountId, userId, token };
|
|
74
|
+
const { onCancel, onOk, additionalAttrProperties = [] } = props;
|
|
75
|
+
const url = useMemo(() => `${domain}${slug}`, [domain, slug]);
|
|
76
|
+
// Hook Queries
|
|
77
|
+
const { mutate: addSavedCSFunction } = useAddSavedCSFunction();
|
|
78
|
+
const { data: customFunction } = useGetCustomFunction({ url }, infos);
|
|
79
|
+
const { mutate: updateCSFunction } = useUpdateCSFunction();
|
|
80
|
+
//* Hooks
|
|
81
|
+
const { t, language } = i18nInstance;
|
|
82
|
+
//* Selectors
|
|
83
|
+
const { triggerEvent } = journeySettings;
|
|
84
|
+
const [itemTypeId, setItemTypeId] = useState(null);
|
|
85
|
+
// Form states
|
|
86
|
+
const [form] = Form.useForm();
|
|
87
|
+
const selectedDynamicContentType = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE, form);
|
|
88
|
+
const selectedAttr = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, form);
|
|
89
|
+
const selectedDFType = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE, form);
|
|
90
|
+
const selectedEventSource = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.EVENT, form);
|
|
91
|
+
const selectedSource = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.SOURCE, form);
|
|
92
|
+
const selectedBoIndex = Form.useWatch(DYNAMIC_CONTENT_SETTING_KEY.INDEX, form);
|
|
93
|
+
const [formSubmitDisabled, setFormSubmitDisabled] = useState(true);
|
|
94
|
+
const [saveAsTemplate, setsaveAsTemplate] = useState(false);
|
|
95
|
+
const [hasError, setHasError] = useState({
|
|
96
|
+
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: false,
|
|
97
|
+
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: false,
|
|
98
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
|
|
99
|
+
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false,
|
|
100
|
+
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false,
|
|
101
|
+
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: false,
|
|
102
|
+
[DYNAMIC_CONTENT_SETTING_KEY.PERNAME]: false,
|
|
103
|
+
});
|
|
104
|
+
// Queries
|
|
105
|
+
const { data: listBO } = useGetListBO({ url }, infos);
|
|
106
|
+
// defaultSettings
|
|
107
|
+
const [defaultAttrDFSetings, setDefaultAttrDFSetings] = useState(null);
|
|
108
|
+
// Variables
|
|
109
|
+
const [eventActionId, eventCategoryId] = (selectedEventSource === null || selectedEventSource === void 0 ? void 0 : selectedEventSource.split(':').map(Number)) || [];
|
|
110
|
+
// Selection Options states
|
|
111
|
+
const [listDynamicContentTypes, setListDynamicContentTypes] = useState(defaultDynamicTypes);
|
|
112
|
+
const [listCustomerAttributes, setListCustomerAttributes] = useState([]);
|
|
113
|
+
const [listVisitorAttributes, setListVisitorAttributes] = useState([]);
|
|
114
|
+
const [listCustomTemplates, setlistCustomTemplates] = useState([]);
|
|
115
|
+
const [listCustomTemplatesSearch, setlistCustomTemplatesSearch] = useState([]);
|
|
116
|
+
const [searchValue, setSearchValue] = useState('');
|
|
117
|
+
// Expanded keys in tree select
|
|
118
|
+
const [expandedEventAttributes, setExpandedEventAttributes] = useState([]);
|
|
119
|
+
const [isActionArchive, setActionArchive] = useState(false);
|
|
120
|
+
const [errorMessageAttr, setErrorMessageAttr] = useState();
|
|
121
|
+
// Number Display format
|
|
122
|
+
const [showDetailEditDF, setShowDetailEditDF] = useState(false);
|
|
123
|
+
const [formatedAttr, setFormatedAttr] = useState('');
|
|
124
|
+
const [attrDFSettings, setAttrDFSettings] = useState(undefined);
|
|
125
|
+
const [templateName, setTemplateName] = useState('');
|
|
126
|
+
const [attrDFOptions, setAttrDFOptions] = useState([]);
|
|
127
|
+
// Template Custom
|
|
128
|
+
const [templateId, settemplateId] = useState();
|
|
129
|
+
const { data: listBoAttributes = [], isFetching: isFetchingListBoAttr, isError: isErrorBoAttr, } = useGetListAttributeBO({
|
|
130
|
+
url,
|
|
131
|
+
itemTypeIds: itemTypeId ? [itemTypeId] : [],
|
|
132
|
+
options: {
|
|
133
|
+
onSuccess: (data) => {
|
|
134
|
+
setHasError({
|
|
135
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
|
|
136
|
+
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: false,
|
|
137
|
+
});
|
|
138
|
+
if (data.length &&
|
|
139
|
+
selectedDynamicContentType &&
|
|
140
|
+
regexCSType.test(selectedDynamicContentType)) {
|
|
141
|
+
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE) &&
|
|
142
|
+
form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.INDEX))
|
|
143
|
+
return;
|
|
144
|
+
form.setFieldsValue({
|
|
145
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: data[0],
|
|
146
|
+
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
select: (data) => serilizeBOAttr(data, additionalAttrProperties),
|
|
151
|
+
onError: (error) => {
|
|
152
|
+
setHasError({
|
|
153
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
|
|
154
|
+
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: true,
|
|
155
|
+
});
|
|
156
|
+
handleError(error, {
|
|
157
|
+
path: PATH,
|
|
158
|
+
name: 'useGetListAttributeBO',
|
|
159
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
enabled: !!itemTypeId,
|
|
163
|
+
},
|
|
164
|
+
}, infos);
|
|
165
|
+
const { data: dynamicContentAttr, isFetching: isFetchingDynamicContentAttr, isError: isErrorDynamicContentAttr, } = useGetDynamicContentAttr({ url }, infos, {
|
|
166
|
+
onSuccess: () => {
|
|
167
|
+
setHasError({
|
|
168
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false,
|
|
169
|
+
});
|
|
170
|
+
},
|
|
171
|
+
onError: (error) => {
|
|
172
|
+
setHasError({
|
|
173
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
|
|
174
|
+
});
|
|
175
|
+
handleError(error, {
|
|
176
|
+
path: PATH,
|
|
177
|
+
name: 'useGetDynamicContentAttr',
|
|
178
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
const { data: listSources, isFetching: isFetchingSourceBO } = useGetListSourceByEvent({
|
|
183
|
+
apiConfig: {
|
|
184
|
+
url,
|
|
185
|
+
},
|
|
186
|
+
infos,
|
|
187
|
+
eventActionId,
|
|
188
|
+
eventCategoryId,
|
|
189
|
+
options: {
|
|
190
|
+
onSuccess: () => {
|
|
191
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: false });
|
|
192
|
+
},
|
|
193
|
+
select: (data) => {
|
|
194
|
+
const { rows } = data || {};
|
|
195
|
+
return rows.map((row) => ({
|
|
196
|
+
label: row.label,
|
|
197
|
+
value: row.value,
|
|
198
|
+
}));
|
|
199
|
+
},
|
|
200
|
+
onError: (error) => {
|
|
201
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: true });
|
|
202
|
+
handleError(error, {
|
|
203
|
+
path: PATH,
|
|
204
|
+
name: 'useGetListSourceBO',
|
|
205
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
const { data: listEvents, isFetching: isFetchingEventBySource } = useGetListAllEvents({
|
|
211
|
+
apiConfig: {
|
|
212
|
+
url,
|
|
213
|
+
},
|
|
214
|
+
infos,
|
|
215
|
+
options: {
|
|
216
|
+
onSuccess: (data) => {
|
|
217
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: false });
|
|
218
|
+
if (!isEmpty(data) &&
|
|
219
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
220
|
+
form.setFieldsValue({
|
|
221
|
+
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: data[0].value,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
onError: (error) => {
|
|
226
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.EVENT]: true });
|
|
227
|
+
handleError(error, {
|
|
228
|
+
path: PATH,
|
|
229
|
+
name: 'useGetListEventBySource',
|
|
230
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
231
|
+
});
|
|
232
|
+
},
|
|
233
|
+
select: (data) => {
|
|
234
|
+
const { rows = [] } = data || {};
|
|
235
|
+
return rows.map((event) => ({
|
|
236
|
+
label: event.label,
|
|
237
|
+
value: `${event.eventActionId}:${event.eventCategoryId}`,
|
|
238
|
+
}));
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
});
|
|
242
|
+
const { data: listEventAttributes, isFetching: isFetchingEventAttr, isError: isErrorEventAttr, } = useGetListEventAttr({ url }, infos, selectedEventSource || '', Array.isArray(selectedSource) ? selectedSource.join(',') : selectedSource || '', {
|
|
243
|
+
onSuccess: () => setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false }),
|
|
244
|
+
onError: (error) => {
|
|
245
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
|
|
246
|
+
handleError(error, {
|
|
247
|
+
path: PATH,
|
|
248
|
+
name: 'useGetListEventAttr',
|
|
249
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
250
|
+
});
|
|
251
|
+
},
|
|
252
|
+
select: (data) => serilizeEventAttr(data, language, additionalAttrProperties),
|
|
253
|
+
});
|
|
254
|
+
const { data: listPromotionPools, isFetching: isFetchingPromotionPool } = useGetListPromotionPool({ url }, infos, {
|
|
255
|
+
onSuccess: () => {
|
|
256
|
+
setHasError({
|
|
257
|
+
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: false,
|
|
258
|
+
});
|
|
259
|
+
},
|
|
260
|
+
select: (data) => serilizePromotionPool(data, additionalAttrProperties),
|
|
261
|
+
onError: (error) => {
|
|
262
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true });
|
|
263
|
+
handleError(error, {
|
|
264
|
+
path: PATH,
|
|
265
|
+
name: 'useGetListPromotionPool',
|
|
266
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
267
|
+
});
|
|
268
|
+
},
|
|
269
|
+
});
|
|
270
|
+
const { data: listPromotionCodeAttributes, isFetching: isFetchingPromotionCodeAttr, isError: isErrorListPromotionCodeAttr, } = useGetListPromotionCodeAttr({ url }, infos, {
|
|
271
|
+
onSuccess: () => {
|
|
272
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: false });
|
|
273
|
+
},
|
|
274
|
+
select: (data) => data
|
|
275
|
+
.filter((attr) => +(attr === null || attr === void 0 ? void 0 : attr.status) === 1)
|
|
276
|
+
.map((attr) => ({
|
|
277
|
+
label: attr.propertyDisplayMultilang[language] ||
|
|
278
|
+
attr.propertyDisplayMultilang[get(attr, "propertyDisplayMultilang['DEFAULT_LANG']", 'EN')],
|
|
279
|
+
value: attr.itemPropertyName,
|
|
280
|
+
dataType: attr.dataType,
|
|
281
|
+
disabled: parseInt(attr.status) === 4,
|
|
282
|
+
status: attr.status,
|
|
283
|
+
})),
|
|
284
|
+
onError: (error) => {
|
|
285
|
+
setHasError({
|
|
286
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: true,
|
|
287
|
+
});
|
|
288
|
+
handleError(error, {
|
|
289
|
+
path: PATH,
|
|
290
|
+
name: 'useGetPromotionCodeAttr',
|
|
291
|
+
args: error === null || error === void 0 ? void 0 : error.message,
|
|
292
|
+
});
|
|
293
|
+
},
|
|
294
|
+
});
|
|
295
|
+
const { data: eventTrackingAttributes } = useGetEventTrackingAttributes({
|
|
296
|
+
apiConfig: { url },
|
|
297
|
+
infos,
|
|
298
|
+
eventActionId,
|
|
299
|
+
eventCategoryId,
|
|
300
|
+
});
|
|
301
|
+
// Memo
|
|
302
|
+
const isShowEventIndexField = useDeepCompareMemo(() => {
|
|
303
|
+
if (selectedAttr && selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
304
|
+
if (selectedAttr.itemTypeId) {
|
|
305
|
+
return !!get(selectedAttr, 'eventPropertySyntax', '').includes('items');
|
|
306
|
+
}
|
|
307
|
+
return selectedAttr.type === ATTRIBUTE_TYPE.ITEM;
|
|
308
|
+
}
|
|
309
|
+
return false;
|
|
310
|
+
}, [selectedAttr, selectedDynamicContentType, eventTrackingAttributes === null || eventTrackingAttributes === void 0 ? void 0 : eventTrackingAttributes.mainObjects]);
|
|
311
|
+
const itemTypeName = useMemo(() => {
|
|
312
|
+
var _a;
|
|
313
|
+
let draftItemTypeName = '';
|
|
314
|
+
if (itemTypeId) {
|
|
315
|
+
draftItemTypeName = ((_a = listBO === null || listBO === void 0 ? void 0 : listBO.find((bo) => bo.id === itemTypeId)) === null || _a === void 0 ? void 0 : _a.name) || '';
|
|
316
|
+
}
|
|
317
|
+
return draftItemTypeName;
|
|
318
|
+
}, [itemTypeId, listBO]);
|
|
319
|
+
// Add BO settings (if exists) to list Dynamic content Type, or removed from the previous states
|
|
320
|
+
useEffect(() => {
|
|
321
|
+
const temp = [...defaultDynamicTypes];
|
|
322
|
+
contentSources.groups.forEach((g) => {
|
|
323
|
+
if (!g.itemTypeId)
|
|
324
|
+
return;
|
|
325
|
+
temp.push({
|
|
326
|
+
index: temp.length,
|
|
327
|
+
label: `${g.groupName} (${g.itemTypeDisplay})`,
|
|
328
|
+
value: `content-source::${g.groupId}::${g.itemTypeId}`,
|
|
329
|
+
});
|
|
330
|
+
});
|
|
331
|
+
if (isShowCustomFunction) {
|
|
332
|
+
temp.push(Object.assign(Object.assign({}, CUSTOM_TYPE), { index: temp.length }));
|
|
333
|
+
}
|
|
334
|
+
setListDynamicContentTypes(temp);
|
|
335
|
+
}, [contentSources.groups, isShowCustomFunction]);
|
|
336
|
+
useEffect(() => {
|
|
337
|
+
if (Array.isArray(customFunction) && customFunction.length) {
|
|
338
|
+
const temp = [];
|
|
339
|
+
customFunction.forEach(item => {
|
|
340
|
+
temp.push(Object.assign(Object.assign({}, item), { label: item.template_name, value: item.template_name }));
|
|
341
|
+
});
|
|
342
|
+
setlistCustomTemplates(temp);
|
|
343
|
+
}
|
|
344
|
+
}, [customFunction, visible]);
|
|
345
|
+
useDeepCompareEffect(() => {
|
|
346
|
+
if (dynamicContentAttr) {
|
|
347
|
+
const { customer, visitor } = dynamicContentAttr;
|
|
348
|
+
const dynamicContentType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
349
|
+
const parseCustomers = serilizeDynamicContentAttr(customer, language, additionalAttrProperties);
|
|
350
|
+
const parseVisitors = serilizeDynamicContentAttr(visitor, language, additionalAttrProperties);
|
|
351
|
+
setListCustomerAttributes(parseCustomers);
|
|
352
|
+
setListVisitorAttributes(parseVisitors);
|
|
353
|
+
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE))
|
|
354
|
+
return;
|
|
355
|
+
if (dynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value) {
|
|
356
|
+
form.setFieldsValue({
|
|
357
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(parseVisitors)[0],
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
if (dynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value) {
|
|
361
|
+
form.setFieldsValue({
|
|
362
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(parseCustomers)[0],
|
|
363
|
+
});
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
}, [dynamicContentAttr, form, language]);
|
|
367
|
+
useDeepCompareEffect(() => {
|
|
368
|
+
if (listSources && selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
369
|
+
if (!isEmpty(form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.SOURCE)))
|
|
370
|
+
return;
|
|
371
|
+
const defaultValue = listSources[0] ? [listSources[0].value] : [];
|
|
372
|
+
form.setFieldsValue({
|
|
373
|
+
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: defaultValue,
|
|
374
|
+
});
|
|
375
|
+
}
|
|
376
|
+
}, [selectedEventSource, listSources, form, selectedDynamicContentType]);
|
|
377
|
+
useDeepCompareEffect(() => {
|
|
378
|
+
var _a, _b;
|
|
379
|
+
if (listEventAttributes &&
|
|
380
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
381
|
+
const initEventAttr = ((_a = listEventAttributes[0]) === null || _a === void 0 ? void 0 : _a.children.length)
|
|
382
|
+
? getAvailableAttrs((_b = listEventAttributes[0]) === null || _b === void 0 ? void 0 : _b.children)[0]
|
|
383
|
+
: listEventAttributes[0];
|
|
384
|
+
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE)) {
|
|
385
|
+
const eventAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
386
|
+
setExpandedEventAttributes([eventAttr.value.split('.')[0]]);
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
form.setFieldsValue({
|
|
390
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: initEventAttr,
|
|
391
|
+
});
|
|
392
|
+
setExpandedEventAttributes([initEventAttr.value.split('.')[0]]);
|
|
393
|
+
}
|
|
394
|
+
}, [selectedSource, selectedEventSource, listEventAttributes, form, selectedDynamicContentType]);
|
|
395
|
+
useDeepCompareEffect(() => {
|
|
396
|
+
if (listPromotionCodeAttributes &&
|
|
397
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value) {
|
|
398
|
+
if (form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE))
|
|
399
|
+
return;
|
|
400
|
+
form.setFieldsValue({
|
|
401
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listPromotionCodeAttributes)[0],
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
}, [selectedDynamicContentType, listPromotionCodeAttributes, form]);
|
|
405
|
+
// Update form field data with default data/ or reset it to initial states
|
|
406
|
+
const resetStateAndFormValueDF = useCallback(() => {
|
|
407
|
+
setShowDetailEditDF(false);
|
|
408
|
+
setAttrDFSettings(undefined);
|
|
409
|
+
setAttrDFOptions([]);
|
|
410
|
+
setFormatedAttr('');
|
|
411
|
+
setsaveAsTemplate(false);
|
|
412
|
+
setTemplateName('');
|
|
413
|
+
setSearchValue('');
|
|
414
|
+
form.setFieldsValue({
|
|
415
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: undefined,
|
|
416
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: undefined,
|
|
417
|
+
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: undefined,
|
|
418
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: optionDataType[0].value,
|
|
419
|
+
});
|
|
420
|
+
}, [form]);
|
|
421
|
+
useEffect(() => {
|
|
422
|
+
if (!visible) {
|
|
423
|
+
setTimeout(() => {
|
|
424
|
+
resetStateAndFormValueDF();
|
|
425
|
+
}, 200);
|
|
426
|
+
}
|
|
427
|
+
}, [visible, resetStateAndFormValueDF]);
|
|
428
|
+
useEffect(() => {
|
|
429
|
+
let listTmp = [];
|
|
430
|
+
switch (true) {
|
|
431
|
+
case selectedDynamicContentType && regexCSType.test(selectedDynamicContentType):
|
|
432
|
+
listTmp = [...listBoAttributes];
|
|
433
|
+
break;
|
|
434
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value:
|
|
435
|
+
listTmp = listPromotionCodeAttributes ? [...listPromotionCodeAttributes] : [];
|
|
436
|
+
break;
|
|
437
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value:
|
|
438
|
+
listTmp = [...listCustomerAttributes];
|
|
439
|
+
break;
|
|
440
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value:
|
|
441
|
+
listTmp = [...listVisitorAttributes];
|
|
442
|
+
break;
|
|
443
|
+
default:
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
const { errorMessage, isDisable } = checkStatusAttr({
|
|
447
|
+
listBO: listBO,
|
|
448
|
+
itemTypeId: itemTypeId || 0,
|
|
449
|
+
listAttribute: listTmp,
|
|
450
|
+
field: selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.value,
|
|
451
|
+
});
|
|
452
|
+
setActionArchive(isDisable);
|
|
453
|
+
setErrorMessageAttr(errorMessage);
|
|
454
|
+
}, [selectedAttr]);
|
|
455
|
+
useEffect(() => {
|
|
456
|
+
var _a;
|
|
457
|
+
if (!visible) {
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if ((_a = Object.keys(Object.assign({}, defaultData))) === null || _a === void 0 ? void 0 : _a.length) {
|
|
461
|
+
let draftDefaultData = Object.assign({}, defaultData);
|
|
462
|
+
if (draftDefaultData.type !== 'custom') {
|
|
463
|
+
if (triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.eventActionId) {
|
|
464
|
+
draftDefaultData = omit(draftDefaultData, ['event', 'source']);
|
|
465
|
+
}
|
|
466
|
+
form.setFieldsValue(draftDefaultData);
|
|
467
|
+
const defaultDMType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
468
|
+
const defaultAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
469
|
+
if (defaultDMType && regexCSType.test(defaultDMType)) {
|
|
470
|
+
const { itemTypeId } = serializeCSSelectedString(defaultDMType);
|
|
471
|
+
if (!isNaN(itemTypeId))
|
|
472
|
+
setItemTypeId(itemTypeId);
|
|
473
|
+
}
|
|
474
|
+
if (defaultAttr) {
|
|
475
|
+
const defaultAttr = draftDefaultData[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE];
|
|
476
|
+
// eslint-disable-next-line no-prototype-builtins
|
|
477
|
+
if (!defaultAttr.hasOwnProperty('dataType'))
|
|
478
|
+
return;
|
|
479
|
+
let key = '';
|
|
480
|
+
if (defaultAttr.dataType === 'number') {
|
|
481
|
+
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_NUMBERIC_ATTR_FORMAT_SETTINGS;
|
|
482
|
+
}
|
|
483
|
+
if (defaultAttr.dataType === 'datetime') {
|
|
484
|
+
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_DATETIME_ATTR_FORMAT_SETTINGS;
|
|
485
|
+
}
|
|
486
|
+
if (key && defaultAttr[key]) {
|
|
487
|
+
const _b = defaultAttr[key], { type } = _b, settingValues = __rest(_b, ["type"]);
|
|
488
|
+
form.setFieldsValue({
|
|
489
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: type,
|
|
490
|
+
});
|
|
491
|
+
setDefaultAttrDFSetings({
|
|
492
|
+
itemPropertyName: defaultAttr.value,
|
|
493
|
+
settings: settingValues,
|
|
494
|
+
});
|
|
495
|
+
setAttrDFSettings(settingValues);
|
|
496
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === defaultAttr.dataType));
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
const { customFunction } = draftDefaultData;
|
|
502
|
+
const { outputFormat } = customFunction;
|
|
503
|
+
form.setFieldsValue({
|
|
504
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: draftDefaultData.type,
|
|
505
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: outputFormat.type,
|
|
506
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: customFunction.outputDataType,
|
|
507
|
+
[DYNAMIC_CONTENT_SETTING_KEY.PERNAME]: customFunction.templateName,
|
|
508
|
+
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: customFunction.customFunction,
|
|
509
|
+
});
|
|
510
|
+
setTemplateName(customFunction.templateName);
|
|
511
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === customFunction.outputDataType));
|
|
512
|
+
setShowDetailEditDF(true);
|
|
513
|
+
setAttrDFSettings(customFunction.outputDataType === 'string' ? undefined : outputFormat.config);
|
|
514
|
+
}
|
|
515
|
+
// Check if trigger event of journey has event then don's set current event and source
|
|
516
|
+
}
|
|
517
|
+
else {
|
|
518
|
+
// Hard reset to Visitor attr
|
|
519
|
+
if (listVisitorAttributes) {
|
|
520
|
+
form.setFieldsValue({
|
|
521
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value,
|
|
522
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: listVisitorAttributes[0],
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
527
|
+
}, [defaultData, visible, form]);
|
|
528
|
+
useDeepCompareEffect(() => {
|
|
529
|
+
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
530
|
+
const { eventActionId, eventCategoryId, insightPropertyIds } = triggerEvent || {};
|
|
531
|
+
if (!!eventActionId && !!eventCategoryId) {
|
|
532
|
+
form.setFieldsValue({
|
|
533
|
+
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: `${eventActionId}:${eventCategoryId}`,
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
if (Array.isArray(insightPropertyIds) && insightPropertyIds.length) {
|
|
537
|
+
form.setFieldsValue({
|
|
538
|
+
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: insightPropertyIds,
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
}, [triggerEvent, selectedDynamicContentType]);
|
|
543
|
+
// Disable Apply button if there's any error
|
|
544
|
+
useLayoutEffect(() => {
|
|
545
|
+
setFormSubmitDisabled(Object.values(hasError).some(error => error));
|
|
546
|
+
}, [hasError]);
|
|
547
|
+
useLayoutEffect(() => {
|
|
548
|
+
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value ||
|
|
549
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value) {
|
|
550
|
+
setFormSubmitDisabled(isFetchingDynamicContentAttr);
|
|
551
|
+
}
|
|
552
|
+
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
553
|
+
setFormSubmitDisabled(isFetchingSourceBO || isFetchingEventBySource || isFetchingEventAttr);
|
|
554
|
+
}
|
|
555
|
+
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value) {
|
|
556
|
+
setFormSubmitDisabled(isFetchingPromotionPool || isFetchingPromotionCodeAttr);
|
|
557
|
+
}
|
|
558
|
+
if (selectedDynamicContentType && regexCSType.test(selectedDynamicContentType)) {
|
|
559
|
+
setFormSubmitDisabled(isFetchingListBoAttr);
|
|
560
|
+
}
|
|
561
|
+
}, [
|
|
562
|
+
isFetchingDynamicContentAttr,
|
|
563
|
+
selectedDynamicContentType,
|
|
564
|
+
isFetchingSourceBO,
|
|
565
|
+
isFetchingEventBySource,
|
|
566
|
+
isFetchingEventAttr,
|
|
567
|
+
isFetchingPromotionPool,
|
|
568
|
+
isFetchingPromotionCodeAttr,
|
|
569
|
+
isFetchingListBoAttr,
|
|
570
|
+
]);
|
|
571
|
+
useLayoutEffect(() => {
|
|
572
|
+
let formatedDFValue = '';
|
|
573
|
+
let settings = attrDFSettings;
|
|
574
|
+
const selectedAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
575
|
+
const dataType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE);
|
|
576
|
+
const dynamicType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
577
|
+
if ((Object.keys(defaultData).length > 0 && defaultData.type !== 'custom') ||
|
|
578
|
+
dynamicType !== 'custom') {
|
|
579
|
+
if (selectedAttr &&
|
|
580
|
+
selectedAttr.dataType &&
|
|
581
|
+
['datetime', 'number'].includes(selectedAttr.dataType)) {
|
|
582
|
+
/* when change select if attr selected is previous selected default attr, set settings as default settings */
|
|
583
|
+
if (!settings &&
|
|
584
|
+
(defaultAttrDFSetings === null || defaultAttrDFSetings === void 0 ? void 0 : defaultAttrDFSetings.itemPropertyName) === selectedAttr.value) {
|
|
585
|
+
// Visitor and Customer don't have additional field
|
|
586
|
+
let equalDefaultAttr = true;
|
|
587
|
+
// Event need check additional field source, event by soucre
|
|
588
|
+
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
589
|
+
const source = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.SOURCE);
|
|
590
|
+
const event = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.EVENT);
|
|
591
|
+
if (source !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.SOURCE] ||
|
|
592
|
+
event !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.EVENT])
|
|
593
|
+
equalDefaultAttr = false;
|
|
594
|
+
}
|
|
595
|
+
// Promotion need check additional field promotion pool
|
|
596
|
+
if (selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value) {
|
|
597
|
+
const pool = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL);
|
|
598
|
+
if (pool !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL])
|
|
599
|
+
equalDefaultAttr = false;
|
|
600
|
+
}
|
|
601
|
+
// BO settings need check additional field index
|
|
602
|
+
if (selectedDynamicContentType && regexCSType.test(selectedDynamicContentType)) {
|
|
603
|
+
if (selectedBoIndex !== defaultData[DYNAMIC_CONTENT_SETTING_KEY.INDEX])
|
|
604
|
+
equalDefaultAttr = false;
|
|
605
|
+
}
|
|
606
|
+
if (equalDefaultAttr) {
|
|
607
|
+
settings = defaultAttrDFSetings.settings;
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
// *********** //
|
|
611
|
+
// Numberic Attribute DF
|
|
612
|
+
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'number') {
|
|
613
|
+
settings = settings !== null && settings !== void 0 ? settings : initNumberDFSettings;
|
|
614
|
+
formatedDFValue = formatNumberDF(1234.56789, selectedDFType, settings);
|
|
615
|
+
}
|
|
616
|
+
// Datatime Attribute DF
|
|
617
|
+
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'datetime') {
|
|
618
|
+
settings = settings !== null && settings !== void 0 ? settings : Object.assign(Object.assign({}, initDatetimeDFSettings), { language });
|
|
619
|
+
formatedDFValue = formatDatetimeDF(dateExample, settings);
|
|
620
|
+
}
|
|
621
|
+
if (!attrDFOptions.length) {
|
|
622
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === selectedAttr.dataType));
|
|
623
|
+
}
|
|
624
|
+
setAttrDFSettings(settings);
|
|
625
|
+
setFormatedAttr(formatedDFValue);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
if (dataType && ['datetime', 'number'].includes(dataType) && dynamicType === 'custom') {
|
|
629
|
+
// Numberic Attribute DF
|
|
630
|
+
if (dataType === 'number') {
|
|
631
|
+
settings = settings !== null && settings !== void 0 ? settings : initNumberDFSettings;
|
|
632
|
+
formatedDFValue = formatNumberDF(1234.56789, selectedDFType, settings);
|
|
633
|
+
}
|
|
634
|
+
// Datatime Attribute DF
|
|
635
|
+
if (dataType === 'datetime') {
|
|
636
|
+
settings = settings !== null && settings !== void 0 ? settings : Object.assign(Object.assign({}, initDatetimeDFSettings), { language });
|
|
637
|
+
formatedDFValue = formatDatetimeDF(dateExample, settings);
|
|
638
|
+
}
|
|
639
|
+
if (!attrDFOptions.length) {
|
|
640
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === dataType));
|
|
641
|
+
}
|
|
642
|
+
setAttrDFSettings(settings);
|
|
643
|
+
setFormatedAttr(formatedDFValue);
|
|
644
|
+
}
|
|
645
|
+
}, [
|
|
646
|
+
attrDFSettings,
|
|
647
|
+
selectedDFType,
|
|
648
|
+
attrDFOptions.length,
|
|
649
|
+
language,
|
|
650
|
+
defaultAttrDFSetings,
|
|
651
|
+
form,
|
|
652
|
+
selectedAttr,
|
|
653
|
+
defaultData,
|
|
654
|
+
selectedDynamicContentType,
|
|
655
|
+
selectedBoIndex,
|
|
656
|
+
]);
|
|
657
|
+
//* Handlers
|
|
658
|
+
const handleOnCancelModal = () => {
|
|
659
|
+
if (onCancel) {
|
|
660
|
+
onCancel();
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
const onChangeDataInput = (value) => {
|
|
664
|
+
setTemplateName(value);
|
|
665
|
+
let tempState = [...listCustomTemplates];
|
|
666
|
+
if (value.length > 0) {
|
|
667
|
+
tempState = tempState.filter(item => item.label.toLowerCase().includes(value.trim().toLowerCase()));
|
|
668
|
+
}
|
|
669
|
+
setlistCustomTemplatesSearch(tempState);
|
|
670
|
+
setSearchValue(value);
|
|
671
|
+
};
|
|
672
|
+
const handleSelect = (data) => {
|
|
673
|
+
const dataTmp = listCustomTemplates.filter(each => each.value === data);
|
|
674
|
+
settemplateId(dataTmp[0].template_id);
|
|
675
|
+
let dataFormat = dataTmp[0].output_format.type.toLowerCase();
|
|
676
|
+
switch (dataTmp[0].output_format.type) {
|
|
677
|
+
case 'DATE_AND_TIME':
|
|
678
|
+
dataFormat = 'date_and_time';
|
|
679
|
+
break;
|
|
680
|
+
case 'RAW_STRING':
|
|
681
|
+
dataFormat = 'raw_string';
|
|
682
|
+
break;
|
|
683
|
+
default:
|
|
684
|
+
break;
|
|
685
|
+
}
|
|
686
|
+
form.setFieldsValue({
|
|
687
|
+
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: dataTmp[0].custom_function,
|
|
688
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: dataTmp[0].output_data_type,
|
|
689
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: dataFormat === 'date_and_time' ? 'datetime' : dataFormat,
|
|
690
|
+
});
|
|
691
|
+
setTemplateName(dataTmp[0].template_name);
|
|
692
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === dataTmp[0].output_data_type));
|
|
693
|
+
const format = dataTmp[0].output_format.config;
|
|
694
|
+
switch (dataFormat) {
|
|
695
|
+
case 'currency': {
|
|
696
|
+
setAttrDFSettings(Object.assign(Object.assign({}, initNumberDFSettings), { grouping: format.group || ',', decimal: format.decimal, decimalPlaces: format.decimalPlace, isCompact: format.isCompactNumber || false, currencyCode: format.currency || 'USD', prefixType: format.prefixType || 'code' }));
|
|
697
|
+
break;
|
|
698
|
+
}
|
|
699
|
+
case 'number':
|
|
700
|
+
case 'percentage': {
|
|
701
|
+
setAttrDFSettings(Object.assign(Object.assign({}, initNumberDFSettings), { grouping: format.group || ',', decimal: format.decimal, decimalPlaces: format.decimalPlace, isCompact: format.isCompactNumber || false }));
|
|
702
|
+
break;
|
|
703
|
+
}
|
|
704
|
+
case 'date_and_time': {
|
|
705
|
+
setAttrDFSettings(Object.assign(Object.assign({}, initDatetimeDFSettings), { language, hasDateFormat: format.date.check || true, hasTimeFormat: format.time.check || true, dateParseOption: format.date.value || 'medium', timeParseOption: format.time.value || 'medium', dateParseFormat: format.format || 'MM/DD/YYYY', timeParseFormat: `${format.time.timeFormat || 12}hour` }));
|
|
706
|
+
break;
|
|
707
|
+
}
|
|
708
|
+
case 'raw_string': {
|
|
709
|
+
setAttrDFSettings(undefined);
|
|
710
|
+
break;
|
|
711
|
+
}
|
|
712
|
+
default:
|
|
713
|
+
break;
|
|
714
|
+
}
|
|
715
|
+
};
|
|
716
|
+
const handleOnOkModal = () => {
|
|
717
|
+
if (isActionArchive &&
|
|
718
|
+
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
form.validateFields().then((values) => {
|
|
722
|
+
var _a;
|
|
723
|
+
values = omit(values, 'dfType');
|
|
724
|
+
if (onOk) {
|
|
725
|
+
const type = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE);
|
|
726
|
+
if (type === 'custom') {
|
|
727
|
+
const outputFormat = {};
|
|
728
|
+
const perName = templateName;
|
|
729
|
+
const functionCustom = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.FUNCTION);
|
|
730
|
+
const dataType = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE);
|
|
731
|
+
const displayFormat = form.getFieldValue([
|
|
732
|
+
DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE,
|
|
733
|
+
]);
|
|
734
|
+
if (templateId && !saveAsTemplate) {
|
|
735
|
+
try {
|
|
736
|
+
updateCSFunction({
|
|
737
|
+
url,
|
|
738
|
+
infos,
|
|
739
|
+
templateId,
|
|
740
|
+
name: perName,
|
|
741
|
+
dataType,
|
|
742
|
+
functionCustom,
|
|
743
|
+
dataFormat: attrDFSettings,
|
|
744
|
+
displayFormat,
|
|
745
|
+
outputFormat,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
catch (error) {
|
|
749
|
+
handleError(error, {
|
|
750
|
+
path: PATH,
|
|
751
|
+
name: 'onClickSaveDynamicContent',
|
|
752
|
+
args: {},
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
else if (saveAsTemplate) {
|
|
757
|
+
try {
|
|
758
|
+
addSavedCSFunction({
|
|
759
|
+
url,
|
|
760
|
+
infos,
|
|
761
|
+
name: perName,
|
|
762
|
+
dataType,
|
|
763
|
+
functionCustom,
|
|
764
|
+
dataFormat: attrDFSettings,
|
|
765
|
+
displayFormat,
|
|
766
|
+
outputFormat,
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
catch (error) {
|
|
770
|
+
handleError(error, {
|
|
771
|
+
path: PATH,
|
|
772
|
+
name: 'onClickSaveDynamicContent',
|
|
773
|
+
args: {},
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
if (!showIndex) {
|
|
778
|
+
values = omit(values, 'index');
|
|
779
|
+
}
|
|
780
|
+
const config = Object.assign({}, attrDFSettings);
|
|
781
|
+
if (dataType === 'datetime') {
|
|
782
|
+
config.dateFormatString = getStringFormatDateDF(attrDFSettings);
|
|
783
|
+
}
|
|
784
|
+
onOk(Object.assign(Object.assign({}, values), { customFunction: {
|
|
785
|
+
outputFormat: {
|
|
786
|
+
type: displayFormat,
|
|
787
|
+
config,
|
|
788
|
+
},
|
|
789
|
+
templateCode: serializeLabelToCode(perName),
|
|
790
|
+
templateName: perName,
|
|
791
|
+
templateType: 'custom',
|
|
792
|
+
customFunction: functionCustom,
|
|
793
|
+
outputDataType: dataType,
|
|
794
|
+
}, attribute: {
|
|
795
|
+
label: perName,
|
|
796
|
+
value: serializeLabelToCode(perName),
|
|
797
|
+
}, mappingFields: `#{custom.${serializeLabelToCode(perName)}}` }));
|
|
798
|
+
}
|
|
799
|
+
else {
|
|
800
|
+
let key = '';
|
|
801
|
+
const otherField = {};
|
|
802
|
+
const selectedAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
803
|
+
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'number') {
|
|
804
|
+
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_NUMBERIC_ATTR_FORMAT_SETTINGS;
|
|
805
|
+
}
|
|
806
|
+
if ((selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) === 'datetime') {
|
|
807
|
+
key = DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_DATETIME_ATTR_FORMAT_SETTINGS;
|
|
808
|
+
otherField.dateFormatString = getStringFormatDateDF(attrDFSettings);
|
|
809
|
+
}
|
|
810
|
+
if (key && showDisplayFormat) {
|
|
811
|
+
values[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE][key] = Object.assign(Object.assign(Object.assign({}, attrDFSettings), otherField), { type: selectedDFType });
|
|
812
|
+
}
|
|
813
|
+
// Handle Merge tag for event attributes
|
|
814
|
+
if (values.type === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value) {
|
|
815
|
+
if (values.index != null && !get(values, 'attribute.itemTypeName', null)) {
|
|
816
|
+
const itemTypeName = ((_a = listBO === null || listBO === void 0 ? void 0 : listBO.find(({ id }) => get(eventTrackingAttributes, 'mainObjects', []).some(({ itemTypeId }) => itemTypeId === id))) === null || _a === void 0 ? void 0 : _a.name) || null;
|
|
817
|
+
if (itemTypeName) {
|
|
818
|
+
set(values, 'attribute.itemTypeName', itemTypeName);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
// Set itemTypeName if Selecting content source
|
|
823
|
+
if (regexCSType.test(values.type) && !!itemTypeName) {
|
|
824
|
+
set(values, 'attribute.itemTypeName', itemTypeName);
|
|
825
|
+
}
|
|
826
|
+
if (!showIndex) {
|
|
827
|
+
values = omit(values, 'index');
|
|
828
|
+
}
|
|
829
|
+
const mappingFields = buildMappingFields(values);
|
|
830
|
+
onOk(Object.assign(Object.assign({}, values), (mappingFields && { mappingFields })));
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
};
|
|
835
|
+
const handleOnClickParentNode = (item) => {
|
|
836
|
+
if (item.children.length) {
|
|
837
|
+
if (expandedEventAttributes.includes(item.value)) {
|
|
838
|
+
// close expand
|
|
839
|
+
const newExpandedKeys = expandedEventAttributes.filter(key => key !== item.value);
|
|
840
|
+
handleTreeExpand(newExpandedKeys);
|
|
841
|
+
}
|
|
842
|
+
else {
|
|
843
|
+
// open expand
|
|
844
|
+
handleTreeExpand((prev) => [...prev, item.value]);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
const handleTreeExpand = (expandedKeys) => {
|
|
849
|
+
setExpandedEventAttributes(expandedKeys);
|
|
850
|
+
};
|
|
851
|
+
const handleSaveAsTemplate = () => {
|
|
852
|
+
setsaveAsTemplate(!saveAsTemplate);
|
|
853
|
+
};
|
|
854
|
+
const handleFormValuesChanges = (changedValues, _allValues) => {
|
|
855
|
+
var _a;
|
|
856
|
+
const [fieldName, fieldValue] = Object.entries(changedValues)[0];
|
|
857
|
+
switch (fieldName) {
|
|
858
|
+
case DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE:
|
|
859
|
+
resetStateAndFormValueDF();
|
|
860
|
+
switch (true) {
|
|
861
|
+
case fieldValue === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value:
|
|
862
|
+
form.setFieldsValue({
|
|
863
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listCustomerAttributes)[0],
|
|
864
|
+
});
|
|
865
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorDynamicContentAttr });
|
|
866
|
+
break;
|
|
867
|
+
case fieldValue === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value:
|
|
868
|
+
form.setFieldsValue({
|
|
869
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listVisitorAttributes)[0],
|
|
870
|
+
});
|
|
871
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorDynamicContentAttr });
|
|
872
|
+
break;
|
|
873
|
+
case fieldValue === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value:
|
|
874
|
+
if (!(listEvents === null || listEvents === void 0 ? void 0 : listEvents.length))
|
|
875
|
+
break;
|
|
876
|
+
form.setFieldsValue({
|
|
877
|
+
[DYNAMIC_CONTENT_SETTING_KEY.EVENT]: listEvents[0].value,
|
|
878
|
+
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: undefined,
|
|
879
|
+
});
|
|
880
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorEventAttr });
|
|
881
|
+
break;
|
|
882
|
+
case fieldValue === CUSTOM_TYPE.value:
|
|
883
|
+
if (!(listEvents === null || listEvents === void 0 ? void 0 : listEvents.length))
|
|
884
|
+
break;
|
|
885
|
+
let formatedDFValue = '';
|
|
886
|
+
let settings = attrDFSettings;
|
|
887
|
+
settings = settings !== null && settings !== void 0 ? settings : initNumberDFSettings;
|
|
888
|
+
formatedDFValue = formatNumberDF(1234.56789, selectedDFType, settings);
|
|
889
|
+
setFormatedAttr(formatedDFValue);
|
|
890
|
+
setAttrDFSettings(settings);
|
|
891
|
+
form.setFieldsValue({
|
|
892
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: optionDataType[0].value,
|
|
893
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: optionDataType[0].value,
|
|
894
|
+
});
|
|
895
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter(dfType => dfType.dataType === optionDataType[0].value));
|
|
896
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorEventAttr });
|
|
897
|
+
setShowDetailEditDF(true);
|
|
898
|
+
break;
|
|
899
|
+
case fieldValue === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value:
|
|
900
|
+
if (!listPromotionCodeAttributes || !listPromotionPools)
|
|
901
|
+
break;
|
|
902
|
+
form.setFieldsValue({
|
|
903
|
+
[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]: (_a = listPromotionPools[0]) === null || _a === void 0 ? void 0 : _a.value,
|
|
904
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: getAvailableAttrs(listPromotionCodeAttributes)[0],
|
|
905
|
+
});
|
|
906
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorListPromotionCodeAttr });
|
|
907
|
+
break;
|
|
908
|
+
case regexCSType.test(fieldValue): {
|
|
909
|
+
const { itemTypeId: selectedItemTypeId } = serializeCSSelectedString(String(fieldValue));
|
|
910
|
+
if (isNaN(selectedItemTypeId))
|
|
911
|
+
break;
|
|
912
|
+
setItemTypeId(Number(selectedItemTypeId));
|
|
913
|
+
const key = [QUERY_KEYS.GET_EVENT_ATTRIBUTE_BO, [selectedItemTypeId]];
|
|
914
|
+
const listAttBOByItemTypeId = serilizeBOAttr(queryClientAntsomiUI.getQueryData(key));
|
|
915
|
+
if (listAttBOByItemTypeId.length) {
|
|
916
|
+
form.setFieldsValue({
|
|
917
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: listAttBOByItemTypeId[0],
|
|
918
|
+
[DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex,
|
|
919
|
+
});
|
|
920
|
+
}
|
|
921
|
+
setHasError({ [DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: isErrorBoAttr });
|
|
922
|
+
break;
|
|
923
|
+
}
|
|
924
|
+
default: {
|
|
925
|
+
break;
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
break;
|
|
929
|
+
case DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE:
|
|
930
|
+
let listAttributes = [];
|
|
931
|
+
switch (true) {
|
|
932
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value:
|
|
933
|
+
if (!listEventAttributes)
|
|
934
|
+
break;
|
|
935
|
+
let newSelectEventAttr = listEventAttributes.find((row) => {
|
|
936
|
+
if (row === null || row === void 0 ? void 0 : row.children.length) {
|
|
937
|
+
return row.children.find((item) => item.value === fieldValue.value);
|
|
938
|
+
}
|
|
939
|
+
return row.value === fieldValue.value;
|
|
940
|
+
});
|
|
941
|
+
if (newSelectEventAttr === null || newSelectEventAttr === void 0 ? void 0 : newSelectEventAttr.children.length) {
|
|
942
|
+
newSelectEventAttr = newSelectEventAttr.children.find((item) => item.value === fieldValue.value);
|
|
943
|
+
}
|
|
944
|
+
listAttributes = flatMapDeep(listEventAttributes, getMembers);
|
|
945
|
+
form.setFieldsValue({ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex });
|
|
946
|
+
break;
|
|
947
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value:
|
|
948
|
+
listAttributes = listCustomerAttributes;
|
|
949
|
+
break;
|
|
950
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value:
|
|
951
|
+
listAttributes = listPromotionCodeAttributes !== null && listPromotionCodeAttributes !== void 0 ? listPromotionCodeAttributes : [];
|
|
952
|
+
break;
|
|
953
|
+
case selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value:
|
|
954
|
+
listAttributes = listVisitorAttributes;
|
|
955
|
+
break;
|
|
956
|
+
case selectedDynamicContentType && regexCSType.test(selectedDynamicContentType):
|
|
957
|
+
form.setFieldsValue({ [DYNAMIC_CONTENT_SETTING_KEY.INDEX]: defaultDynamicIndex });
|
|
958
|
+
if (!listBoAttributes)
|
|
959
|
+
break;
|
|
960
|
+
listAttributes = listBoAttributes;
|
|
961
|
+
break;
|
|
962
|
+
default: {
|
|
963
|
+
break;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
// add dataType to
|
|
967
|
+
if (listAttributes.length) {
|
|
968
|
+
const attr = listAttributes.find(attr => {
|
|
969
|
+
if (attr.value === fieldValue.value) {
|
|
970
|
+
return attr;
|
|
971
|
+
}
|
|
972
|
+
return null;
|
|
973
|
+
});
|
|
974
|
+
form.setFieldsValue({
|
|
975
|
+
[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]: attr,
|
|
976
|
+
});
|
|
977
|
+
// set new value for options display format
|
|
978
|
+
if (attr) {
|
|
979
|
+
const newAttrDFOptions = DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === attr.dataType);
|
|
980
|
+
if (newAttrDFOptions.length) {
|
|
981
|
+
form.setFieldsValue({
|
|
982
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: newAttrDFOptions[0].value,
|
|
983
|
+
});
|
|
984
|
+
setAttrDFOptions(newAttrDFOptions);
|
|
985
|
+
}
|
|
986
|
+
// reset detail display format settings
|
|
987
|
+
setAttrDFSettings(undefined);
|
|
988
|
+
setShowDetailEditDF(false);
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
break;
|
|
992
|
+
case DYNAMIC_CONTENT_SETTING_KEY.INDEX:
|
|
993
|
+
break;
|
|
994
|
+
case DYNAMIC_CONTENT_SETTING_KEY.FUNCTION:
|
|
995
|
+
form.setFieldsValue({
|
|
996
|
+
[DYNAMIC_CONTENT_SETTING_KEY.FUNCTION]: fieldValue,
|
|
997
|
+
});
|
|
998
|
+
break;
|
|
999
|
+
case DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE:
|
|
1000
|
+
form.setFieldsValue({
|
|
1001
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE]: fieldValue,
|
|
1002
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]: fieldValue === 'string' ? 'raw_string' : fieldValue,
|
|
1003
|
+
});
|
|
1004
|
+
let settings = attrDFSettings;
|
|
1005
|
+
// Datatime Attribute DF
|
|
1006
|
+
if (fieldValue === 'datetime') {
|
|
1007
|
+
settings = Object.assign(Object.assign({}, initDatetimeDFSettings), { language });
|
|
1008
|
+
}
|
|
1009
|
+
else if (fieldValue === 'string') {
|
|
1010
|
+
settings = undefined;
|
|
1011
|
+
}
|
|
1012
|
+
setAttrDFOptions(DYNAMIC_CONTENT_ATTR_DF_TYPE.filter((dfType) => dfType.dataType === fieldValue));
|
|
1013
|
+
setAttrDFSettings(settings);
|
|
1014
|
+
break;
|
|
1015
|
+
case DYNAMIC_CONTENT_SETTING_KEY.EVENT:
|
|
1016
|
+
form.setFieldsValue({
|
|
1017
|
+
[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]: undefined,
|
|
1018
|
+
});
|
|
1019
|
+
resetStateAndFormValueDF();
|
|
1020
|
+
break;
|
|
1021
|
+
case DYNAMIC_CONTENT_SETTING_KEY.SOURCE:
|
|
1022
|
+
resetStateAndFormValueDF();
|
|
1023
|
+
break;
|
|
1024
|
+
case DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE:
|
|
1025
|
+
switch (fieldValue) {
|
|
1026
|
+
case 'currency': {
|
|
1027
|
+
setAttrDFSettings(Object.assign(Object.assign({}, initNumberDFSettings), { decimalPlaces: 1 }));
|
|
1028
|
+
break;
|
|
1029
|
+
}
|
|
1030
|
+
case 'number':
|
|
1031
|
+
case 'percentage': {
|
|
1032
|
+
setAttrDFSettings(initNumberDFSettings);
|
|
1033
|
+
break;
|
|
1034
|
+
}
|
|
1035
|
+
case 'datetime': {
|
|
1036
|
+
setAttrDFSettings(Object.assign(Object.assign({}, initDatetimeDFSettings), { language }));
|
|
1037
|
+
break;
|
|
1038
|
+
}
|
|
1039
|
+
case 'raw_string': {
|
|
1040
|
+
setAttrDFSettings(undefined);
|
|
1041
|
+
break;
|
|
1042
|
+
}
|
|
1043
|
+
default: {
|
|
1044
|
+
break;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
break;
|
|
1048
|
+
default: {
|
|
1049
|
+
break;
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
};
|
|
1053
|
+
//* Render functions
|
|
1054
|
+
const renderBoAttrFields = () => {
|
|
1055
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1056
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.boAttr)));
|
|
1057
|
+
}
|
|
1058
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.attribute), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1059
|
+
React.createElement(Select, { loading: isFetchingListBoAttr, style: { height: '28px' }, labelInValue: true, options: buildOptionAttrArchive(listBoAttributes || [], selectedAttr),
|
|
1060
|
+
// errorArchive={errorMessageAttr}
|
|
1061
|
+
disabled: isActionArchive, showSearch: true })));
|
|
1062
|
+
};
|
|
1063
|
+
const renderIndexFields = ({ disabled = false, loading = false }) => {
|
|
1064
|
+
if (!showIndex)
|
|
1065
|
+
return null;
|
|
1066
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1067
|
+
return null;
|
|
1068
|
+
}
|
|
1069
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.index), name: DYNAMIC_CONTENT_SETTING_KEY.INDEX, required: true },
|
|
1070
|
+
React.createElement(Select, { disabled: disabled, loading: loading, style: { height: '28px' }, options: Array.from({ length: 90 }, (_, i) => ({ value: i + 1, label: i + 1 })), showSearch: true })));
|
|
1071
|
+
};
|
|
1072
|
+
const renderCustomFunctionFields = () => {
|
|
1073
|
+
const dataType = form.getFieldValue([DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE]);
|
|
1074
|
+
return (React.createElement(React.Fragment, null,
|
|
1075
|
+
React.createElement(Form.Item, { label: t(translations.dynamicContent.modal.label.personalizationName), name: DYNAMIC_CONTENT_SETTING_KEY.PERNAME, style: { alignItems: 'center' }, required: true },
|
|
1076
|
+
React.createElement(InputSuggestion, { onSelect: handleSelect, placeholder: "Custom function name...", options: searchValue.length > 0 ? listCustomTemplatesSearch : listCustomTemplates, onChange: onChangeDataInput, value: templateName }),
|
|
1077
|
+
hasError[DYNAMIC_CONTENT_SETTING_KEY.PERNAME] && (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.perName)))),
|
|
1078
|
+
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.function), name: DYNAMIC_CONTENT_SETTING_KEY.FUNCTION, required: true },
|
|
1079
|
+
React.createElement(EditorScript, { mode: "javascript", hideExpand: true })),
|
|
1080
|
+
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.ouputDataType), name: DYNAMIC_CONTENT_SETTING_KEY.DATA_TYPE, required: true },
|
|
1081
|
+
React.createElement(Select, { style: { height: 28 }, options: optionDataType })),
|
|
1082
|
+
React.createElement(Form.Item, { style: { alignItems: 'start' }, required: true, label: t(translations.dynamicContent.modal.label.ouputFormat), name: DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE, extra: React.createElement("div", { style: {
|
|
1083
|
+
display: 'flex',
|
|
1084
|
+
flexWrap: 'wrap',
|
|
1085
|
+
alignItems: 'center',
|
|
1086
|
+
gap: '8px',
|
|
1087
|
+
marginTop: '16px',
|
|
1088
|
+
} },
|
|
1089
|
+
dataType !== 'raw_string' ? (React.createElement(Text, { color: "#555", dangerouslySetInnerHTML: {
|
|
1090
|
+
__html: `${t(translations.dynamicContent.modal.label.displayFormat)}: <bdo dir='ltr'>${formatedAttr}</bdo>`,
|
|
1091
|
+
} })) : null,
|
|
1092
|
+
!showDetailEditDF && (React.createElement(Button, { disabled: isActionArchive &&
|
|
1093
|
+
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, type: "text", style: { display: 'inline-block' }, onClick: () => setShowDetailEditDF(prevShow => !prevShow) }, t(translations.edit.title)))) },
|
|
1094
|
+
React.createElement(Select, { disabled: isActionArchive &&
|
|
1095
|
+
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, style: { height: 28 }, options: attrDFOptions }))));
|
|
1096
|
+
};
|
|
1097
|
+
const renderCustomerAttrFields = () => {
|
|
1098
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1099
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.customerAttr)));
|
|
1100
|
+
}
|
|
1101
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, initialValue: listCustomerAttributes[0], label: t(translations.dynamicContent.modal.label.attribute), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1102
|
+
React.createElement(Select, { loading: isFetchingDynamicContentAttr, style: { height: 28 }, labelInValue: true,
|
|
1103
|
+
// errorArchive={errorMessageAttr}
|
|
1104
|
+
disabled: isActionArchive, options: buildOptionAttrArchive(listCustomerAttributes, selectedAttr), showSearch: true })));
|
|
1105
|
+
};
|
|
1106
|
+
const renderEventAttrFields = () => {
|
|
1107
|
+
var _a;
|
|
1108
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1109
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.eventAttr)));
|
|
1110
|
+
}
|
|
1111
|
+
return (React.createElement(React.Fragment, null,
|
|
1112
|
+
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.selectEventAttr), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1113
|
+
React.createElement(TreeSelect, { loading: isFetchingEventAttr || !(listEvents === null || listEvents === void 0 ? void 0 : listEvents.length), style: { height: 28 }, labelInValue: true, showSearch: true }, listEventAttributes &&
|
|
1114
|
+
listEventAttributes.map((attr) => {
|
|
1115
|
+
var _a, _b, _c;
|
|
1116
|
+
return (React.createElement(TreeNode, { key: attr.value, value: attr.value, selectable: !((_a = attr === null || attr === void 0 ? void 0 : attr.children) === null || _a === void 0 ? void 0 : _a.length), title: ((_b = attr.children) === null || _b === void 0 ? void 0 : _b.length) ? (React.createElement("div", { onClick: () => handleOnClickParentNode(attr) }, attr.label)) : (attr.label) }, (_c = buildOptionAttrArchive(attr === null || attr === void 0 ? void 0 : attr.children, selectedAttr)) === null || _c === void 0 ? void 0 : _c.map((item) => (React.createElement(TreeNode, { key: item.value, value: item.value, title: item.label })))));
|
|
1117
|
+
}))),
|
|
1118
|
+
form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE) &&
|
|
1119
|
+
((_a = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE)) === null || _a === void 0 ? void 0 : _a.status) !== 1 && (React.createElement(Text, { type: "warning" }, t(translations.dynamicContent.modal.message.selectDisableEventAttr)))));
|
|
1120
|
+
};
|
|
1121
|
+
const renderEventFields = () => {
|
|
1122
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.EVENT]) {
|
|
1123
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.eventBySource)));
|
|
1124
|
+
}
|
|
1125
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.selectEvent), name: DYNAMIC_CONTENT_SETTING_KEY.EVENT, required: true, preserve: false },
|
|
1126
|
+
React.createElement(Select, { disabled: !!(triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.eventActionId) && !!(triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.eventCategoryId), loading: isFetchingEventBySource, style: { height: 28 }, options: listEvents, showSearch: true })));
|
|
1127
|
+
};
|
|
1128
|
+
const renderSourceFields = () => {
|
|
1129
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.SOURCE]) {
|
|
1130
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.source)));
|
|
1131
|
+
}
|
|
1132
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.selectSource), name: DYNAMIC_CONTENT_SETTING_KEY.SOURCE, required: true },
|
|
1133
|
+
React.createElement(Select, { disabled: !isEmpty(triggerEvent === null || triggerEvent === void 0 ? void 0 : triggerEvent.insightPropertyIds), mode: "multiple", loading: isFetchingSourceBO, options: listSources, showSearch: true })));
|
|
1134
|
+
};
|
|
1135
|
+
const renderPromotionCodeAttr = () => {
|
|
1136
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1137
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.promotionCodeAttr)));
|
|
1138
|
+
}
|
|
1139
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.promotionCodeAttr), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1140
|
+
React.createElement(Select, { loading: isFetchingPromotionCodeAttr, style: { height: 28 }, labelInValue: true, options: buildOptionAttrArchive(listPromotionCodeAttributes || [], selectedAttr), showSearch: true,
|
|
1141
|
+
// errorArchive={errorMessageAttr}
|
|
1142
|
+
disabled: isActionArchive })));
|
|
1143
|
+
};
|
|
1144
|
+
const renderPromotionPoolFields = () => {
|
|
1145
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL]) {
|
|
1146
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.promotionPools)));
|
|
1147
|
+
}
|
|
1148
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.promotionPools), name: DYNAMIC_CONTENT_SETTING_KEY.PROMOTION_POOL, required: true },
|
|
1149
|
+
React.createElement(Select, { loading: isFetchingPromotionPool, style: { height: 28 }, options: listPromotionPools, showSearch: true })));
|
|
1150
|
+
};
|
|
1151
|
+
const renderVisitorAttrFields = () => {
|
|
1152
|
+
if (hasError[DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE]) {
|
|
1153
|
+
return (React.createElement(Text, { type: "error" }, t(translations.dynamicContent.modal.error.visitorAttr)));
|
|
1154
|
+
}
|
|
1155
|
+
return (React.createElement(Form.Item, { style: { alignItems: 'center' }, initialValue: listVisitorAttributes[0], label: t(translations.dynamicContent.modal.label.attribute), name: DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE, required: true },
|
|
1156
|
+
React.createElement(Select, { loading: isFetchingDynamicContentAttr, style: { height: 28 }, labelInValue: true, options: buildOptionAttrArchive(listVisitorAttributes, selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.value), showSearch: true,
|
|
1157
|
+
// errorArchive={errorMessageAttr}
|
|
1158
|
+
disabled: isActionArchive })));
|
|
1159
|
+
};
|
|
1160
|
+
const renderDisplayFormat = () => {
|
|
1161
|
+
const selectedAttr = form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.ATTRIBUTE);
|
|
1162
|
+
if (formSubmitDisabled ||
|
|
1163
|
+
!attrDFSettings ||
|
|
1164
|
+
isEmpty(attrDFSettings) ||
|
|
1165
|
+
!(selectedAttr === null || selectedAttr === void 0 ? void 0 : selectedAttr.dataType) ||
|
|
1166
|
+
!attrDFOptions.length)
|
|
1167
|
+
return null;
|
|
1168
|
+
if (selectedAttr.dataType === 'number' || selectedAttr.dataType === 'datetime')
|
|
1169
|
+
return (React.createElement(Form.Item, { initialValue: attrDFOptions[0].value, style: { alignItems: 'start' }, label: t(translations.dynamicContent.modal.label.displayFormat), name: DYNAMIC_CONTENT_SETTING_KEY.DISPLAY_FORMAT_TYPE, extra: React.createElement("div", { style: {
|
|
1170
|
+
display: 'flex',
|
|
1171
|
+
flexWrap: 'wrap',
|
|
1172
|
+
alignItems: 'center',
|
|
1173
|
+
gap: '8px',
|
|
1174
|
+
marginTop: '16px',
|
|
1175
|
+
} },
|
|
1176
|
+
React.createElement(Text, { color: "#555", dangerouslySetInnerHTML: {
|
|
1177
|
+
__html: `${t(translations.dynamicContent.modal.label.displayFormat)}: <bdo dir='ltr'>${formatedAttr}</bdo>`,
|
|
1178
|
+
} }),
|
|
1179
|
+
!showDetailEditDF && (React.createElement(Button, { disabled: isActionArchive &&
|
|
1180
|
+
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, type: "text", style: { display: 'inline-block' }, onClick: () => setShowDetailEditDF(prevShow => !prevShow) }, t(translations.edit.title)))) },
|
|
1181
|
+
React.createElement(Select, { disabled: isActionArchive &&
|
|
1182
|
+
selectedDynamicContentType !== DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value, style: { height: 28 }, options: attrDFOptions })));
|
|
1183
|
+
return null;
|
|
1184
|
+
};
|
|
1185
|
+
const renderDetailDFSettings = () => {
|
|
1186
|
+
if (showDetailEditDF && selectedDFType && attrDFSettings)
|
|
1187
|
+
return (React.createElement("div", { style: {
|
|
1188
|
+
border: '1px solid #9e9e9e',
|
|
1189
|
+
borderRadius: '2px',
|
|
1190
|
+
padding: '8px',
|
|
1191
|
+
marginTop: '8px',
|
|
1192
|
+
display: 'flex',
|
|
1193
|
+
flexDirection: 'column',
|
|
1194
|
+
gap: '8px',
|
|
1195
|
+
} },
|
|
1196
|
+
React.createElement(DisplayFormat, { infos: infos, url: url, displayFormatType: selectedDFType, formatSettings: attrDFSettings, onSettingsChange: (values) => setAttrDFSettings(values), dynamicContentType: form.getFieldValue(DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE) })));
|
|
1197
|
+
};
|
|
1198
|
+
return (React.createElement(ModalCustom, { closable: false, destroyOnClose: true, forceRender: true, mask: true, okButtonProps: { disabled: formSubmitDisabled }, title: modalTitle || t(translations.dynamicContent.modal.title.addDynamicContent), visible: visible, onCancel: handleOnCancelModal, onOk: handleOnOkModal },
|
|
1199
|
+
React.createElement(Spin, { spinning: isFetchingSourceBO ||
|
|
1200
|
+
isFetchingListBoAttr ||
|
|
1201
|
+
isFetchingEventAttr ||
|
|
1202
|
+
isFetchingPromotionPool ||
|
|
1203
|
+
isFetchingPromotionCodeAttr ||
|
|
1204
|
+
isFetchingDynamicContentAttr },
|
|
1205
|
+
React.createElement(Form, { style: { width: '100%' }, form: form, labelAlign: "left", labelCol: { span: 9 }, wrapperCol: { span: 15 }, onValuesChange: handleFormValuesChanges, initialValues: {
|
|
1206
|
+
[DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE]: listDynamicContentTypes[0].value,
|
|
1207
|
+
} },
|
|
1208
|
+
React.createElement(Form.Item, { style: { alignItems: 'center' }, label: t(translations.dynamicContent.modal.label.contentSource), name: DYNAMIC_CONTENT_SETTING_KEY.DYNAMIC_CONTENT_TYPE, required: true },
|
|
1209
|
+
React.createElement(Select, { style: { height: 28 }, options: listDynamicContentTypes })),
|
|
1210
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.VISITOR_ATTRIBUTE.value && (React.createElement(React.Fragment, null, renderVisitorAttrFields())),
|
|
1211
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.CUSTOMER_ATTRIBUTE.value && (React.createElement(React.Fragment, null, renderCustomerAttrFields())),
|
|
1212
|
+
selectedDynamicContentType === CUSTOM_TYPE.value && React.createElement(React.Fragment, null, renderCustomFunctionFields()),
|
|
1213
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.EVENT_ATTRIBUTE.value && (React.createElement(React.Fragment, null,
|
|
1214
|
+
renderEventFields(),
|
|
1215
|
+
renderSourceFields(),
|
|
1216
|
+
renderEventAttrFields(),
|
|
1217
|
+
isShowEventIndexField
|
|
1218
|
+
? renderIndexFields({ disabled: false, loading: false })
|
|
1219
|
+
: null)),
|
|
1220
|
+
selectedDynamicContentType === DYNAMIC_CONTENT_TYPE.PROMOTION_CODE.value && (React.createElement(React.Fragment, null,
|
|
1221
|
+
renderPromotionPoolFields(),
|
|
1222
|
+
renderPromotionCodeAttr())),
|
|
1223
|
+
selectedDynamicContentType && regexCSType.test(selectedDynamicContentType) && (React.createElement(React.Fragment, null,
|
|
1224
|
+
renderBoAttrFields(),
|
|
1225
|
+
renderIndexFields({ disabled: isActionArchive, loading: isFetchingListBoAttr }))),
|
|
1226
|
+
showDisplayFormat && renderDisplayFormat()),
|
|
1227
|
+
showDisplayFormat && renderDisplayFormat() !== null && renderDetailDFSettings(),
|
|
1228
|
+
isShowCustomFunction && selectedDynamicContentType === CUSTOM_TYPE.value && (React.createElement("div", { style: {
|
|
1229
|
+
display: 'flex',
|
|
1230
|
+
alignItems: 'center',
|
|
1231
|
+
justifyContent: 'start',
|
|
1232
|
+
marginBottom: '8px',
|
|
1233
|
+
marginTop: '10px',
|
|
1234
|
+
} },
|
|
1235
|
+
React.createElement(Checkbox, { onChange: handleSaveAsTemplate, checked: saveAsTemplate },
|
|
1236
|
+
React.createElement("span", { style: { fontSize: '12px' } }, t(translations.dynamicContent.modal.label.saveTemplate))))))));
|
|
1237
|
+
};
|
|
1238
|
+
AddDynamicContent.defaultProps = {
|
|
1239
|
+
showDisplayFormat: true,
|
|
1240
|
+
showIndex: true,
|
|
1241
|
+
APIConfig: {
|
|
1242
|
+
domain: 'https://sandbox-media-template.antsomi.com',
|
|
1243
|
+
slug: '/api/v1',
|
|
1244
|
+
token: '',
|
|
1245
|
+
userId: '',
|
|
1246
|
+
accountId: '',
|
|
1247
|
+
},
|
|
1248
|
+
};
|