@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.
@@ -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
- }), _jsx(Description, {
96
- cappingOption: cappingOption,
97
- messages: globalCapping.count,
98
- days: globalCapping.days,
99
- isInJourney: isInJourney,
100
- children: cappingOption === CappingTypes.GLOBAL && _jsx(Link, {
101
- target: "_blank",
102
- href: `/applications/${applicationCode}/message-delivery?tab=capping`,
103
- title: globalCappingLinkText,
104
- onClick: editGlobalClicked,
105
- children: _jsxs(LinkWrapper, {
106
- children: [globalCappingLinkText, _jsx(OpenIcon, {
107
- size: "small",
108
- view: "lined",
109
- as: "span"
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,
@@ -5,6 +5,7 @@ type Props = {
5
5
  messages: number;
6
6
  days: number;
7
7
  children?: ReactNode;
8
+ chipTooltip?: string;
8
9
  isInJourney: boolean;
9
10
  variant?: 'message' | 'in-app';
10
11
  };
@@ -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
- }> & string;
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:560px;"]);
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "4.7.2",
3
+ "version": "4.8.0",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",