@antscorp/antsomi-ui 1.3.3-beta.69 → 1.3.3-beta.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (134) hide show
  1. package/es/components/atoms/InputDynamic/InputDynamic.d.ts +5 -25
  2. package/es/components/atoms/InputDynamic/InputDynamic.js +200 -16
  3. package/es/components/atoms/InputDynamic/PopupShortLink.d.ts +1 -1
  4. package/es/components/atoms/InputDynamic/constants.d.ts +71 -0
  5. package/es/components/atoms/InputDynamic/constants.js +71 -0
  6. package/es/components/atoms/InputDynamic/index.d.ts +1 -1
  7. package/es/components/atoms/InputDynamic/styled.d.ts +1 -0
  8. package/es/components/atoms/InputDynamic/styled.js +14 -2
  9. package/es/components/atoms/InputDynamic/types.d.ts +110 -0
  10. package/es/components/atoms/InputDynamic/types.js +1 -0
  11. package/es/components/atoms/InputDynamic/utils.d.ts +8 -0
  12. package/es/components/atoms/InputDynamic/utils.js +123 -2
  13. package/es/components/atoms/Spin/styled.d.ts +1 -1
  14. package/es/components/common/ConfigProvider/GlobalStyle.js +10 -0
  15. package/es/components/molecules/AddDynamicContent/AddDynamicContent.d.ts +35 -0
  16. package/es/components/molecules/AddDynamicContent/AddDynamicContent.js +1245 -0
  17. package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.d.ts +12 -0
  18. package/es/components/molecules/AddDynamicContent/components/DisplayFormat/DisplayFormat.js +25 -0
  19. package/es/components/molecules/AddDynamicContent/components/DisplayFormat/index.d.ts +3 -0
  20. package/es/components/molecules/AddDynamicContent/components/DisplayFormat/index.js +3 -0
  21. package/es/components/molecules/AddDynamicContent/components/FormatDatetime/FormatDatetime.d.ts +19 -0
  22. package/es/components/molecules/AddDynamicContent/components/FormatDatetime/FormatDatetime.js +101 -0
  23. package/es/components/molecules/AddDynamicContent/components/FormatDatetime/index.d.ts +1 -0
  24. package/es/components/molecules/AddDynamicContent/components/FormatDatetime/index.js +1 -0
  25. package/es/components/molecules/AddDynamicContent/components/FormatNumber/FormatNumber.d.ts +52 -0
  26. package/es/components/molecules/AddDynamicContent/components/FormatNumber/FormatNumber.js +132 -0
  27. package/es/components/molecules/AddDynamicContent/components/FormatNumber/index.d.ts +1 -0
  28. package/es/components/molecules/AddDynamicContent/components/FormatNumber/index.js +1 -0
  29. package/es/components/molecules/AddDynamicContent/components/index.d.ts +3 -0
  30. package/es/components/molecules/AddDynamicContent/components/index.js +3 -0
  31. package/es/components/molecules/AddDynamicContent/constants.d.ts +101 -0
  32. package/es/components/molecules/AddDynamicContent/constants.js +152 -0
  33. package/es/components/molecules/AddDynamicContent/currencies.json +1523 -0
  34. package/es/components/molecules/AddDynamicContent/index.d.ts +2 -0
  35. package/es/components/molecules/AddDynamicContent/index.js +2 -0
  36. package/es/components/molecules/AddDynamicContent/styled.d.ts +9 -0
  37. package/es/components/molecules/AddDynamicContent/styled.js +18 -0
  38. package/es/components/molecules/AddDynamicContent/types.d.ts +13 -0
  39. package/es/components/molecules/AddDynamicContent/types.js +1 -0
  40. package/es/components/molecules/AddDynamicContent/utils.d.ts +42 -0
  41. package/es/components/molecules/AddDynamicContent/utils.js +398 -0
  42. package/es/components/molecules/Modal/Modal.d.ts +2 -2
  43. package/es/components/molecules/Modal/styled.d.ts +1 -1
  44. package/es/components/molecules/Modal/styled.js +2 -0
  45. package/es/components/molecules/ModalV2/styled.d.ts +1 -1
  46. package/es/components/molecules/Select/Select.d.ts +2 -4
  47. package/es/components/molecules/ShareAccess/components/ModalTransferOwnerShip/styled.d.ts +1 -1
  48. package/es/components/molecules/TreeSelect/TreeSelect.d.ts +3 -5
  49. package/es/components/molecules/UploadImage/MediaThumb.d.ts +11 -0
  50. package/es/components/molecules/UploadImage/MediaThumb.js +31 -0
  51. package/es/components/molecules/UploadImage/index.d.ts +6 -2
  52. package/es/components/molecules/UploadImage/index.js +101 -77
  53. package/es/components/molecules/UploadImage/styled.js +0 -4
  54. package/es/components/molecules/UploadImage/utils.d.ts +3 -0
  55. package/es/components/molecules/UploadImage/utils.js +24 -0
  56. package/es/components/organism/Help/styled.d.ts +2 -6
  57. package/es/constants/queries.d.ts +14 -0
  58. package/es/constants/queries.js +21 -0
  59. package/es/hooks/index.d.ts +1 -0
  60. package/es/hooks/index.js +1 -0
  61. package/es/hooks/useDeepCompareMemo.d.ts +2 -0
  62. package/es/hooks/useDeepCompareMemo.js +21 -0
  63. package/es/locales/en/translation.json +151 -0
  64. package/es/locales/i18n.d.ts +151 -0
  65. package/es/locales/translations.d.ts +151 -0
  66. package/es/models/BusinessObject.d.ts +116 -0
  67. package/es/models/BusinessObject.js +113 -0
  68. package/es/models/Currency.d.ts +9 -0
  69. package/es/models/Currency.js +10 -0
  70. package/es/models/CustomFunction.d.ts +19 -0
  71. package/es/models/CustomFunction.js +25 -0
  72. package/es/models/DynamicContentAttribute.d.ts +34 -0
  73. package/es/models/DynamicContentAttribute.js +9 -0
  74. package/es/models/EventTrackingAttribute.d.ts +11 -0
  75. package/es/models/EventTrackingAttribute.js +13 -0
  76. package/es/models/PromotionPool.d.ts +11 -0
  77. package/es/models/PromotionPool.js +12 -0
  78. package/es/models/{SavedImage.d.ts → SavedMedia.d.ts} +5 -5
  79. package/es/models/{SavedImage.js → SavedMedia.js} +3 -3
  80. package/es/queries/BusinessObject/index.d.ts +6 -0
  81. package/es/queries/BusinessObject/index.js +6 -0
  82. package/es/queries/BusinessObject/useGetListAllEvents.d.ts +11 -0
  83. package/es/queries/BusinessObject/useGetListAllEvents.js +14 -0
  84. package/es/queries/BusinessObject/useGetListAttributeBO.d.ts +17 -0
  85. package/es/queries/BusinessObject/useGetListAttributeBO.js +41 -0
  86. package/es/queries/BusinessObject/useGetListBO.d.ts +6 -0
  87. package/es/queries/BusinessObject/useGetListBO.js +19 -0
  88. package/es/queries/BusinessObject/useGetListEventAttr.d.ts +4 -0
  89. package/es/queries/BusinessObject/useGetListEventAttr.js +15 -0
  90. package/es/queries/BusinessObject/useGetListPromotionCodeAttr.d.ts +6 -0
  91. package/es/queries/BusinessObject/useGetListPromotionCodeAttr.js +26 -0
  92. package/es/queries/BusinessObject/useGetListSourceByEvent.d.ts +13 -0
  93. package/es/queries/BusinessObject/useGetListSourceByEvent.js +11 -0
  94. package/es/queries/CustomFunction/index.d.ts +2 -0
  95. package/es/queries/CustomFunction/index.js +2 -0
  96. package/es/queries/CustomFunction/useCustomFunction.d.ts +19 -0
  97. package/es/queries/CustomFunction/useCustomFunction.js +53 -0
  98. package/es/queries/DynamicContentAttribute/index.d.ts +1 -0
  99. package/es/queries/DynamicContentAttribute/index.js +1 -0
  100. package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.d.ts +10 -0
  101. package/es/queries/DynamicContentAttribute/useGetDynamicContentAttr.js +21 -0
  102. package/es/queries/PromotionPool/index.d.ts +1 -0
  103. package/es/queries/PromotionPool/index.js +1 -0
  104. package/es/queries/PromotionPool/useGetListPromotionPool.d.ts +9 -0
  105. package/es/queries/PromotionPool/useGetListPromotionPool.js +62 -0
  106. package/es/queries/ThirdParty/index.d.ts +1 -0
  107. package/es/queries/ThirdParty/index.js +1 -0
  108. package/es/queries/ThirdParty/useGetEventTrackingAttributes.d.ts +14 -0
  109. package/es/queries/ThirdParty/useGetEventTrackingAttributes.js +15 -0
  110. package/es/queries/configs.d.ts +4 -0
  111. package/es/queries/configs.js +13 -0
  112. package/es/queries/index.d.ts +6 -0
  113. package/es/queries/index.js +6 -0
  114. package/es/services/MediaTemplateDesign/BusinessObject/index.d.ts +8 -0
  115. package/es/services/MediaTemplateDesign/BusinessObject/index.js +100 -0
  116. package/es/services/MediaTemplateDesign/CustomFunction/index.d.ts +15 -0
  117. package/es/services/MediaTemplateDesign/CustomFunction/index.js +135 -0
  118. package/es/services/MediaTemplateDesign/DynamicContentAttribute/index.d.ts +4 -0
  119. package/es/services/MediaTemplateDesign/DynamicContentAttribute/index.js +39 -0
  120. package/es/services/MediaTemplateDesign/ListCurrency/index.d.ts +6 -0
  121. package/es/services/MediaTemplateDesign/ListCurrency/index.js +34 -0
  122. package/es/services/MediaTemplateDesign/PromotionPool/index.d.ts +3 -0
  123. package/es/services/MediaTemplateDesign/PromotionPool/index.js +31 -0
  124. package/es/services/MediaTemplateDesign/UploadFile/index.d.ts +5 -5
  125. package/es/services/MediaTemplateDesign/UploadFile/index.js +36 -19
  126. package/es/services/ThirParty/index.d.ts +8 -0
  127. package/es/services/ThirParty/index.js +26 -0
  128. package/es/services/index.d.ts +14 -5
  129. package/es/services/index.js +45 -1
  130. package/es/test.js +50 -10
  131. package/es/types/index.d.ts +5 -0
  132. package/es/utils/common.d.ts +1 -0
  133. package/es/utils/common.js +1 -0
  134. package/package.json +9 -2
