@pushwoosh/dumb-components 1.1.204 → 1.1.206
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.js +5 -19
- package/FrequencyCapping/FrequencyCappingInApps.js +7 -1
- package/FrequencyCapping/components/CountingMode/CountingModeControl.d.ts +15 -0
- package/FrequencyCapping/components/CountingMode/CountingModeControl.js +31 -0
- package/FrequencyCapping/types.d.ts +6 -0
- package/NativeRichMediaPreview/types.d.ts +1 -1
- package/NativeRichMediaPreview/types.js +2 -2
- package/package.json +1 -1
|
@@ -3,12 +3,12 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import { Color } from '@pushwoosh/kit-constants';
|
|
4
4
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
5
5
|
import { OpenIcon } from '@pushwoosh/kit-icons';
|
|
6
|
-
import {
|
|
6
|
+
import { CountingModeControl } from './components/CountingMode/CountingModeControl';
|
|
7
7
|
import { Description } from './components/Description';
|
|
8
8
|
import { EditCappingSettings } from './components/Settings';
|
|
9
9
|
import { getCappingOption } from './helpers/getCappingOption';
|
|
10
10
|
import { getGlobalCappingLinkText } from './helpers/getGlobalCappingLinkText';
|
|
11
|
-
import {
|
|
11
|
+
import { CappingTypes } from './types';
|
|
12
12
|
import { FieldBox } from '../FieldBox';
|
|
13
13
|
import { Link } from '../Link';
|
|
14
14
|
import { Select } from '../Select';
|
|
@@ -75,18 +75,6 @@ export function FrequencyCappingEdit({
|
|
|
75
75
|
days
|
|
76
76
|
});
|
|
77
77
|
}, [capping, onChange]);
|
|
78
|
-
const onCountingModeChange = useCallback(countingMode => {
|
|
79
|
-
onChange({
|
|
80
|
-
...capping,
|
|
81
|
-
countingMode
|
|
82
|
-
});
|
|
83
|
-
}, [capping, onChange]);
|
|
84
|
-
const onTimezoneChange = useCallback(timezone => {
|
|
85
|
-
onChange({
|
|
86
|
-
...capping,
|
|
87
|
-
timezone
|
|
88
|
-
});
|
|
89
|
-
}, [capping, onChange]);
|
|
90
78
|
return _jsx(Container, {
|
|
91
79
|
"$padding": 16,
|
|
92
80
|
"$bgColor": Color.SOFT_LIGHT,
|
|
@@ -126,12 +114,10 @@ export function FrequencyCappingEdit({
|
|
|
126
114
|
messages: messages,
|
|
127
115
|
days: days,
|
|
128
116
|
onChange: onSettingsChange
|
|
129
|
-
}), cappingOption === CappingTypes.CUSTOM && !isDisabled && timezoneOptions !== undefined && _jsx(
|
|
130
|
-
|
|
131
|
-
timezone: capping.timezone ?? '',
|
|
117
|
+
}), cappingOption === CappingTypes.CUSTOM && !isDisabled && timezoneOptions !== undefined && _jsx(CountingModeControl, {
|
|
118
|
+
capping: capping,
|
|
132
119
|
timezoneOptions: timezoneOptions,
|
|
133
|
-
|
|
134
|
-
onTimezoneChange: onTimezoneChange
|
|
120
|
+
onChange: onChange
|
|
135
121
|
})]
|
|
136
122
|
})
|
|
137
123
|
});
|
|
@@ -3,6 +3,7 @@ import { useCallback } from 'react';
|
|
|
3
3
|
import { Color } from '@pushwoosh/kit-constants';
|
|
4
4
|
import { Vertical } from '@pushwoosh/kit-helpers';
|
|
5
5
|
import { OpenIcon } from '@pushwoosh/kit-icons';
|
|
6
|
+
import { CountingModeControl } from './components/CountingMode/CountingModeControl';
|
|
6
7
|
import { Description } from './components/Description';
|
|
7
8
|
import { EditInAppCappingSettings } from './components/Settings';
|
|
8
9
|
import { getCappingOption } from './helpers/getCappingOption';
|
|
@@ -29,7 +30,8 @@ export function FrequencyCappingInApps(props) {
|
|
|
29
30
|
editGlobalClicked,
|
|
30
31
|
applicationCode,
|
|
31
32
|
isInJourney = false,
|
|
32
|
-
isDisabled = false
|
|
33
|
+
isDisabled = false,
|
|
34
|
+
timezoneOptions
|
|
33
35
|
} = props;
|
|
34
36
|
const lang = useLang();
|
|
35
37
|
const cappingOptions = getCappingOptions(lang);
|
|
@@ -105,6 +107,10 @@ export function FrequencyCappingInApps(props) {
|
|
|
105
107
|
}), cappingOption === CappingTypes.CUSTOM && !isDisabled && _jsx(EditInAppCappingSettings, {
|
|
106
108
|
capping: capping,
|
|
107
109
|
onChange: onSettingsChange
|
|
110
|
+
}), cappingOption === CappingTypes.CUSTOM && !isDisabled && timezoneOptions !== undefined && _jsx(CountingModeControl, {
|
|
111
|
+
capping: capping,
|
|
112
|
+
timezoneOptions: timezoneOptions,
|
|
113
|
+
onChange: onChange
|
|
108
114
|
})]
|
|
109
115
|
})
|
|
110
116
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import type { SelectOption } from '../../../Select';
|
|
3
|
+
import { CappingCountingMode } from '../../types';
|
|
4
|
+
type WindowCapping = {
|
|
5
|
+
countingMode?: CappingCountingMode;
|
|
6
|
+
timezone?: string;
|
|
7
|
+
};
|
|
8
|
+
type CountingModeControlProps<T extends WindowCapping> = {
|
|
9
|
+
capping: T;
|
|
10
|
+
timezoneOptions: SelectOption[];
|
|
11
|
+
onChange: (newCappingState: T) => void;
|
|
12
|
+
};
|
|
13
|
+
/** Controlled {@link CountingMode} bound to a capping config with optional window fields. */
|
|
14
|
+
export declare function CountingModeControl<T extends WindowCapping>(props: CountingModeControlProps<T>): ReactElement;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { CappingCountingMode } from '../../types';
|
|
4
|
+
import { CountingMode } from './index';
|
|
5
|
+
/** Controlled {@link CountingMode} bound to a capping config with optional window fields. */
|
|
6
|
+
export function CountingModeControl(props) {
|
|
7
|
+
const {
|
|
8
|
+
capping,
|
|
9
|
+
timezoneOptions,
|
|
10
|
+
onChange
|
|
11
|
+
} = props;
|
|
12
|
+
const onCountingModeChange = useCallback(countingMode => {
|
|
13
|
+
onChange({
|
|
14
|
+
...capping,
|
|
15
|
+
countingMode
|
|
16
|
+
});
|
|
17
|
+
}, [capping, onChange]);
|
|
18
|
+
const onTimezoneChange = useCallback(timezone => {
|
|
19
|
+
onChange({
|
|
20
|
+
...capping,
|
|
21
|
+
timezone
|
|
22
|
+
});
|
|
23
|
+
}, [capping, onChange]);
|
|
24
|
+
return _jsx(CountingMode, {
|
|
25
|
+
countingMode: capping.countingMode ?? CappingCountingMode.ROLLING,
|
|
26
|
+
timezone: capping.timezone ?? '',
|
|
27
|
+
timezoneOptions: timezoneOptions,
|
|
28
|
+
onCountingModeChange: onCountingModeChange,
|
|
29
|
+
onTimezoneChange: onTimezoneChange
|
|
30
|
+
});
|
|
31
|
+
}
|
|
@@ -46,6 +46,10 @@ export type CappingInAppBase = {
|
|
|
46
46
|
enabled: boolean;
|
|
47
47
|
/** Ignore the account-wide global cap. */
|
|
48
48
|
ignoreGlobalCapping: boolean;
|
|
49
|
+
/** Anchoring of the perDays/leastDays windows; missing means {@link CappingCountingMode.ROLLING}, the lifetime total ignores it. */
|
|
50
|
+
countingMode?: CappingCountingMode;
|
|
51
|
+
/** IANA timezone midnight is calculated in, for {@link CappingCountingMode.CALENDAR_DAY}; empty means UTC. */
|
|
52
|
+
timezone?: string;
|
|
49
53
|
/** Lifetime total limit. */
|
|
50
54
|
total?: {
|
|
51
55
|
count: number;
|
|
@@ -120,4 +124,6 @@ export type FrequencyCappingInAppsProps = {
|
|
|
120
124
|
isInJourney?: boolean;
|
|
121
125
|
/** Disable editing. */
|
|
122
126
|
isDisabled?: boolean;
|
|
127
|
+
/** IANA timezones for the calendar-day mode; supplying them enables the counting-mode selector. */
|
|
128
|
+
timezoneOptions?: SelectOption[];
|
|
123
129
|
};
|
|
@@ -286,7 +286,7 @@ export declare const NATIVE_RICH_MEDIA_DISPLAY_TYPES: NativeRichMediaDisplayType
|
|
|
286
286
|
/**
|
|
287
287
|
* The subset of {@link NATIVE_RICH_MEDIA_DISPLAY_TYPES} the native rich media
|
|
288
288
|
* editor can author. The preview renders every display type, but only these
|
|
289
|
-
*
|
|
289
|
+
* have an editing UI, so pickers must offer this list and not the full one.
|
|
290
290
|
*/
|
|
291
291
|
export declare const EDITABLE_NATIVE_RICH_MEDIA_DISPLAY_TYPES: NativeRichMediaDisplayType[];
|
|
292
292
|
/**
|
|
@@ -3,6 +3,6 @@ export const NATIVE_RICH_MEDIA_DISPLAY_TYPES = ['modal', 'sheet', 'carousel', 's
|
|
|
3
3
|
/**
|
|
4
4
|
* The subset of {@link NATIVE_RICH_MEDIA_DISPLAY_TYPES} the native rich media
|
|
5
5
|
* editor can author. The preview renders every display type, but only these
|
|
6
|
-
*
|
|
6
|
+
* have an editing UI, so pickers must offer this list and not the full one.
|
|
7
7
|
*/
|
|
8
|
-
export const EDITABLE_NATIVE_RICH_MEDIA_DISPLAY_TYPES = ['modal', 'stories', 'fullscreen', 'sheet', 'carousel', 'banner'];
|
|
8
|
+
export const EDITABLE_NATIVE_RICH_MEDIA_DISPLAY_TYPES = ['modal', 'stories', 'fullscreen', 'sheet', 'carousel', 'banner', 'video'];
|