@pushwoosh/dumb-components 1.1.87 → 1.1.88

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.
@@ -1,3 +1,3 @@
1
- import React from 'react';
1
+ import { type ReactElement } from 'react';
2
2
  import { type CappingBase, type FrequencyCappingEditProps } from './types';
3
- export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, }: FrequencyCappingEditProps<T>): React.JSX.Element;
3
+ export declare function FrequencyCappingEdit<T extends CappingBase>({ capping, globalCapping, onChange, applicationCode, editGlobalClicked, isInJourney, isDisabled, }: FrequencyCappingEditProps<T>): ReactElement;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { Color } from '@pushwoosh/kit-constants';
3
3
  import { Vertical } from '@pushwoosh/kit-helpers';
4
4
  import { OpenIcon } from '@pushwoosh/kit-icons';
@@ -17,7 +17,8 @@ export function FrequencyCappingEdit({
17
17
  onChange,
18
18
  applicationCode,
19
19
  editGlobalClicked,
20
- isInJourney = false
20
+ isInJourney = false,
21
+ isDisabled = false
21
22
  }) {
22
23
  const {
23
24
  enabled,
@@ -28,7 +29,7 @@ export function FrequencyCappingEdit({
28
29
  const cappingOption = getCappingOption(enabled, ignoreGlobalCapping);
29
30
  const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
30
31
  const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
31
- const onChangeFrequencyCapping = React.useCallback(value => {
32
+ const onChangeFrequencyCapping = useCallback(value => {
32
33
  if (value === CappingTypes.IGNORE) {
33
34
  onChange({
34
35
  ...capping,
@@ -53,7 +54,7 @@ export function FrequencyCappingEdit({
53
54
  });
54
55
  }
55
56
  }, [capping, onChange]);
56
- const onSettingsChange = React.useCallback((messages, days) => {
57
+ const onSettingsChange = useCallback((messages, days) => {
57
58
  onChange({
58
59
  ...capping,
59
60
  messages,
@@ -70,6 +71,7 @@ export function FrequencyCappingEdit({
70
71
  title: "Frequency capping"
71
72
  }, React.createElement(Select, {
72
73
  name: "cappingOption",
74
+ isDisabled: isDisabled,
73
75
  options: cappingOptions,
74
76
  value: cappingOptions.find(option => option.value === cappingOption),
75
77
  onChange: newValue => onChangeFrequencyCapping(newValue.value)
@@ -79,15 +81,15 @@ export function FrequencyCappingEdit({
79
81
  days: globalCapping.days,
80
82
  isInJourney: isInJourney
81
83
  }, cappingOption === CappingTypes.GLOBAL && React.createElement(Link, {
84
+ target: "_blank",
82
85
  href: `/applications/${applicationCode}/message-delivery?tab=capping`,
83
86
  title: globalCappingLinkText,
84
- target: "_blank",
85
87
  onClick: editGlobalClicked
86
88
  }, React.createElement(LinkWrapper, null, globalCappingLinkText, React.createElement(OpenIcon, {
87
89
  size: "small",
88
90
  view: "lined",
89
91
  as: "span"
90
- })))), cappingOption === CappingTypes.CUSTOM && React.createElement(EditCappingSettings, {
92
+ })))), cappingOption === CappingTypes.CUSTOM && !isDisabled && React.createElement(EditCappingSettings, {
91
93
  messages: messages,
92
94
  days: days,
93
95
  onChange: onSettingsChange
@@ -1,8 +1,8 @@
1
- import React from 'react';
2
- type Props = {
1
+ import { type ReactElement } from 'react';
2
+ type EditCappingSettingsProps = {
3
3
  messages: number;
4
4
  days: number;
5
5
  onChange: (messages: number, days: number) => void;
6
6
  };
7
- export declare function EditCappingSettings(props: Props): React.JSX.Element;
7
+ export declare function EditCappingSettings(props: EditCappingSettingsProps): ReactElement;
8
8
  export {};
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import { Horizontal } from '@pushwoosh/kit-helpers';
3
3
  import { Paragraph } from '@pushwoosh/kit-typography';
4
4
  import { NumberPicker } from '../../../NumberPicker';
@@ -8,10 +8,10 @@ export function EditCappingSettings(props) {
8
8
  days,
9
9
  onChange
10
10
  } = props;
11
- const onMessagesChange = React.useCallback(value => {
11
+ const onMessagesChange = useCallback(value => {
12
12
  onChange(value, days);
13
13
  }, [days, onChange]);
14
- const onDaysChange = React.useCallback(value => {
14
+ const onDaysChange = useCallback(value => {
15
15
  onChange(messages, value);
16
16
  }, [messages, onChange]);
17
17
  return React.createElement(Horizontal, {
@@ -20,15 +20,15 @@ export function EditCappingSettings(props) {
20
20
  style: {
21
21
  gridTemplateColumns: '145px 70px 90px 70px 40px'
22
22
  }
23
- }, React.createElement(Paragraph, null, "Limit to a maximum of"), React.createElement(NumberPicker, {
24
- onChange: value => onMessagesChange(value),
23
+ }, React.createElement(Paragraph, null, "Limit to a\u00A0maximum\u00A0of"), React.createElement(NumberPicker, {
25
24
  value: messages,
26
25
  minValue: 1,
27
- maxValue: 1000
26
+ maxValue: 1000,
27
+ onChange: value => onMessagesChange(value)
28
28
  }), React.createElement(Paragraph, null, "messages per"), React.createElement(NumberPicker, {
29
29
  maxValue: 30,
30
30
  minValue: 1,
31
- onChange: value => onDaysChange(value),
32
- value: days
31
+ value: days,
32
+ onChange: value => onDaysChange(value)
33
33
  }), React.createElement(Paragraph, null, "day(s)"));
34
34
  }
@@ -23,6 +23,7 @@ export type FrequencyCappingEditProps<T extends CappingBase> = {
23
23
  editGlobalClicked: () => void;
24
24
  applicationCode: string;
25
25
  isInJourney?: boolean;
26
+ isDisabled?: boolean;
26
27
  };
27
28
  export type FrequencyCappingReadonlyProps<T extends CappingBase> = {
28
29
  capping: T;
@@ -0,0 +1,3 @@
1
+ import { type ReactElement } from 'react';
2
+ import type { RadioCardProps } from './types';
3
+ export declare function RadioCard(props: RadioCardProps): ReactElement;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
3
+ import { H4, Paragraph } from '@pushwoosh/kit-typography';
4
+ import { Radio } from '../Radio';
5
+ import { RootBox } from './styled';
6
+ export function RadioCard(props) {
7
+ const {
8
+ title,
9
+ description,
10
+ isActive,
11
+ onClick,
12
+ children
13
+ } = props;
14
+ return React.createElement(RootBox, {
15
+ isActive: isActive,
16
+ onClick: onClick
17
+ }, React.createElement(Vertical, null, React.createElement(Horizontal, {
18
+ "$alignItems": "center",
19
+ "$justifyContent": "space-between"
20
+ }, React.createElement(H4, null, title), React.createElement(Radio, {
21
+ isChecked: isActive
22
+ })), React.createElement(Paragraph, null, description)), children);
23
+ }
@@ -0,0 +1 @@
1
+ export { RadioCard } from './RadioCard';
@@ -0,0 +1 @@
1
+ export { RadioCard } from './RadioCard';
@@ -0,0 +1,65 @@
1
+ import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
2
+ export declare const RootBox: import("styled-components").StyledComponent<"div", any, {
3
+ $alignContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
4
+ $alignItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
5
+ $bgColor?: string | undefined;
6
+ $border?: string | ({
7
+ top?: string | undefined;
8
+ right?: string | undefined;
9
+ bottom?: string | undefined;
10
+ left?: string | undefined;
11
+ } | {
12
+ horizontal: string;
13
+ top?: string | undefined;
14
+ bottom?: string | undefined;
15
+ } | {
16
+ vertical: string;
17
+ right?: string | undefined;
18
+ left?: string | undefined;
19
+ }) | undefined;
20
+ $borderRadius?: (string | number) | undefined;
21
+ $boxShadow?: string | undefined;
22
+ $gap?: (string | number) | undefined;
23
+ $gridAutoFlow?: "row" | "column" | "dense" | "row dense" | "column dense" | undefined;
24
+ $justifyContent?: "end" | "start" | "center" | "space-between" | "space-around" | "space-evenly" | "stretch" | undefined;
25
+ $justifyItems?: "end" | "start" | "center" | "stretch" | "baseline" | undefined;
26
+ $margin?: (string | number) | ({
27
+ top?: (string | number) | undefined;
28
+ right?: (string | number) | undefined;
29
+ bottom?: (string | number) | undefined;
30
+ left?: (string | number) | undefined;
31
+ } | {
32
+ horizontal: string | number;
33
+ top?: (string | number) | undefined;
34
+ bottom?: (string | number) | undefined;
35
+ } | {
36
+ vertical: string | number;
37
+ right?: (string | number) | undefined;
38
+ left?: (string | number) | undefined;
39
+ }) | undefined;
40
+ $padding?: (string | number) | ({
41
+ top?: (string | number) | undefined;
42
+ right?: (string | number) | undefined;
43
+ bottom?: (string | number) | undefined;
44
+ left?: (string | number) | undefined;
45
+ } | {
46
+ horizontal: string | number;
47
+ top?: (string | number) | undefined;
48
+ bottom?: (string | number) | undefined;
49
+ } | {
50
+ vertical: string | number;
51
+ right?: (string | number) | undefined;
52
+ left?: (string | number) | undefined;
53
+ }) | undefined;
54
+ $placeItems?: "end" | "start" | "center" | "stretch" | undefined;
55
+ } & {
56
+ $gridAutoFlow: string;
57
+ } & {
58
+ $padding: number;
59
+ $alignItems: string;
60
+ $bgColor: Color;
61
+ $borderRadius: ShapeRadius;
62
+ $gap: number;
63
+ } & {
64
+ isActive?: boolean;
65
+ }, "$gridAutoFlow" | "$alignItems" | "$bgColor" | "$borderRadius" | "$gap" | "$padding">;
@@ -0,0 +1,15 @@
1
+ import styled from 'styled-components';
2
+ import { Color, ShapeRadius } from '@pushwoosh/kit-constants';
3
+ import { Vertical } from '@pushwoosh/kit-helpers';
4
+ export const RootBox = styled(Vertical).attrs({
5
+ $padding: 16,
6
+ $alignItems: 'start',
7
+ $bgColor: Color.CLEAR,
8
+ $borderRadius: ShapeRadius.SECTION,
9
+ $gap: 12
10
+ }).withConfig({
11
+ displayName: "RootBox",
12
+ componentId: "sc-tkztr1-0"
13
+ })(["width:262px;height:100%;border:", ";box-sizing:border-box;cursor:pointer;"], ({
14
+ isActive
15
+ }) => isActive ? `2px solid ${Color.PRIMARY}` : `1px solid ${Color.DIVIDER}`);
@@ -0,0 +1,8 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface RadioCardProps {
3
+ title: string;
4
+ description: string;
5
+ isActive?: boolean;
6
+ children?: ReactNode;
7
+ onClick: () => void;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
package/index.d.ts CHANGED
@@ -16,6 +16,7 @@ export { Pagination } from './Pagination';
16
16
  export { ProgressBar } from './ProgressBar';
17
17
  export { Popover } from './Popover';
18
18
  export { Radio } from './Radio';
19
+ export { RadioCard } from './RadioCard';
19
20
  export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
20
21
  export { Spinner } from './Spinner';
21
22
  export { SortButton, type SortButtonParams } from './SortButton';
package/index.js CHANGED
@@ -16,6 +16,7 @@ export { Pagination } from './Pagination';
16
16
  export { ProgressBar } from './ProgressBar';
17
17
  export { Popover } from './Popover';
18
18
  export { Radio } from './Radio';
19
+ export { RadioCard } from './RadioCard';
19
20
  export { ReCaptcha, useRecaptcha, asyncScriptLoad } from './ReCaptcha';
20
21
  export { Spinner } from './Spinner';
21
22
  export { SortButton } from './SortButton';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "1.1.87",
3
+ "version": "1.1.88",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",