@@ -1,3 +1,5 @@
1
+ import type { AllowDynamicOptions } from './types';
2
+ import type { DynamicContentType } from '../../molecules/AddDynamicContent';
1
3
  export declare function validateURL(string: string): boolean;
2
4
  export declare const getInsertPatternWithAppendSpaceEnd: (id: any, code: any, label: any, bgColor: any) => string;
3
5
  export declare const genShortLinkValue: (url: string, type?: string) => {
@@ -20,3 +22,9 @@ export declare const validateHTMLTags: {
20
22
  };
21
23
  export declare const spacingNonTracking: (data: any) => boolean;
22
24
  export declare const initialValue: (initValue: string) => string | undefined;
25
+ export declare const mapLabelPersonalization: (type: AllowDynamicOptions) => string;
26
+ export declare const createElement: (element: any, attribute: any, inner: any) => any;
27
+ export declare const DATA_ATTR_WITH_TYPE: string[];
28
+ export declare const mapDataFormatAttribute: (dataIn: any) => any;
29
+ export declare const regexAttrFormat: RegExp;
30
+ export declare const getBgColorByContentSourceType: (type: DynamicContentType) => string;
@@ -12,14 +12,19 @@ import { get } from 'lodash';
12
12
  import { decode } from 'html-entities';
13
13
  // Utils
14
14
  import { getObjectPropSafely, random } from '@antscorp/antsomi-ui/es/utils';
15
+ import { getStringFormatDateDF } from '../../molecules/AddDynamicContent/utils';
16
+ // Constants
17
+ import { AllowDynamicType } from './InputDynamic';
18
+ import { DATE_AND_TIME_DEFAULT, MAP_DATA_TYPE } from './constants';
19
+ import { DYNAMIC_CONTENT_TYPE_KEY } from '../../molecules/AddDynamicContent/constants';
15
20
  export function validateURL(string) {
16
21
  // eslint-disable-next-line no-useless-escape
17
22
  const regexp = /^((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@\.\w_]*)#?(?:[\.\!\/\\\w]*))?)/;
18
23
  return regexp.test(string);
19
24
  }
20
- export const getInsertPatternWithAppendSpaceEnd = (id, code, label, bgColor) => `<button id="${id}" contenteditable="false" class="insert-word" style="max-width: 250px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; padding: 5px 8px; color: white; font-size: inherit; outline: none; border: 1px solid transparent; border-radius: 1.2rem; margin-top: 2px; cursor: pointer; background: ${bgColor}; height: auto" value=${code
25
+ export const getInsertPatternWithAppendSpaceEnd = (id, code, label, bgColor) => `<button id="${id}" contenteditable="false" class="insert-word" style="position: relative; max-width: 250px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 3px 2px 3px 8px; color: rgb(0, 0, 0); font-size: inherit; outline: none; border: 1px solid transparent; border-radius: 1.2rem; cursor: pointer; background: ${bgColor}; height: auto;" value=${code
21
26
  .replace(/\s/gm, '&nbsp;')
22
- .replace(/"/gm, '&quot;')}><span style="line-height: 20px;margin-right: 8px;pointer-events:none;">${label}</span><em class="editor-icon-remove" style="color: white;font-style: normal; marign-left: 4px; position: relative; z-index: 1;font-size: 1rem;font-weight: bold">x</em></button>&nbsp;`;
27
+ .replace(/"/gm, '&quot;')}><span style="line-height: 20px;margin-right: 8px;pointer-events:none;">${label}</span><em class="editor-icon-remove" style="position: absolute; top: 50%; left: 100%; transform: translate(-50%, -50%); color: rgb(48, 95, 184); background-color: rgb(255, 255, 255); font-style: normal; margin-top: 1px; z-index: 1; font-size: 13px; font-weight: bold; margin-left: -12px; line-height: 18px; padding: 0px 3px; border-radius: 50%;">✕</em></button>&nbsp;`;
23
28
  export const genShortLinkValue = (url, type) => {
24
29
  const id = random(5);
25
30
  let keyTag = 'shortlink';
@@ -749,3 +754,119 @@ export const initialValue = (initValue) => {
749
754
  console.log(err);
750
755
  }
751
756
  };
757
+ export const mapLabelPersonalization = (type) => ({
758
+ [AllowDynamicType.SHORTLINK]: 'Add short link',
759
+ [AllowDynamicType.ADDPERSONALIZATION]: 'Add Personalization',
760
+ }[type]);
761
+ export const createElement = (element, attribute, inner) => {
762
+ try {
763
+ if (typeof element === 'undefined') {
764
+ return false;
765
+ }
766
+ if (typeof inner === 'undefined') {
767
+ inner = '';
768
+ }
769
+ const el = document.createElement(element);
770
+ if (typeof attribute === 'object') {
771
+ for (const key in attribute) {
772
+ el.setAttribute(key, attribute[key]);
773
+ }
774
+ }
775
+ if (!Array.isArray(inner)) {
776
+ inner = [inner];
777
+ }
778
+ for (let k = 0; k < inner.length; k++) {
779
+ if (inner[k].tagName) {
780
+ el.appendChild(inner[k]);
781
+ }
782
+ else {
783
+ el.appendChild(document.createTextNode(inner[k]));
784
+ }
785
+ }
786
+ return el;
787
+ }
788
+ catch (error) {
789
+ console.log('error', error);
790
+ }
791
+ };
792
+ export const DATA_ATTR_WITH_TYPE = [MAP_DATA_TYPE.number.value, MAP_DATA_TYPE.datetime.value];
793
+ export const mapDataFormatAttribute = (dataIn) => {
794
+ const dataOut = {
795
+ attribute: {
796
+ settingsFe: dataIn,
797
+ },
798
+ };
799
+ if (dataIn.dataType === 'datetime') {
800
+ const format = dataIn.format && Object.keys(dataIn.format.config).length > 0
801
+ ? dataIn.format
802
+ : DATE_AND_TIME_DEFAULT;
803
+ const hasDateFormat = format.config.date && format.config.date.check;
804
+ const hasTimeFormat = format.config.time && format.config.time.check;
805
+ const dateParseFormat = format.config.format;
806
+ const dateParseOption = format.config.date && format.config.date.value;
807
+ const timeParseOption = format.config.time && format.config.time.value;
808
+ const timeParseFormat = format.config.time && format.config.time.timeFormat;
809
+ dataOut.attribute = Object.assign(Object.assign({}, dataOut.attribute), { dataType: dataIn.dataType, datetimeFormatSettings: {
810
+ hasDateFormat,
811
+ hasTimeFormat,
812
+ dateParseFormat,
813
+ dateParseOption,
814
+ timeParseOption,
815
+ timeParseFormat,
816
+ dateFormatString: getStringFormatDateDF({
817
+ hasDateFormat,
818
+ hasTimeFormat,
819
+ dateParseFormat,
820
+ dateParseOption,
821
+ timeParseOption,
822
+ timeParseFormat,
823
+ }),
824
+ type: dataIn.format.type.toLowerCase(),
825
+ } });
826
+ }
827
+ else if (dataIn.dataType === 'number') {
828
+ dataOut.attribute = Object.assign(Object.assign({}, dataOut.attribute), { dataType: dataIn.dataType, numberFormatSettings: {
829
+ currencyCode: dataIn.format.config.currency,
830
+ decimalPlaces: dataIn.format.config.decimalPlace || 0,
831
+ grouping: dataIn.format.config.group === 'space' ? ' ' : dataIn.format.config.group || ',',
832
+ decimal: dataIn.format.config.decimal || '.',
833
+ isCompact: dataIn.format.config.isCompactNumber || false,
834
+ prefixType: dataIn.format.config.prefixType,
835
+ type: dataIn.format.type.toLowerCase(),
836
+ } });
837
+ }
838
+ return dataOut;
839
+ };
840
+ export const regexAttrFormat = /#|{|}|".+?"|\||"/g;
841
+ export const getBgColorByContentSourceType = (type) => {
842
+ let bgColor = '#E8FECA';
843
+ switch (type) {
844
+ case DYNAMIC_CONTENT_TYPE_KEY.BO_SETTINGS: {
845
+ break;
846
+ }
847
+ case DYNAMIC_CONTENT_TYPE_KEY.VISITOR_ATTRIBUTE: {
848
+ bgColor = '#CAFEDD';
849
+ break;
850
+ }
851
+ case DYNAMIC_CONTENT_TYPE_KEY.CUSTOMER_ATTRIBUTE: {
852
+ bgColor = '#CAE5FE';
853
+ break;
854
+ }
855
+ case DYNAMIC_CONTENT_TYPE_KEY.EVENT_ATTRIBUTE: {
856
+ bgColor = '#FECACA';
857
+ break;
858
+ }
859
+ case DYNAMIC_CONTENT_TYPE_KEY.PROMOTION_CODE: {
860
+ bgColor = '#D8CAFE';
861
+ break;
862
+ }
863
+ case DYNAMIC_CONTENT_TYPE_KEY.CUSTOM_FUNCTION: {
864
+ bgColor = '#BBEFBE';
865
+ break;
866
+ }
867
+ default: {
868
+ break;
869
+ }
870
+ }
871
+ return bgColor;
872
+ };
@@ -1 +1 @@
1
- export declare const StyledSpin: import("styled-components").StyledComponent<import("antd/es/spin").SpinFCType, any, {}, never>;
1
+ export declare const StyledSpin: import("styled-components").StyledComponent<import("antd/es/spin").SpinType, any, {}, never>;
@@ -204,6 +204,7 @@ export const GlobalStyle = () => {
204
204
 
205
205
  .antsomi-select-dropdown {
206
206
  padding: 0 !important;
207
+ z-index: 3002 !important;
207
208
  }
208
209
 
209
210
  .antsomi-select-selection-overflow {
@@ -730,5 +731,14 @@ export const GlobalStyle = () => {
730
731
  }
731
732
  }
732
733
  }
734
+
735
+ /* Popover */
736
+ .antsomi-popover {
737
+ &.no-padding-content {
738
+ .antsomi-popover-inner {
739
+ padding: 0 !important;
740
+ }
741
+ }
742
+ }
733
743
  ` }));
734
744
  };
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { APIConfig, TDataType } from './types';
3
+ export interface LabeledValue {
4
+ label: string;
5
+ value: string;
6
+ dataType?: TDataType;
7
+ disabled?: boolean;
8
+ status?: any;
9
+ }
10
+ export interface LabeledTreeValue extends LabeledValue {
11
+ [key: string]: any;
12
+ children: LabeledTreeValue[];
13
+ disableCheckbox?: boolean;
14
+ selectable?: boolean;
15
+ checkable?: boolean;
16
+ type: number | null;
17
+ status?: any;
18
+ }
19
+ interface AddDynamicContentProps {
20
+ defaultDynamicIndex?: number;
21
+ journeySettings: Record<string, any>;
22
+ contentSources: Record<string, any>;
23
+ additionalAttrProperties?: string[];
24
+ defaultData?: Record<string, any>;
25
+ visible: boolean;
26
+ showDisplayFormat?: boolean;
27
+ showIndex?: boolean;
28
+ onCancel?: () => void;
29
+ onOk?: (value: Record<string, any>) => void;
30
+ modalTitle?: string;
31
+ isShowCustomFunction?: boolean;
32
+ APIConfig: APIConfig;
33
+ }
34
+ export declare const AddDynamicContent: React.FC<AddDynamicContentProps>;
35
+ export {};