@pushwoosh/smart-components-kit 1.0.89 → 1.1.0
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/CampaignsConfigurationDrawer/CampaignsConfigurationDrawer.d.ts +1 -2
- package/CampaignsConfigurationDrawer/CampaignsConfigurationDrawer.js +105 -56
- package/CampaignsConfigurationDrawer/components/Card/Card.d.ts +1 -2
- package/CampaignsConfigurationDrawer/components/Card/Card.js +19 -13
- package/CampaignsConfigurationDrawer/polyglot/index.d.ts +2 -0
- package/CampaignsConfigurationDrawer/polyglot/index.js +10 -0
- package/CampaignsConfigurationDrawer/polyglot/messages_en.d.ts +3 -0
- package/CampaignsConfigurationDrawer/polyglot/messages_en.js +18 -0
- package/CampaignsConfigurationDrawer/polyglot/messages_ru.d.ts +3 -0
- package/CampaignsConfigurationDrawer/polyglot/messages_ru.js +18 -0
- package/CampaignsConfigurationDrawer/polyglot/types.d.ts +19 -0
- package/CampaignsConfigurationDrawer/polyglot/types.js +1 -0
- package/DocsButton/DocsButton.d.ts +1 -2
- package/DocsButton/DocsButton.js +21 -18
- package/DynamicContentPicker/DynamicContentPicker.js +76 -63
- package/DynamicContentPicker/Line.js +24 -22
- package/DynamicContentPickerForm/DynamicContentCustomPickerForm.js +20 -15
- package/DynamicContentPickerForm/DynamicContentEventPickerForm.js +62 -51
- package/DynamicContentPickerForm/DynamicContentTagPickerForm.js +62 -51
- package/DynamicContentPickerForm/SimpleDynamicContentPickerFormSmart.js +74 -59
- package/DynamicContentPickerForm/VariedDynamicContentPickerFormSmart.js +104 -78
- package/DynamicContentPickerForm/polyglot/index.d.ts +2 -0
- package/DynamicContentPickerForm/polyglot/index.js +10 -0
- package/DynamicContentPickerForm/polyglot/messages_en.d.ts +3 -0
- package/DynamicContentPickerForm/polyglot/messages_en.js +16 -0
- package/DynamicContentPickerForm/polyglot/messages_ru.d.ts +3 -0
- package/DynamicContentPickerForm/polyglot/messages_ru.js +16 -0
- package/DynamicContentPickerForm/polyglot/types.d.ts +17 -0
- package/DynamicContentPickerForm/polyglot/types.js +1 -0
- package/EmailTemplatePreview/EmailTemplatePreview.js +10 -4
- package/EmailTemplatePreview/polyglot/index.d.ts +5 -0
- package/EmailTemplatePreview/polyglot/index.js +10 -0
- package/EmailTemplatePreview/polyglot/messages_en.d.ts +3 -0
- package/EmailTemplatePreview/polyglot/messages_en.js +3 -0
- package/EmailTemplatePreview/polyglot/messages_ru.d.ts +3 -0
- package/EmailTemplatePreview/polyglot/messages_ru.js +3 -0
- package/EmailTemplatePreview/polyglot/types.d.ts +4 -0
- package/EmailTemplatePreview/polyglot/types.js +1 -0
- package/ExportCSV/ExportCsvBanner/ExportCsvBanner.d.ts +1 -2
- package/ExportCSV/ExportCsvBanner/ExportCsvBanner.js +63 -42
- package/ExportCSV/polyglot/index.d.ts +2 -0
- package/ExportCSV/polyglot/index.js +10 -0
- package/ExportCSV/polyglot/messages_en.d.ts +3 -0
- package/ExportCSV/polyglot/messages_en.js +9 -0
- package/ExportCSV/polyglot/messages_ru.d.ts +3 -0
- package/ExportCSV/polyglot/messages_ru.js +9 -0
- package/ExportCSV/polyglot/types.d.ts +10 -0
- package/ExportCSV/polyglot/types.js +1 -0
- package/ExportCSV/useExportService/useExportService.js +1 -0
- package/LanguagesSelector/LanguagesModal.js +38 -24
- package/LanguagesSelector/LanguagesSelectForm.js +73 -62
- package/LanguagesSelector/LanguagesSelectFormLoader.js +8 -7
- package/LanguagesSelector/LanguagesSelector.js +92 -78
- package/MediaStore/CreateVariantDrawer.js +134 -85
- package/MediaStore/MediaStore.js +137 -112
- package/ModalCloningJourney/ModalCloningJourney.d.ts +1 -2
- package/ModalCloningJourney/ModalCloningJourney.js +113 -91
- package/OpenActions/components/OpenActionsSummary/OpenActionsSummary.d.ts +1 -2
- package/OpenActions/components/OpenActionsSummary/OpenActionsSummary.js +101 -37
- package/OpenActions/components/OpenActionsSummaryByPreset.d.ts +1 -2
- package/OpenActions/components/OpenActionsSummaryByPreset.js +2 -2
- package/OpenActions/polyglot/index.d.ts +2 -0
- package/OpenActions/polyglot/index.js +10 -0
- package/OpenActions/polyglot/messages_en.d.ts +3 -0
- package/OpenActions/polyglot/messages_en.js +14 -0
- package/OpenActions/polyglot/messages_ru.d.ts +3 -0
- package/OpenActions/polyglot/messages_ru.js +14 -0
- package/OpenActions/polyglot/types.d.ts +18 -0
- package/OpenActions/polyglot/types.js +1 -0
- package/PlatformsConfigurationDrawer/PlatformsConfigurationDrawer.js +21 -17
- package/PlatformsConfigurationDrawer/components/DesktopPage/DesktopPage.js +114 -57
- package/PlatformsConfigurationDrawer/components/MainPage/MainPage.js +157 -75
- package/PlatformsConfigurationDrawer/components/MobilePage/MobilePage.js +140 -69
- package/PlatformsConfigurationDrawer/polyglot/index.d.ts +2 -0
- package/PlatformsConfigurationDrawer/polyglot/index.js +10 -0
- package/PlatformsConfigurationDrawer/polyglot/messages_en.d.ts +3 -0
- package/PlatformsConfigurationDrawer/polyglot/messages_en.js +24 -0
- package/PlatformsConfigurationDrawer/polyglot/messages_ru.d.ts +3 -0
- package/PlatformsConfigurationDrawer/polyglot/messages_ru.js +24 -0
- package/PlatformsConfigurationDrawer/polyglot/types.d.ts +25 -0
- package/PlatformsConfigurationDrawer/polyglot/types.js +1 -0
- package/ResendModal/ResendModal.d.ts +1 -2
- package/ResendModal/ResendModal.js +95 -59
- package/ResendModal/polyglot/index.d.ts +2 -0
- package/ResendModal/polyglot/index.js +10 -0
- package/ResendModal/polyglot/messages_en.d.ts +3 -0
- package/ResendModal/polyglot/messages_en.js +9 -0
- package/ResendModal/polyglot/messages_ru.d.ts +3 -0
- package/ResendModal/polyglot/messages_ru.js +9 -0
- package/ResendModal/polyglot/types.d.ts +10 -0
- package/ResendModal/polyglot/types.js +1 -0
- package/RichMessageEditorSmart/NewDynamicContentForm.js +16 -12
- package/RichMessageEditorSmart/RichMessageEditorSmart.js +4 -4
- package/SystemParcel/SystemParcel.d.ts +3 -3
- package/SystemParcel/SystemParcel.js +3 -2
- package/Table/components/DataTable/DataTable.js +80 -61
- package/Table/components/DataTableGetContext/DataTableGetContext.d.ts +1 -2
- package/Table/components/DataTableGetContext/DataTableGetContext.js +5 -2
- package/Table/components/DataTableList/DataTableList.d.ts +1 -2
- package/Table/components/DataTableList/DataTableList.js +86 -68
- package/Table/components/DataTablePagination/DataTablePagination.js +6 -4
- package/Table/components/DataTableSearchInput/DataTableSearchInput.js +3 -2
- package/Table/components/DataTableSortableCell/DataTableSortableCell.js +6 -4
- package/Table/components/Loading/Loading.d.ts +1 -2
- package/Table/components/Loading/Loading.js +16 -14
- package/Table/components/TablePagination/TablePagination.js +31 -25
- package/_devel/index.js +36 -24
- package/_devel/lib/dynamic-content-picker.d.ts +1 -2
- package/_devel/lib/dynamic-content-picker.js +16 -10
- package/_devel/lib/index.d.ts +2 -2
- package/_devel/lib/index.js +38 -19
- package/_devel/test-place.d.ts +1 -2
- package/_devel/test-place.js +4 -2
- package/package.json +2 -2
|
@@ -1,63 +1,74 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FieldBox, NativeInput, Select } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { useLang } from './polyglot';
|
|
4
5
|
export const DynamicContentEventPickerForm = ({
|
|
5
6
|
dc,
|
|
6
7
|
events,
|
|
7
8
|
onChange
|
|
8
9
|
}) => {
|
|
10
|
+
const lang = useLang();
|
|
9
11
|
const currentEvent = events.find(tag => tag.name === dc.eventName) || {
|
|
10
12
|
name: '',
|
|
11
13
|
attributes: []
|
|
12
14
|
};
|
|
13
|
-
return
|
|
14
|
-
"$gap": 16
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
return _jsxs(Vertical, {
|
|
16
|
+
"$gap": 16,
|
|
17
|
+
children: [_jsx(Select, {
|
|
18
|
+
value: {
|
|
19
|
+
value: dc.eventName,
|
|
20
|
+
label: dc.eventName
|
|
21
|
+
},
|
|
22
|
+
onChange: option => {
|
|
23
|
+
onChange({
|
|
24
|
+
eventName: option.value,
|
|
25
|
+
attribute: '',
|
|
26
|
+
defaultValue: ''
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
options: events.map(event => ({
|
|
30
|
+
value: event.name,
|
|
31
|
+
label: event.name
|
|
32
|
+
})),
|
|
33
|
+
placeholder: lang({
|
|
34
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.EVENT.PLACEHOLDER'
|
|
35
|
+
})
|
|
36
|
+
}), _jsx(FieldBox, {
|
|
37
|
+
title: lang({
|
|
38
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.ATTRIBUTE'
|
|
39
|
+
}),
|
|
40
|
+
children: _jsx(Select, {
|
|
41
|
+
value: {
|
|
42
|
+
value: dc.attribute,
|
|
43
|
+
label: dc.attribute
|
|
44
|
+
},
|
|
45
|
+
onChange: option => {
|
|
46
|
+
onChange({
|
|
47
|
+
...dc,
|
|
48
|
+
attribute: option.value
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
options: currentEvent.attributes.map(attr => ({
|
|
52
|
+
value: attr.name,
|
|
53
|
+
label: attr.name
|
|
54
|
+
})),
|
|
55
|
+
isDisabled: !currentEvent.name
|
|
56
|
+
})
|
|
57
|
+
}), _jsx(FieldBox, {
|
|
58
|
+
title: lang({
|
|
59
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.FALLBACK_TEXT'
|
|
60
|
+
}),
|
|
61
|
+
isOptional: true,
|
|
62
|
+
children: _jsx(NativeInput, {
|
|
63
|
+
value: dc.defaultValue,
|
|
64
|
+
onChange: e => {
|
|
65
|
+
onChange({
|
|
66
|
+
...dc,
|
|
67
|
+
defaultValue: e.target.value
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
disabled: !currentEvent.name
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
63
74
|
};
|
|
@@ -1,63 +1,74 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { FieldBox, NativeInput, Select } from '@pushwoosh/dumb-components';
|
|
3
3
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { useLang } from './polyglot';
|
|
4
5
|
export const DynamicContentTagPickerForm = ({
|
|
5
6
|
dc,
|
|
6
7
|
tags,
|
|
7
8
|
onChange
|
|
8
9
|
}) => {
|
|
10
|
+
const lang = useLang();
|
|
9
11
|
const currentTag = tags.find(tag => tag.name === dc.tagName) || {
|
|
10
12
|
name: '',
|
|
11
13
|
modifiers: ['regular']
|
|
12
14
|
};
|
|
13
|
-
return
|
|
14
|
-
"$gap": 16
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
15
|
+
return _jsxs(Vertical, {
|
|
16
|
+
"$gap": 16,
|
|
17
|
+
children: [_jsx(Select, {
|
|
18
|
+
value: {
|
|
19
|
+
value: dc.tagName,
|
|
20
|
+
label: dc.tagName
|
|
21
|
+
},
|
|
22
|
+
onChange: option => {
|
|
23
|
+
onChange({
|
|
24
|
+
tagName: option.value,
|
|
25
|
+
modifier: currentTag.modifiers[0],
|
|
26
|
+
defaultValue: ''
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
options: tags.map(tag => ({
|
|
30
|
+
value: tag.name,
|
|
31
|
+
label: tag.name
|
|
32
|
+
})),
|
|
33
|
+
placeholder: lang({
|
|
34
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.TAG.PLACEHOLDER'
|
|
35
|
+
})
|
|
36
|
+
}), _jsx(FieldBox, {
|
|
37
|
+
title: lang({
|
|
38
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.MODIFIER'
|
|
39
|
+
}),
|
|
40
|
+
children: _jsx(Select, {
|
|
41
|
+
value: {
|
|
42
|
+
value: dc.modifier,
|
|
43
|
+
label: dc.modifier
|
|
44
|
+
},
|
|
45
|
+
onChange: option => {
|
|
46
|
+
onChange({
|
|
47
|
+
...dc,
|
|
48
|
+
modifier: option.value
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
options: currentTag.modifiers.map(modifier => ({
|
|
52
|
+
value: modifier,
|
|
53
|
+
label: modifier
|
|
54
|
+
})),
|
|
55
|
+
isDisabled: !currentTag.name
|
|
56
|
+
})
|
|
57
|
+
}), _jsx(FieldBox, {
|
|
58
|
+
title: lang({
|
|
59
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.FALLBACK_TEXT'
|
|
60
|
+
}),
|
|
61
|
+
isOptional: true,
|
|
62
|
+
children: _jsx(NativeInput, {
|
|
63
|
+
value: dc.defaultValue,
|
|
64
|
+
onChange: e => {
|
|
65
|
+
onChange({
|
|
66
|
+
...dc,
|
|
67
|
+
defaultValue: e.target.value
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
disabled: !currentTag.name
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
});
|
|
63
74
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { FieldBox, NativeInput, Select, Spinner } from '@pushwoosh/dumb-components';
|
|
3
4
|
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
5
|
import { useDynamicContentTags } from './hooks';
|
|
6
|
+
import { useLang } from './polyglot';
|
|
5
7
|
import { SimpleTagPickerDiv } from './styled';
|
|
6
8
|
const defaultDynamicContent = {
|
|
7
9
|
tagName: '',
|
|
@@ -14,6 +16,7 @@ export const SimpleDynamicContentPickerFormSmart = ({
|
|
|
14
16
|
update,
|
|
15
17
|
children
|
|
16
18
|
}) => {
|
|
19
|
+
const lang = useLang();
|
|
17
20
|
const asyncResult = useDynamicContentTags();
|
|
18
21
|
useEffect(() => {
|
|
19
22
|
if (!asyncResult.loading) {
|
|
@@ -21,68 +24,80 @@ export const SimpleDynamicContentPickerFormSmart = ({
|
|
|
21
24
|
}
|
|
22
25
|
}, [asyncResult.loading, update]);
|
|
23
26
|
if (asyncResult.loading) {
|
|
24
|
-
return
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
return _jsx(SimpleTagPickerDiv, {
|
|
28
|
+
children: _jsx(Horizontal, {
|
|
29
|
+
"$placeItems": "center",
|
|
30
|
+
"$padding": 36,
|
|
31
|
+
children: _jsx(Spinner, {
|
|
32
|
+
size: "medium"
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
});
|
|
30
36
|
}
|
|
31
37
|
const tags = asyncResult.value || [];
|
|
32
38
|
const currentTag = tags.find(tag => tag.name === dc.tagName) || {
|
|
33
39
|
name: '',
|
|
34
40
|
modifiers: ['regular']
|
|
35
41
|
};
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
42
|
+
return _jsxs(SimpleTagPickerDiv, {
|
|
43
|
+
children: [_jsx(FieldBox, {
|
|
44
|
+
title: lang({
|
|
45
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.TAG'
|
|
46
|
+
}),
|
|
47
|
+
children: _jsxs(Vertical, {
|
|
48
|
+
"$gap": 8,
|
|
49
|
+
children: [_jsx(Select, {
|
|
50
|
+
width: "auto",
|
|
51
|
+
menuPlacement: "auto",
|
|
52
|
+
value: {
|
|
53
|
+
value: dc.tagName,
|
|
54
|
+
label: dc.tagName
|
|
55
|
+
},
|
|
56
|
+
onChange: option => {
|
|
57
|
+
onChange({
|
|
58
|
+
tagName: option.value,
|
|
59
|
+
modifier: currentTag.modifiers[0],
|
|
60
|
+
defaultValue: ''
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
options: tags.map(tag => ({
|
|
64
|
+
value: tag.name,
|
|
65
|
+
label: tag.name
|
|
66
|
+
}))
|
|
67
|
+
}), _jsx(Select, {
|
|
68
|
+
width: "auto",
|
|
69
|
+
menuPlacement: "auto",
|
|
70
|
+
value: {
|
|
71
|
+
value: dc.modifier,
|
|
72
|
+
label: dc.modifier
|
|
73
|
+
},
|
|
74
|
+
onChange: option => {
|
|
75
|
+
onChange({
|
|
76
|
+
...dc,
|
|
77
|
+
modifier: option.value
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
options: currentTag.modifiers.map(modifier => ({
|
|
81
|
+
value: modifier,
|
|
82
|
+
label: modifier
|
|
83
|
+
})),
|
|
84
|
+
isDisabled: !currentTag.name
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
}), _jsx(FieldBox, {
|
|
88
|
+
title: lang({
|
|
89
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.DEFAULT_TAG_VALUE'
|
|
90
|
+
}),
|
|
91
|
+
children: _jsx(NativeInput, {
|
|
92
|
+
value: dc.defaultValue,
|
|
93
|
+
onChange: e => {
|
|
94
|
+
onChange({
|
|
95
|
+
...dc,
|
|
96
|
+
defaultValue: e.target.value
|
|
97
|
+
});
|
|
98
|
+
},
|
|
99
|
+
disabled: !currentTag.name
|
|
100
|
+
})
|
|
101
|
+
}), children]
|
|
102
|
+
});
|
|
88
103
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from 'react';
|
|
2
3
|
import { Button, FieldBox, Select, Spinner } from '@pushwoosh/dumb-components';
|
|
3
4
|
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
5
|
import { DynamicContentCustomPickerForm } from './DynamicContentCustomPickerForm';
|
|
5
6
|
import { DynamicContentEventPickerForm } from './DynamicContentEventPickerForm';
|
|
6
7
|
import { DynamicContentTagPickerForm } from './DynamicContentTagPickerForm';
|
|
7
8
|
import { useVariedDynamicContentTags } from './hooks';
|
|
9
|
+
import { useLang } from './polyglot';
|
|
8
10
|
import { VariedTagPickerDiv } from './styled';
|
|
9
11
|
import { createDefaultDynamicContent } from './utils';
|
|
10
12
|
const defaultVariedDynamicContent = {
|
|
@@ -15,16 +17,6 @@ const defaultVariedDynamicContent = {
|
|
|
15
17
|
defaultValue: ''
|
|
16
18
|
}
|
|
17
19
|
};
|
|
18
|
-
const kindsOptions = [{
|
|
19
|
-
value: 'tag',
|
|
20
|
-
label: 'Tag'
|
|
21
|
-
}, {
|
|
22
|
-
value: 'event',
|
|
23
|
-
label: 'Event'
|
|
24
|
-
}, {
|
|
25
|
-
value: 'customText',
|
|
26
|
-
label: 'Custom Text'
|
|
27
|
-
}];
|
|
28
20
|
export const VariedDynamicContentPickerFormSmart = ({
|
|
29
21
|
applicationCode,
|
|
30
22
|
initialDc = defaultVariedDynamicContent,
|
|
@@ -33,79 +25,113 @@ export const VariedDynamicContentPickerFormSmart = ({
|
|
|
33
25
|
update
|
|
34
26
|
}) => {
|
|
35
27
|
var _kindsOptions$find;
|
|
28
|
+
const lang = useLang();
|
|
36
29
|
const [vdc, setVdc] = useState(initialDc);
|
|
37
30
|
const asyncResult = useVariedDynamicContentTags(applicationCode);
|
|
31
|
+
const kindsOptions = useMemo(() => [{
|
|
32
|
+
value: 'tag',
|
|
33
|
+
label: lang({
|
|
34
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.KIND.TAG'
|
|
35
|
+
})
|
|
36
|
+
}, {
|
|
37
|
+
value: 'event',
|
|
38
|
+
label: lang({
|
|
39
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.KIND.EVENT'
|
|
40
|
+
})
|
|
41
|
+
}, {
|
|
42
|
+
value: 'customText',
|
|
43
|
+
label: lang({
|
|
44
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.KIND.CUSTOM_TEXT'
|
|
45
|
+
})
|
|
46
|
+
}], [lang]);
|
|
38
47
|
useEffect(() => {
|
|
39
48
|
update();
|
|
40
49
|
}, [asyncResult.loading, update]);
|
|
41
50
|
if (asyncResult.loading) {
|
|
42
|
-
return
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
return _jsx(VariedTagPickerDiv, {
|
|
52
|
+
children: _jsx(Horizontal, {
|
|
53
|
+
"$placeItems": "center",
|
|
54
|
+
"$padding": 36,
|
|
55
|
+
children: _jsx(Spinner, {
|
|
56
|
+
size: "medium"
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
});
|
|
48
60
|
}
|
|
49
61
|
const isValidDc = vdc.kind === 'tag' && vdc.dc.tagName !== '' && vdc.dc.modifier !== '' || vdc.kind === 'event' && vdc.dc.eventName !== '' && vdc.dc.attribute !== '' || vdc.kind === 'customText' && vdc.dc.text !== '';
|
|
50
|
-
return
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
dc:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
dc:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
62
|
+
return _jsxs(VariedTagPickerDiv, {
|
|
63
|
+
children: [_jsxs(Vertical, {
|
|
64
|
+
"$gap": 8,
|
|
65
|
+
children: [_jsx(FieldBox, {
|
|
66
|
+
title: lang({
|
|
67
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.VARIABLE_TYPE'
|
|
68
|
+
}),
|
|
69
|
+
children: _jsx(Vertical, {
|
|
70
|
+
"$gap": 8,
|
|
71
|
+
children: _jsx(Select, {
|
|
72
|
+
width: "auto",
|
|
73
|
+
menuPlacement: "auto",
|
|
74
|
+
value: {
|
|
75
|
+
value: vdc.kind,
|
|
76
|
+
label: (_kindsOptions$find = kindsOptions.find(o => o.value === vdc.kind)) === null || _kindsOptions$find === void 0 ? void 0 : _kindsOptions$find.label
|
|
77
|
+
},
|
|
78
|
+
onChange: option => {
|
|
79
|
+
const newDc = createDefaultDynamicContent(option.value);
|
|
80
|
+
setVdc(newDc);
|
|
81
|
+
update();
|
|
82
|
+
},
|
|
83
|
+
options: kindsOptions
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
}), vdc.kind === 'tag' && _jsx(DynamicContentTagPickerForm, {
|
|
87
|
+
dc: vdc.dc,
|
|
88
|
+
tags: asyncResult.value[0],
|
|
89
|
+
onChange: newDc => {
|
|
90
|
+
setVdc({
|
|
91
|
+
...vdc,
|
|
92
|
+
dc: newDc
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}), vdc.kind === 'event' && _jsx(DynamicContentEventPickerForm, {
|
|
96
|
+
dc: vdc.dc,
|
|
97
|
+
events: asyncResult.value[1],
|
|
98
|
+
onChange: newDc => {
|
|
99
|
+
setVdc({
|
|
100
|
+
...vdc,
|
|
101
|
+
dc: newDc
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}), vdc.kind === 'customText' && _jsx(DynamicContentCustomPickerForm, {
|
|
105
|
+
dc: vdc.dc,
|
|
106
|
+
onChange: newDc => {
|
|
107
|
+
setVdc({
|
|
108
|
+
...vdc,
|
|
109
|
+
dc: newDc
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
})]
|
|
113
|
+
}), _jsxs(Horizontal, {
|
|
114
|
+
"$justifyContent": "end",
|
|
115
|
+
"$gap": 8,
|
|
116
|
+
children: [_jsx(Button, {
|
|
117
|
+
color: "secondary",
|
|
118
|
+
size: "compact",
|
|
119
|
+
onClick: onClose,
|
|
120
|
+
children: lang({
|
|
121
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.BUTTON.CANCEL'
|
|
122
|
+
})
|
|
123
|
+
}), _jsx(Button, {
|
|
124
|
+
color: "primary",
|
|
125
|
+
size: "compact",
|
|
126
|
+
onClick: () => {
|
|
127
|
+
onChange(vdc);
|
|
128
|
+
onClose();
|
|
129
|
+
},
|
|
130
|
+
isDisabled: !isValidDc,
|
|
131
|
+
children: lang({
|
|
132
|
+
message: 'SMART.DYNAMIC_CONTENT_PICKER_FORM.BUTTON.APPLY'
|
|
133
|
+
})
|
|
134
|
+
})]
|
|
135
|
+
})]
|
|
136
|
+
});
|
|
111
137
|
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { type DynamicContentPickerFormMessages } from './types';
|
|
2
|
+
export declare const Lang: import("react").FC<import("@pushwoosh/dumb-components/polyglot").LangProps<DynamicContentPickerFormMessages>>, useLang: () => (props: import("@pushwoosh/dumb-components/polyglot").LangProps<DynamicContentPickerFormMessages>) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const messages = {
|
|
2
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.CUSTOM.PLACEHOLDER': 'Enter custom text',
|
|
3
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.EVENT.PLACEHOLDER': 'Select an event',
|
|
4
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.TAG.PLACEHOLDER': 'Select a tag',
|
|
5
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.TAG': 'Tag',
|
|
6
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.ATTRIBUTE': 'Attribute',
|
|
7
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.MODIFIER': 'Modifier',
|
|
8
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.FALLBACK_TEXT': 'Fallback text',
|
|
9
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.DEFAULT_TAG_VALUE': 'Default Tag Value',
|
|
10
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.FIELD.VARIABLE_TYPE': 'Variable Type',
|
|
11
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.KIND.TAG': 'Tag',
|
|
12
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.KIND.EVENT': 'Event',
|
|
13
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.KIND.CUSTOM_TEXT': 'Custom Text',
|
|
14
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.BUTTON.CANCEL': 'Cancel',
|
|
15
|
+
'SMART.DYNAMIC_CONTENT_PICKER_FORM.BUTTON.APPLY': 'Apply'
|
|
16
|
+
};
|