@pushwoosh/dumb-components 4.7.2 → 4.8.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/FrequencyCapping/FrequencyCappingEdit.d.ts +1 -1
- package/FrequencyCapping/FrequencyCappingEdit.js +32 -19
- package/FrequencyCapping/components/Description/index.d.ts +1 -0
- package/FrequencyCapping/components/Description/index.js +2 -0
- package/FrequencyCapping/styles.d.ts +4 -2
- package/FrequencyCapping/styles.js +3 -1
- package/FrequencyCapping/types.d.ts +2 -0
- package/package.json +1 -1
|
@@ -7,4 +7,4 @@ import { type CappingBase, type FrequencyCappingEditProps } from './types';
|
|
|
7
7
|
* @example
|
|
8
8
|
* <FrequencyCappingEdit capping={capping} globalCapping={global} applicationCode={code} onChange={setCapping} editGlobalClicked={openGlobal} />
|
|
9
9
|
*/
|
|
10
|
-
export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, isDisabled, timezoneOptions, }: FrequencyCappingEditProps<T>): ReactElement;
|
|
10
|
+
export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, isDisabled, fullWidth, timezoneOptions, }: FrequencyCappingEditProps<T>): ReactElement;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { Color } from '@pushwoosh/kit-constants';
|
|
4
|
-
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
4
|
+
import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
5
5
|
import { OpenIcon } from '@pushwoosh/kit-icons';
|
|
6
6
|
import { CountingModeControl } from './components/CountingMode/CountingModeControl';
|
|
7
7
|
import { Description } from './components/Description';
|
|
@@ -30,6 +30,7 @@ export function FrequencyCappingEdit({
|
|
|
30
30
|
editGlobalClicked,
|
|
31
31
|
isInJourney = false,
|
|
32
32
|
isDisabled = false,
|
|
33
|
+
fullWidth = false,
|
|
33
34
|
timezoneOptions
|
|
34
35
|
}) {
|
|
35
36
|
const lang = useLang();
|
|
@@ -43,6 +44,20 @@ export function FrequencyCappingEdit({
|
|
|
43
44
|
const cappingOption = getCappingOption(enabled, ignoreGlobalCapping);
|
|
44
45
|
const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
|
|
45
46
|
const globalCappingLinkText = getGlobalCappingLinkText(lang, isGlobalCappingDisabled);
|
|
47
|
+
const isUnlimited = cappingOption === CappingTypes.GLOBAL && isGlobalCappingDisabled;
|
|
48
|
+
const globalCappingLink = cappingOption === CappingTypes.GLOBAL && _jsx(Link, {
|
|
49
|
+
target: "_blank",
|
|
50
|
+
href: `/applications/${applicationCode}/message-delivery?tab=capping`,
|
|
51
|
+
title: globalCappingLinkText,
|
|
52
|
+
onClick: editGlobalClicked,
|
|
53
|
+
children: _jsxs(LinkWrapper, {
|
|
54
|
+
children: [globalCappingLinkText, _jsx(OpenIcon, {
|
|
55
|
+
size: "small",
|
|
56
|
+
view: "lined",
|
|
57
|
+
as: "span"
|
|
58
|
+
})]
|
|
59
|
+
})
|
|
60
|
+
});
|
|
46
61
|
const onChangeFrequencyCapping = useCallback(value => {
|
|
47
62
|
if (value === CappingTypes.IGNORE) {
|
|
48
63
|
onChange({
|
|
@@ -76,6 +91,7 @@ export function FrequencyCappingEdit({
|
|
|
76
91
|
});
|
|
77
92
|
}, [capping, onChange]);
|
|
78
93
|
return _jsx(Container, {
|
|
94
|
+
"$fullWidth": fullWidth,
|
|
79
95
|
"$padding": 16,
|
|
80
96
|
"$bgColor": Color.SOFT_LIGHT,
|
|
81
97
|
"$borderRadius": 8,
|
|
@@ -92,24 +108,21 @@ export function FrequencyCappingEdit({
|
|
|
92
108
|
value: cappingOptions.find(option => option.value === cappingOption),
|
|
93
109
|
onChange: newValue => onChangeFrequencyCapping(newValue.value)
|
|
94
110
|
})
|
|
95
|
-
}),
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
children:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
})]
|
|
111
|
-
})
|
|
112
|
-
})
|
|
111
|
+
}), _jsxs(Vertical, {
|
|
112
|
+
"$gap": 4,
|
|
113
|
+
children: [_jsx(Description, {
|
|
114
|
+
cappingOption: cappingOption,
|
|
115
|
+
messages: globalCapping.count,
|
|
116
|
+
days: globalCapping.days,
|
|
117
|
+
chipTooltip: isUnlimited ? lang({
|
|
118
|
+
message: 'DUMB.FREQUENCY_CAPPING.RO.TOOLTIP_UNLIMITED'
|
|
119
|
+
}) : undefined,
|
|
120
|
+
isInJourney: isInJourney,
|
|
121
|
+
children: !isUnlimited && globalCappingLink
|
|
122
|
+
}), isUnlimited && _jsx(Horizontal, {
|
|
123
|
+
"$justifyContent": "start",
|
|
124
|
+
children: globalCappingLink
|
|
125
|
+
})]
|
|
113
126
|
}), cappingOption === CappingTypes.CUSTOM && !isDisabled && _jsx(EditCappingSettings, {
|
|
114
127
|
messages: messages,
|
|
115
128
|
days: days,
|
|
@@ -9,6 +9,7 @@ export function Description(props) {
|
|
|
9
9
|
messages,
|
|
10
10
|
days,
|
|
11
11
|
children,
|
|
12
|
+
chipTooltip,
|
|
12
13
|
isInJourney,
|
|
13
14
|
variant = 'message'
|
|
14
15
|
} = props;
|
|
@@ -27,6 +28,7 @@ export function Description(props) {
|
|
|
27
28
|
return _jsxs(Paragraph, {
|
|
28
29
|
children: [prefix, chip && _jsx(ChipFrequencyCapping, {
|
|
29
30
|
text: chip,
|
|
31
|
+
tooltip: chipTooltip,
|
|
30
32
|
"$inText": true
|
|
31
33
|
}), suffix, ' ', children]
|
|
32
34
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<Omit<Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
1
|
+
export declare const Container: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Merged<Omit<import("styled-components").FastOmit<Omit<Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
2
2
|
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
3
3
|
}, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
4
4
|
$alignContent?: import("@pushwoosh/kit-helpers/styled-helpers").AlignContentValue;
|
|
@@ -43,7 +43,9 @@ export declare const Container: import("styled-components/dist/types").IStyledCo
|
|
|
43
43
|
}) | (import("react").CSSProperties & {
|
|
44
44
|
[key: `--${string}`]: string | number | undefined;
|
|
45
45
|
}) | undefined;
|
|
46
|
-
}
|
|
46
|
+
}, {
|
|
47
|
+
$fullWidth?: boolean;
|
|
48
|
+
}>> & string;
|
|
47
49
|
export declare const IconWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", Omit<import("styled-components").FastOmit<Omit<Omit<import("styled-components").FastOmit<import("styled-components/dist/types").Merged<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "style"> & {
|
|
48
50
|
style?: import("react").CSSProperties | import("styled-components/dist/types").CSSPropertiesWithVars | undefined;
|
|
49
51
|
}, import("@pushwoosh/kit-helpers/styled-helpers").CommonBoxProps & {
|
|
@@ -4,7 +4,9 @@ import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
|
|
|
4
4
|
export const Container = styled(Vertical).withConfig({
|
|
5
5
|
displayName: "Container",
|
|
6
6
|
componentId: "sc-1z3915-0"
|
|
7
|
-
})(["max-width:
|
|
7
|
+
})(["max-width:", ";"], ({
|
|
8
|
+
$fullWidth
|
|
9
|
+
}) => $fullWidth ? 'none' : '560px');
|
|
8
10
|
export const IconWrapper = styled(Horizontal).withConfig({
|
|
9
11
|
displayName: "IconWrapper",
|
|
10
12
|
componentId: "sc-1z3915-1"
|
|
@@ -83,6 +83,8 @@ export type FrequencyCappingEditProps<T extends CappingBase> = {
|
|
|
83
83
|
isInJourney?: boolean;
|
|
84
84
|
/** Disable editing. */
|
|
85
85
|
isDisabled?: boolean;
|
|
86
|
+
/** Stretch to the parent width instead of the default 560px cap. */
|
|
87
|
+
fullWidth?: boolean;
|
|
86
88
|
/**
|
|
87
89
|
* IANA timezones offered for the calendar-day mode. Supplying them enables the
|
|
88
90
|
* counting-mode selector; omit them to keep the rolling-only UI.
|