@pushwoosh/dumb-components 1.1.29 → 1.1.31
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/Chip/Chip.d.ts +1 -0
- package/Chip/Chip.js +2 -0
- package/Chip/Chip.types.d.ts +1 -0
- package/Chip/styles.d.ts +1 -0
- package/Chip/styles.js +16 -4
- package/FrequencyCapping/FrequencyCappingEdit.d.ts +3 -0
- package/FrequencyCapping/FrequencyCappingEdit.js +90 -0
- package/FrequencyCapping/FrequencyCappingReadonly.d.ts +3 -0
- package/FrequencyCapping/FrequencyCappingReadonly.js +35 -0
- package/FrequencyCapping/components/Condition/index.d.ts +8 -0
- package/FrequencyCapping/components/Condition/index.js +29 -0
- package/FrequencyCapping/components/Condition/styles.d.ts +1 -0
- package/FrequencyCapping/components/Condition/styles.js +5 -0
- package/FrequencyCapping/components/Description/index.d.ts +10 -0
- package/FrequencyCapping/components/Description/index.js +27 -0
- package/FrequencyCapping/components/Settings/index.d.ts +8 -0
- package/FrequencyCapping/components/Settings/index.js +34 -0
- package/FrequencyCapping/helpers/getCappingOption.d.ts +6 -0
- package/FrequencyCapping/helpers/getCappingOption.js +20 -0
- package/FrequencyCapping/helpers/getReadonlyCappingHelpers.d.ts +7 -0
- package/FrequencyCapping/helpers/getReadonlyCappingHelpers.js +79 -0
- package/FrequencyCapping/index.d.ts +3 -0
- package/FrequencyCapping/index.js +2 -0
- package/FrequencyCapping/styles.d.ts +113 -0
- package/FrequencyCapping/styles.js +15 -0
- package/FrequencyCapping/types.d.ts +32 -0
- package/FrequencyCapping/types.js +6 -0
- package/SendRate/SendRateEdit.d.ts +14 -0
- package/SendRate/SendRateEdit.js +77 -0
- package/SendRate/SendRateReadonly.d.ts +11 -0
- package/SendRate/SendRateReadonly.js +35 -0
- package/SendRate/components/Condition/index.d.ts +7 -0
- package/SendRate/components/Condition/index.js +12 -0
- package/SendRate/components/Condition/styles.d.ts +1 -0
- package/SendRate/components/Condition/styles.js +5 -0
- package/SendRate/components/Description/index.d.ts +10 -0
- package/SendRate/components/Description/index.js +25 -0
- package/SendRate/components/Settings/index.d.ts +9 -0
- package/SendRate/components/Settings/index.js +27 -0
- package/SendRate/helpers/getReadonlySendRateHelpers.d.ts +7 -0
- package/SendRate/helpers/getReadonlySendRateHelpers.js +78 -0
- package/SendRate/helpers/getSendRateOptions.d.ts +2 -0
- package/SendRate/helpers/getSendRateOptions.js +10 -0
- package/SendRate/index.d.ts +2 -0
- package/SendRate/index.js +2 -0
- package/SendRate/styles.d.ts +113 -0
- package/SendRate/styles.js +15 -0
- package/SendRate/types.d.ts +9 -0
- package/index.d.ts +2 -1
- package/index.js +2 -1
- package/package.json +1 -3
- package/Table/assets/box.svg +0 -1
- package/Table/assets/error.svg +0 -1
- package/Table/assets/notfound.svg +0 -1
- package/Table/components/DataTable/DataTable.d.ts +0 -4
- package/Table/components/DataTable/DataTable.js +0 -79
- package/Table/components/DataTable/index.d.ts +0 -1
- package/Table/components/DataTable/index.js +0 -1
- package/Table/components/DataTable/types.d.ts +0 -26
- package/Table/components/DataTableGetContext/DataTableGetContext.d.ts +0 -4
- package/Table/components/DataTableGetContext/DataTableGetContext.js +0 -8
- package/Table/components/DataTableGetContext/index.d.ts +0 -1
- package/Table/components/DataTableGetContext/index.js +0 -1
- package/Table/components/DataTableGetContext/types.d.ts +0 -5
- package/Table/components/DataTableGetContext/types.js +0 -1
- package/Table/components/DataTableList/DataTableList.d.ts +0 -3
- package/Table/components/DataTableList/DataTableList.js +0 -80
- package/Table/components/DataTableList/index.d.ts +0 -1
- package/Table/components/DataTableList/index.js +0 -1
- package/Table/components/DataTableList/types.d.ts +0 -4
- package/Table/components/DataTableList/types.js +0 -1
- package/Table/components/DataTablePagination/DataTablePagination.d.ts +0 -3
- package/Table/components/DataTablePagination/DataTablePagination.js +0 -35
- package/Table/components/DataTablePagination/index.d.ts +0 -1
- package/Table/components/DataTablePagination/index.js +0 -1
- package/Table/components/DataTablePagination/types.d.ts +0 -5
- package/Table/components/DataTablePagination/types.js +0 -1
- package/Table/components/DataTableSearchInput/DataTableSearchInput.d.ts +0 -3
- package/Table/components/DataTableSearchInput/DataTableSearchInput.js +0 -40
- package/Table/components/DataTableSearchInput/index.d.ts +0 -1
- package/Table/components/DataTableSearchInput/index.js +0 -1
- package/Table/components/DataTableSearchInput/types.d.ts +0 -3
- package/Table/components/DataTableSearchInput/types.js +0 -1
- package/Table/components/DataTableSortableCell/DataTableSortableCell.d.ts +0 -3
- package/Table/components/DataTableSortableCell/DataTableSortableCell.js +0 -25
- package/Table/components/DataTableSortableCell/index.d.ts +0 -1
- package/Table/components/DataTableSortableCell/index.js +0 -1
- package/Table/components/DataTableSortableCell/types.d.ts +0 -4
- package/Table/components/DataTableSortableCell/types.js +0 -1
- package/Table/components/Loading/Loading.d.ts +0 -2
- package/Table/components/Loading/Loading.js +0 -20
- package/Table/components/Loading/index.d.ts +0 -1
- package/Table/components/Loading/index.js +0 -1
- package/Table/components/Loading/styles.d.ts +0 -1
- package/Table/components/Loading/styles.js +0 -6
- package/Table/components/TablePagination/TablePagination.d.ts +0 -3
- package/Table/components/TablePagination/TablePagination.js +0 -39
- package/Table/components/TablePagination/index.d.ts +0 -1
- package/Table/components/TablePagination/index.js +0 -1
- package/Table/components/TablePagination/types.d.ts +0 -10
- package/Table/components/TablePagination/types.js +0 -1
- package/Table/context.d.ts +0 -2
- package/Table/context.js +0 -2
- package/Table/hooks/helpers.d.ts +0 -2
- package/Table/hooks/helpers.js +0 -6
- package/Table/hooks/index.d.ts +0 -2
- package/Table/hooks/index.js +0 -2
- package/Table/hooks/useDataTableContext.d.ts +0 -11
- package/Table/hooks/useDataTableContext.js +0 -23
- package/Table/hooks/useDataTableGetParams.d.ts +0 -11
- package/Table/hooks/useDataTableGetParams.js +0 -53
- package/Table/index.d.ts +0 -10
- package/Table/index.js +0 -9
- package/Table/styles.d.ts +0 -247
- package/Table/styles.js +0 -62
- package/Table/types.d.ts +0 -20
- package/Table/types.js +0 -1
- /package/{Table/components/DataTable → SendRate}/types.js +0 -0
package/Chip/Chip.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export declare const Chip: React.ForwardRefExoticComponent<{
|
|
|
3
3
|
$variant?: import("./Chip.types").ChipVariant;
|
|
4
4
|
$selected?: boolean;
|
|
5
5
|
$onClose?: React.HTMLAttributes<HTMLDivElement>["onClick"];
|
|
6
|
+
$readOnly?: boolean;
|
|
6
7
|
as?: string;
|
|
7
8
|
} & {
|
|
8
9
|
children?: React.ReactNode | undefined;
|
package/Chip/Chip.js
CHANGED
|
@@ -4,6 +4,7 @@ import { ChipStyled } from './styles';
|
|
|
4
4
|
export const Chip = forwardRef(({
|
|
5
5
|
$variant = 'primary',
|
|
6
6
|
$selected,
|
|
7
|
+
$readOnly,
|
|
7
8
|
$onClose,
|
|
8
9
|
children,
|
|
9
10
|
as,
|
|
@@ -14,6 +15,7 @@ export const Chip = forwardRef(({
|
|
|
14
15
|
"$variant": $variant,
|
|
15
16
|
"$selected": $selected,
|
|
16
17
|
"$closeable": !!$onClose,
|
|
18
|
+
"$readOnly": $readOnly,
|
|
17
19
|
as: as,
|
|
18
20
|
...rest
|
|
19
21
|
}, children, $onClose && React.createElement(CloseIcon, {
|
package/Chip/Chip.types.d.ts
CHANGED
package/Chip/styles.d.ts
CHANGED
package/Chip/styles.js
CHANGED
|
@@ -8,8 +8,20 @@ export const ChipStyled = styled.div.withConfig({
|
|
|
8
8
|
$closeable
|
|
9
9
|
}) => $closeable ? '4px' : '8px', ({
|
|
10
10
|
$variant,
|
|
11
|
-
$selected
|
|
12
|
-
|
|
11
|
+
$selected,
|
|
12
|
+
$readOnly
|
|
13
|
+
}) => {
|
|
14
|
+
if ($readOnly) {
|
|
15
|
+
return Color.MAIN;
|
|
16
|
+
}
|
|
17
|
+
return $selected ? Color.CLEAR : variants[$variant].color;
|
|
18
|
+
}, ({
|
|
13
19
|
$variant,
|
|
14
|
-
$selected
|
|
15
|
-
|
|
20
|
+
$selected,
|
|
21
|
+
$readOnly
|
|
22
|
+
}) => {
|
|
23
|
+
if ($readOnly) {
|
|
24
|
+
return Color.SOFT_LIGHT;
|
|
25
|
+
}
|
|
26
|
+
return $selected ? Color.MAIN : variants[$variant].background;
|
|
27
|
+
});
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CappingBase, type FrequencyCappingEditProps } from './types';
|
|
3
|
+
export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode }: FrequencyCappingEditProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { OpenIcon } from '@pushwoosh/kit-icons';
|
|
5
|
+
import { Description } from './components/Description';
|
|
6
|
+
import { EditCappingSettings } from './components/Settings';
|
|
7
|
+
import { getCappingOption, getCappingOptions } from './helpers/getCappingOption';
|
|
8
|
+
import { CappingTypes } from './types';
|
|
9
|
+
import { FieldBox } from '../FieldBox';
|
|
10
|
+
import { Link } from '../Link';
|
|
11
|
+
import { Select } from '../Select';
|
|
12
|
+
import { Container, LinkWrapper } from './styles';
|
|
13
|
+
export function FrequencyCappingEdit({
|
|
14
|
+
capping,
|
|
15
|
+
globalCapping,
|
|
16
|
+
onChange,
|
|
17
|
+
applicationCode
|
|
18
|
+
}) {
|
|
19
|
+
const {
|
|
20
|
+
enabled,
|
|
21
|
+
messages,
|
|
22
|
+
days,
|
|
23
|
+
ignoreGlobalCapping
|
|
24
|
+
} = capping;
|
|
25
|
+
const cappingOption = getCappingOption(enabled, ignoreGlobalCapping);
|
|
26
|
+
const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
|
|
27
|
+
const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
|
|
28
|
+
const cappingOptions = getCappingOptions(isGlobalCappingDisabled);
|
|
29
|
+
const onChangeFrequencyCapping = React.useCallback(value => {
|
|
30
|
+
if (value === CappingTypes.IGNORE) {
|
|
31
|
+
onChange({
|
|
32
|
+
...capping,
|
|
33
|
+
enabled: false,
|
|
34
|
+
ignoreGlobalCapping: true
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
if (value === CappingTypes.CUSTOM) {
|
|
38
|
+
onChange({
|
|
39
|
+
...capping,
|
|
40
|
+
enabled: true,
|
|
41
|
+
ignoreGlobalCapping: false,
|
|
42
|
+
messages: 5,
|
|
43
|
+
days: 1
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (value === CappingTypes.GLOBAL) {
|
|
47
|
+
onChange({
|
|
48
|
+
...capping,
|
|
49
|
+
enabled: false,
|
|
50
|
+
ignoreGlobalCapping: false
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}, [capping, onChange]);
|
|
54
|
+
const onSettingsChange = React.useCallback((messages, days) => {
|
|
55
|
+
onChange({
|
|
56
|
+
...capping,
|
|
57
|
+
messages,
|
|
58
|
+
days
|
|
59
|
+
});
|
|
60
|
+
}, [capping, onChange]);
|
|
61
|
+
return React.createElement(Container, {
|
|
62
|
+
"$padding": 16,
|
|
63
|
+
"$bgColor": Color.SOFT_LIGHT,
|
|
64
|
+
"$borderRadius": 8
|
|
65
|
+
}, React.createElement(Vertical, {
|
|
66
|
+
"$gap": 12
|
|
67
|
+
}, React.createElement(FieldBox, {
|
|
68
|
+
title: "Frequency capping"
|
|
69
|
+
}, React.createElement(Select, {
|
|
70
|
+
name: "cappingOption",
|
|
71
|
+
options: cappingOptions,
|
|
72
|
+
value: cappingOptions.find(option => option.value === cappingOption),
|
|
73
|
+
onChange: newValue => onChangeFrequencyCapping(newValue.value)
|
|
74
|
+
})), React.createElement(Description, {
|
|
75
|
+
cappingOption: cappingOption,
|
|
76
|
+
messages: globalCapping.count,
|
|
77
|
+
days: globalCapping.days
|
|
78
|
+
}, cappingOption === CappingTypes.GLOBAL && React.createElement(Link, {
|
|
79
|
+
href: `/applications/${applicationCode}/message-delivery-settings?tab=capping`,
|
|
80
|
+
title: globalCappingLinkText
|
|
81
|
+
}, React.createElement(LinkWrapper, null, globalCappingLinkText, React.createElement(OpenIcon, {
|
|
82
|
+
size: "small",
|
|
83
|
+
view: "lined",
|
|
84
|
+
as: "span"
|
|
85
|
+
})))), cappingOption === CappingTypes.CUSTOM && React.createElement(EditCappingSettings, {
|
|
86
|
+
messages: messages,
|
|
87
|
+
days: days,
|
|
88
|
+
onChange: onSettingsChange
|
|
89
|
+
})));
|
|
90
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CappingBase, type FrequencyCappingReadonlyProps } from './types';
|
|
3
|
+
export declare function FrequencyCappingReadonly<T extends CappingBase>({ capping, globalCapping, applicationCode }: FrequencyCappingReadonlyProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
3
|
+
import { OpenIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { Link } from '../Link';
|
|
5
|
+
import { getCappingOption } from './helpers/getCappingOption';
|
|
6
|
+
import { getReadonlyCappingIcon, getReadonlyCappingLabel } from './helpers/getReadonlyCappingHelpers';
|
|
7
|
+
import { CappingTypes } from './types';
|
|
8
|
+
export function FrequencyCappingReadonly({
|
|
9
|
+
capping,
|
|
10
|
+
globalCapping,
|
|
11
|
+
applicationCode
|
|
12
|
+
}) {
|
|
13
|
+
const cappingOption = getCappingOption(capping === null || capping === void 0 ? void 0 : capping.enabled, capping === null || capping === void 0 ? void 0 : capping.ignoreGlobalCapping);
|
|
14
|
+
const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
|
|
15
|
+
const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
|
|
16
|
+
const label = getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled, capping, globalCapping);
|
|
17
|
+
const checkIcon = getReadonlyCappingIcon(cappingOption, isGlobalCappingDisabled);
|
|
18
|
+
return React.createElement(Vertical, {
|
|
19
|
+
"$gap": 24
|
|
20
|
+
}, React.createElement(Horizontal, {
|
|
21
|
+
"$gap": 8,
|
|
22
|
+
"$justifyContent": "start",
|
|
23
|
+
"$alignItems": "center"
|
|
24
|
+
}, checkIcon, label, cappingOption === CappingTypes.GLOBAL && React.createElement(Link, {
|
|
25
|
+
href: `/applications/${applicationCode}/message-delivery-settings?tab=capping`,
|
|
26
|
+
title: globalCappingLinkText
|
|
27
|
+
}, React.createElement(Horizontal, {
|
|
28
|
+
"$gap": 4,
|
|
29
|
+
"$justifyContent": "start",
|
|
30
|
+
"$alignItems": "center"
|
|
31
|
+
}, globalCappingLinkText, React.createElement(OpenIcon, {
|
|
32
|
+
size: "small",
|
|
33
|
+
view: "lined"
|
|
34
|
+
})))));
|
|
35
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { HelpRoundIcon } from '@pushwoosh/kit-icons';
|
|
4
|
+
import { ChipWithinTextContainer } from './styles';
|
|
5
|
+
import { Chip } from '../../../Chip';
|
|
6
|
+
import { Tooltip } from '../../../Tooltip';
|
|
7
|
+
export function Condition({
|
|
8
|
+
messages,
|
|
9
|
+
days,
|
|
10
|
+
tooltip
|
|
11
|
+
}) {
|
|
12
|
+
return React.createElement(ChipWithinTextContainer, null, tooltip ? React.createElement(Tooltip, {
|
|
13
|
+
content: tooltip,
|
|
14
|
+
position: "top-middle"
|
|
15
|
+
}, React.createElement(Chip, {
|
|
16
|
+
"$variant": "primary",
|
|
17
|
+
"$readOnly": true,
|
|
18
|
+
as: "span"
|
|
19
|
+
}, `${messages} messages per ${days} ${days > 1 ? 'days' : 'day'}`, React.createElement(HelpRoundIcon, {
|
|
20
|
+
as: "span",
|
|
21
|
+
size: "small",
|
|
22
|
+
view: "lined",
|
|
23
|
+
color: Color.PHANTOM
|
|
24
|
+
}))) : React.createElement(Chip, {
|
|
25
|
+
"$variant": "primary",
|
|
26
|
+
"$readOnly": true,
|
|
27
|
+
as: "span"
|
|
28
|
+
}, `${messages} messages per ${days} ${days > 1 ? 'days' : 'day'}`));
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ChipWithinTextContainer: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
import { CappingTypes } from '../../types';
|
|
3
|
+
type Props = {
|
|
4
|
+
cappingOption: CappingTypes;
|
|
5
|
+
messages: number;
|
|
6
|
+
days: number;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
export declare function Description(props: Props): React.JSX.Element | undefined;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Paragraph } from '@pushwoosh/kit-typography';
|
|
3
|
+
import { CappingTypes } from '../../types';
|
|
4
|
+
import { Condition } from '../Condition';
|
|
5
|
+
export function Description(props) {
|
|
6
|
+
const {
|
|
7
|
+
cappingOption,
|
|
8
|
+
messages,
|
|
9
|
+
days,
|
|
10
|
+
children
|
|
11
|
+
} = props;
|
|
12
|
+
if (cappingOption === CappingTypes.GLOBAL) {
|
|
13
|
+
if (messages === 0 && days === 0) {
|
|
14
|
+
return React.createElement(Paragraph, null, "To ensure you don\u2019t overwhelm your subscribers with excessive communication, consider setting up Global frequency capping.", ' ', children);
|
|
15
|
+
}
|
|
16
|
+
return React.createElement(Paragraph, null, "Under the current setup, If the user receives more than", React.createElement(Condition, {
|
|
17
|
+
messages: messages,
|
|
18
|
+
days: days
|
|
19
|
+
}), ", this message will not be delivered, and the user will proceed to the next step.", ' ', children);
|
|
20
|
+
}
|
|
21
|
+
if (cappingOption === CappingTypes.CUSTOM) {
|
|
22
|
+
return React.createElement(Paragraph, null, "Instead of Global frequency capping, the limit of sent messages you set will be used. If the subscriber exceeds the limit of received messages, they will not receive this message and will proceed to the next step.", ' ', children);
|
|
23
|
+
}
|
|
24
|
+
if (cappingOption === CappingTypes.IGNORE) {
|
|
25
|
+
return React.createElement(Paragraph, null, "The user will receive this message regardless, even if they have exceeded the set message limits for the channel. Use with caution to avoid sending too many messages.", ' ', children);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
3
|
+
import { Paragraph } from '@pushwoosh/kit-typography';
|
|
4
|
+
import { NumberPicker } from '../../../NumberPicker';
|
|
5
|
+
export function EditCappingSettings(props) {
|
|
6
|
+
const {
|
|
7
|
+
messages,
|
|
8
|
+
days,
|
|
9
|
+
onChange
|
|
10
|
+
} = props;
|
|
11
|
+
const onMessagesChange = React.useCallback(value => {
|
|
12
|
+
onChange(value, days);
|
|
13
|
+
}, [days, onChange]);
|
|
14
|
+
const onDaysChange = React.useCallback(value => {
|
|
15
|
+
onChange(messages, value);
|
|
16
|
+
}, [messages, onChange]);
|
|
17
|
+
return React.createElement(Horizontal, {
|
|
18
|
+
"$gap": 12,
|
|
19
|
+
"$alignItems": "center",
|
|
20
|
+
style: {
|
|
21
|
+
gridTemplateColumns: '145px 70px 90px 70px 40px'
|
|
22
|
+
}
|
|
23
|
+
}, React.createElement(Paragraph, null, "Limit to a maximum of"), React.createElement(NumberPicker, {
|
|
24
|
+
onChange: value => onMessagesChange(value),
|
|
25
|
+
value: messages,
|
|
26
|
+
minValue: 1,
|
|
27
|
+
maxValue: 1000
|
|
28
|
+
}), React.createElement(Paragraph, null, "messages per"), React.createElement(NumberPicker, {
|
|
29
|
+
maxValue: 30,
|
|
30
|
+
minValue: 1,
|
|
31
|
+
onChange: value => onDaysChange(value),
|
|
32
|
+
value: days
|
|
33
|
+
}), React.createElement(Paragraph, null, "day(s)"));
|
|
34
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CappingTypes } from '../types';
|
|
2
|
+
export declare const getCappingOption: (enabled: boolean, ignoreGlobalCapping: boolean) => CappingTypes;
|
|
3
|
+
export declare const getCappingOptions: (isGlobalCappingDisabled: boolean) => {
|
|
4
|
+
value: CappingTypes;
|
|
5
|
+
label: string;
|
|
6
|
+
}[];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CappingTypes } from '../types';
|
|
2
|
+
export const getCappingOption = (enabled, ignoreGlobalCapping) => {
|
|
3
|
+
if (enabled) {
|
|
4
|
+
return CappingTypes.CUSTOM;
|
|
5
|
+
}
|
|
6
|
+
if (ignoreGlobalCapping) {
|
|
7
|
+
return CappingTypes.IGNORE;
|
|
8
|
+
}
|
|
9
|
+
return CappingTypes.GLOBAL;
|
|
10
|
+
};
|
|
11
|
+
export const getCappingOptions = isGlobalCappingDisabled => [{
|
|
12
|
+
value: CappingTypes.GLOBAL,
|
|
13
|
+
label: `Use global frequency capping settings${isGlobalCappingDisabled ? ' (currently inactive)' : ''}`
|
|
14
|
+
}, {
|
|
15
|
+
value: CappingTypes.IGNORE,
|
|
16
|
+
label: 'Send messages without global frequency capping'
|
|
17
|
+
}, {
|
|
18
|
+
value: CappingTypes.CUSTOM,
|
|
19
|
+
label: 'Use custom frequency capping'
|
|
20
|
+
}];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type CappingBase, CappingTypes } from '../types';
|
|
3
|
+
export declare function getReadonlyCappingIcon(cappingOption: CappingTypes, isGlobalCappingDisabled: boolean): React.JSX.Element;
|
|
4
|
+
export declare function getReadonlyCappingLabel<T extends CappingBase>(cappingOption: CappingTypes, isGlobalCappingDisabled: boolean, capping: T, globalCapping: {
|
|
5
|
+
count: number;
|
|
6
|
+
days: number;
|
|
7
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { CheckRoundIcon, CloseRoundIcon, HelpRoundIcon } from '@pushwoosh/kit-icons';
|
|
5
|
+
import { Paragraph } from '@pushwoosh/kit-typography';
|
|
6
|
+
import { Tooltip } from '../../Tooltip';
|
|
7
|
+
import { Condition } from '../components/Condition';
|
|
8
|
+
import { IconWrapper } from '../styles';
|
|
9
|
+
import { CappingTypes } from '../types';
|
|
10
|
+
export function getReadonlyCappingIcon(cappingOption, isGlobalCappingDisabled) {
|
|
11
|
+
if (cappingOption === CappingTypes.GLOBAL && isGlobalCappingDisabled) {
|
|
12
|
+
return React.createElement(CloseRoundIcon, {
|
|
13
|
+
size: "small",
|
|
14
|
+
view: "filled",
|
|
15
|
+
color: Color.LOCKED
|
|
16
|
+
});
|
|
17
|
+
;
|
|
18
|
+
}
|
|
19
|
+
return React.createElement(CheckRoundIcon, {
|
|
20
|
+
size: "small",
|
|
21
|
+
view: "filled",
|
|
22
|
+
type: "fill",
|
|
23
|
+
color: Color.BRIGHT
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled, capping, globalCapping) {
|
|
27
|
+
const tooltip = getReadonlyTooltip(cappingOption, isGlobalCappingDisabled);
|
|
28
|
+
if (cappingOption === CappingTypes.CUSTOM) {
|
|
29
|
+
return React.createElement(Paragraph, null, "Custom frequency capping for this message:", React.createElement(Condition, {
|
|
30
|
+
messages: capping.messages,
|
|
31
|
+
days: capping.days,
|
|
32
|
+
tooltip: tooltip
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
if (cappingOption === CappingTypes.IGNORE) {
|
|
36
|
+
return React.createElement(Horizontal, {
|
|
37
|
+
"$alignItems": "center",
|
|
38
|
+
"$gap": 4,
|
|
39
|
+
"$justifyContent": "start"
|
|
40
|
+
}, "Send messages without global frequency capping", React.createElement(Tooltip, {
|
|
41
|
+
content: tooltip,
|
|
42
|
+
position: "top-middle"
|
|
43
|
+
}, React.createElement(IconWrapper, {
|
|
44
|
+
"$padding": "4px 0"
|
|
45
|
+
}, React.createElement(HelpRoundIcon, {
|
|
46
|
+
size: "small",
|
|
47
|
+
view: "lined"
|
|
48
|
+
}))));
|
|
49
|
+
}
|
|
50
|
+
return isGlobalCappingDisabled ? React.createElement(Horizontal, {
|
|
51
|
+
"$alignItems": "center",
|
|
52
|
+
"$gap": 4,
|
|
53
|
+
"$justifyContent": "start"
|
|
54
|
+
}, "Global frequency capping is not active for this channel", React.createElement(Tooltip, {
|
|
55
|
+
content: tooltip,
|
|
56
|
+
position: "top-middle"
|
|
57
|
+
}, React.createElement(IconWrapper, {
|
|
58
|
+
"$padding": "4px 0"
|
|
59
|
+
}, React.createElement(HelpRoundIcon, {
|
|
60
|
+
size: "small",
|
|
61
|
+
view: "lined"
|
|
62
|
+
})))) : React.createElement(Paragraph, null, "Global frequency capping:", React.createElement(Condition, {
|
|
63
|
+
messages: globalCapping.count,
|
|
64
|
+
days: globalCapping.days,
|
|
65
|
+
tooltip: tooltip
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
function getReadonlyTooltip(cappingOption, isGlobalCappingDisabled) {
|
|
69
|
+
if (cappingOption === CappingTypes.CUSTOM) {
|
|
70
|
+
return 'If the subscriber exceeds the limit of received messages, they will not receive this message and will proceed to the next step';
|
|
71
|
+
}
|
|
72
|
+
if (cappingOption === CappingTypes.IGNORE) {
|
|
73
|
+
return 'The user will receive this message regardless, even if they have exceeded the set limits for the channel';
|
|
74
|
+
}
|
|
75
|
+
if (isGlobalCappingDisabled) {
|
|
76
|
+
return 'Messages will be sent without global limits because capping is currently not active for this channel';
|
|
77
|
+
}
|
|
78
|
+
return 'If the subscriber exceeds the limit of received messages, they will not receive this message and will proceed to the next step';
|
|
79
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
export declare const Container: import("styled-components").StyledComponent<"div", any, {
|
|
2
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
3
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
4
|
+
$bgColor?: string | undefined;
|
|
5
|
+
$border?: string | ({
|
|
6
|
+
top?: string | undefined;
|
|
7
|
+
right?: string | undefined;
|
|
8
|
+
bottom?: string | undefined;
|
|
9
|
+
left?: string | undefined;
|
|
10
|
+
} | {
|
|
11
|
+
horizontal: string;
|
|
12
|
+
top?: string | undefined;
|
|
13
|
+
bottom?: string | undefined;
|
|
14
|
+
} | {
|
|
15
|
+
vertical: string;
|
|
16
|
+
right?: string | undefined;
|
|
17
|
+
left?: string | undefined;
|
|
18
|
+
}) | undefined;
|
|
19
|
+
$borderRadius?: (string | number) | undefined;
|
|
20
|
+
$boxShadow?: string | undefined;
|
|
21
|
+
$gap?: (string | number) | undefined;
|
|
22
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
23
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
24
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
25
|
+
$margin?: (string | number) | ({
|
|
26
|
+
top?: (string | number) | undefined;
|
|
27
|
+
right?: (string | number) | undefined;
|
|
28
|
+
bottom?: (string | number) | undefined;
|
|
29
|
+
left?: (string | number) | undefined;
|
|
30
|
+
} | {
|
|
31
|
+
horizontal: string | number;
|
|
32
|
+
top?: (string | number) | undefined;
|
|
33
|
+
bottom?: (string | number) | undefined;
|
|
34
|
+
} | {
|
|
35
|
+
vertical: string | number;
|
|
36
|
+
right?: (string | number) | undefined;
|
|
37
|
+
left?: (string | number) | undefined;
|
|
38
|
+
}) | undefined;
|
|
39
|
+
$padding?: (string | number) | ({
|
|
40
|
+
top?: (string | number) | undefined;
|
|
41
|
+
right?: (string | number) | undefined;
|
|
42
|
+
bottom?: (string | number) | undefined;
|
|
43
|
+
left?: (string | number) | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
horizontal: string | number;
|
|
46
|
+
top?: (string | number) | undefined;
|
|
47
|
+
bottom?: (string | number) | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
vertical: string | number;
|
|
50
|
+
right?: (string | number) | undefined;
|
|
51
|
+
left?: (string | number) | undefined;
|
|
52
|
+
}) | undefined;
|
|
53
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
54
|
+
} & {
|
|
55
|
+
$gridAutoFlow: string;
|
|
56
|
+
}, "$gridAutoFlow">;
|
|
57
|
+
export declare const IconWrapper: import("styled-components").StyledComponent<"div", any, {
|
|
58
|
+
$alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
59
|
+
$alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
60
|
+
$bgColor?: string | undefined;
|
|
61
|
+
$border?: string | ({
|
|
62
|
+
top?: string | undefined;
|
|
63
|
+
right?: string | undefined;
|
|
64
|
+
bottom?: string | undefined;
|
|
65
|
+
left?: string | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
horizontal: string;
|
|
68
|
+
top?: string | undefined;
|
|
69
|
+
bottom?: string | undefined;
|
|
70
|
+
} | {
|
|
71
|
+
vertical: string;
|
|
72
|
+
right?: string | undefined;
|
|
73
|
+
left?: string | undefined;
|
|
74
|
+
}) | undefined;
|
|
75
|
+
$borderRadius?: (string | number) | undefined;
|
|
76
|
+
$boxShadow?: string | undefined;
|
|
77
|
+
$gap?: (string | number) | undefined;
|
|
78
|
+
$gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
|
|
79
|
+
$justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
|
|
80
|
+
$justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
|
|
81
|
+
$margin?: (string | number) | ({
|
|
82
|
+
top?: (string | number) | undefined;
|
|
83
|
+
right?: (string | number) | undefined;
|
|
84
|
+
bottom?: (string | number) | undefined;
|
|
85
|
+
left?: (string | number) | undefined;
|
|
86
|
+
} | {
|
|
87
|
+
horizontal: string | number;
|
|
88
|
+
top?: (string | number) | undefined;
|
|
89
|
+
bottom?: (string | number) | undefined;
|
|
90
|
+
} | {
|
|
91
|
+
vertical: string | number;
|
|
92
|
+
right?: (string | number) | undefined;
|
|
93
|
+
left?: (string | number) | undefined;
|
|
94
|
+
}) | undefined;
|
|
95
|
+
$padding?: (string | number) | ({
|
|
96
|
+
top?: (string | number) | undefined;
|
|
97
|
+
right?: (string | number) | undefined;
|
|
98
|
+
bottom?: (string | number) | undefined;
|
|
99
|
+
left?: (string | number) | undefined;
|
|
100
|
+
} | {
|
|
101
|
+
horizontal: string | number;
|
|
102
|
+
top?: (string | number) | undefined;
|
|
103
|
+
bottom?: (string | number) | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
vertical: string | number;
|
|
106
|
+
right?: (string | number) | undefined;
|
|
107
|
+
left?: (string | number) | undefined;
|
|
108
|
+
}) | undefined;
|
|
109
|
+
$placeItems?: "end" | "start" | "center" | "stretch" | undefined;
|
|
110
|
+
} & {
|
|
111
|
+
$gridAutoFlow: string;
|
|
112
|
+
}, "$gridAutoFlow">;
|
|
113
|
+
export declare const LinkWrapper: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { Color } from '@pushwoosh/kit-constants';
|
|
3
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
export const Container = styled(Vertical).withConfig({
|
|
5
|
+
displayName: "Container",
|
|
6
|
+
componentId: "sc-1z3915-0"
|
|
7
|
+
})(["max-width:560px;"]);
|
|
8
|
+
export const IconWrapper = styled(Horizontal).withConfig({
|
|
9
|
+
displayName: "IconWrapper",
|
|
10
|
+
componentId: "sc-1z3915-1"
|
|
11
|
+
})(["color:", ";&:hover{color:", ";cursor:pointer;}"], Color.PHANTOM, Color.PRIMARY_HOVER);
|
|
12
|
+
export const LinkWrapper = styled.span.withConfig({
|
|
13
|
+
displayName: "LinkWrapper",
|
|
14
|
+
componentId: "sc-1z3915-2"
|
|
15
|
+
})(["display:inline-flex;gap:4px;align-items:center;justify-content:start;text-decoration:none;"]);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare enum CappingTypes {
|
|
2
|
+
GLOBAL = "global",
|
|
3
|
+
IGNORE = "ignore",
|
|
4
|
+
CUSTOM = "custom"
|
|
5
|
+
}
|
|
6
|
+
export type CappingOption = {
|
|
7
|
+
label: string;
|
|
8
|
+
value: CappingTypes;
|
|
9
|
+
};
|
|
10
|
+
export type CappingBase = {
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
messages: number;
|
|
13
|
+
days: number;
|
|
14
|
+
ignoreGlobalCapping: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type FrequencyCappingEditProps<T extends CappingBase> = {
|
|
17
|
+
capping: T;
|
|
18
|
+
globalCapping: {
|
|
19
|
+
count: number;
|
|
20
|
+
days: number;
|
|
21
|
+
};
|
|
22
|
+
onChange: (newCappingState: T) => void;
|
|
23
|
+
applicationCode: string;
|
|
24
|
+
};
|
|
25
|
+
export type FrequencyCappingReadonlyProps<T extends CappingBase> = {
|
|
26
|
+
capping: T;
|
|
27
|
+
globalCapping: {
|
|
28
|
+
count: number;
|
|
29
|
+
days: number;
|
|
30
|
+
};
|
|
31
|
+
applicationCode: string;
|
|
32
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type SendRateBase } from './types';
|
|
3
|
+
export type SendRateEditProps<T extends SendRateBase> = {
|
|
4
|
+
sendRate: T;
|
|
5
|
+
globalSendRate: {
|
|
6
|
+
count: number;
|
|
7
|
+
seconds: number;
|
|
8
|
+
};
|
|
9
|
+
onChange: (newSendRateState: T) => void;
|
|
10
|
+
applicationCode: string;
|
|
11
|
+
minValue: number;
|
|
12
|
+
maxValue: number;
|
|
13
|
+
};
|
|
14
|
+
export declare function SendRateEdit<T extends SendRateBase>({ sendRate, globalSendRate, onChange, applicationCode, minValue, maxValue }: SendRateEditProps<T>): React.JSX.Element;
|