@pushwoosh/dumb-components 1.1.133 → 1.1.134

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.
Files changed (54) hide show
  1. package/Calendar/CalendarDropdown/CalendarDropdown.js +15 -3
  2. package/Calendar/CalendarSuperForm/components/CalendarTimeAndTimezoneSection/CalendarTimeAndTimezoneSection.js +14 -4
  3. package/Calendar/polyglot/index.d.ts +2 -0
  4. package/Calendar/polyglot/index.js +10 -0
  5. package/Calendar/polyglot/messages_en.d.ts +3 -0
  6. package/Calendar/polyglot/messages_en.js +11 -0
  7. package/Calendar/polyglot/messages_ru.d.ts +3 -0
  8. package/Calendar/polyglot/messages_ru.js +11 -0
  9. package/Calendar/polyglot/types.d.ts +14 -0
  10. package/Calendar/polyglot/types.js +1 -0
  11. package/FrequencyCapping/FrequencyCappingEdit.js +7 -2
  12. package/FrequencyCapping/FrequencyCappingInApps.js +7 -2
  13. package/FrequencyCapping/FrequencyCappingReadonly.js +5 -2
  14. package/FrequencyCapping/components/Description/index.js +3 -1
  15. package/FrequencyCapping/components/Settings/EditCappingSettings.js +10 -3
  16. package/FrequencyCapping/components/Settings/EditInAppCappingSettings.js +25 -8
  17. package/FrequencyCapping/helpers/getCappingChipText.d.ts +2 -1
  18. package/FrequencyCapping/helpers/getCappingChipText.js +13 -15
  19. package/FrequencyCapping/helpers/getDescriptionMessages.d.ts +2 -1
  20. package/FrequencyCapping/helpers/getDescriptionMessages.js +42 -22
  21. package/FrequencyCapping/helpers/getGlobalCappingLinkText.d.ts +2 -0
  22. package/FrequencyCapping/helpers/getGlobalCappingLinkText.js +7 -0
  23. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.d.ts +2 -1
  24. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.js +27 -15
  25. package/FrequencyCapping/polyglot/index.d.ts +4 -0
  26. package/FrequencyCapping/polyglot/index.js +10 -0
  27. package/FrequencyCapping/polyglot/messages_en.d.ts +3 -0
  28. package/FrequencyCapping/polyglot/messages_en.js +33 -0
  29. package/FrequencyCapping/polyglot/messages_ru.d.ts +3 -0
  30. package/FrequencyCapping/polyglot/messages_ru.js +33 -0
  31. package/FrequencyCapping/polyglot/types.d.ts +46 -0
  32. package/FrequencyCapping/polyglot/types.js +1 -0
  33. package/SendRate/SendRateEdit.js +7 -2
  34. package/SendRate/SendRateReadonly.js +5 -2
  35. package/SendRate/components/Condition/index.js +8 -1
  36. package/SendRate/components/Description/index.js +20 -6
  37. package/SendRate/components/Settings/index.js +7 -2
  38. package/SendRate/helpers/getGlobalSendRateLinkText.d.ts +2 -0
  39. package/SendRate/helpers/getGlobalSendRateLinkText.js +7 -0
  40. package/SendRate/helpers/getReadonlySendRateHelpers.d.ts +2 -1
  41. package/SendRate/helpers/getReadonlySendRateHelpers.js +20 -11
  42. package/SendRate/polyglot/index.d.ts +4 -0
  43. package/SendRate/polyglot/index.js +10 -0
  44. package/SendRate/polyglot/messages_en.d.ts +3 -0
  45. package/SendRate/polyglot/messages_en.js +20 -0
  46. package/SendRate/polyglot/messages_ru.d.ts +3 -0
  47. package/SendRate/polyglot/messages_ru.js +20 -0
  48. package/SendRate/polyglot/types.d.ts +23 -0
  49. package/SendRate/polyglot/types.js +1 -0
  50. package/package.json +1 -1
  51. package/polyglot/index.d.ts +1 -1
  52. package/polyglot/index.js +1 -1
  53. package/polyglot/react.d.ts +12 -2
  54. package/polyglot/react.js +80 -45
@@ -8,6 +8,7 @@ import { Button } from '../../Button';
8
8
  import { Chip } from '../../Chip';
9
9
  import { Popover } from '../../Popover';
10
10
  import { CalendarSuperForm } from '../CalendarSuperForm';
11
+ import { Lang, useLang } from '../polyglot';
11
12
  export const CalendarDropdown = props => {
12
13
  const {
13
14
  mode,
@@ -24,6 +25,7 @@ export const CalendarDropdown = props => {
24
25
  const popoverRef = useRef(null);
25
26
  const [isShaking, setIsShaking] = useState(false);
26
27
  const [isOpen, setIsOpen] = useState(false);
28
+ const lang = useLang();
27
29
  const [value, setValue] = useState(props.value ?? (isRangePicker ? [] : undefined));
28
30
  const initialTimezone = calendarProps.timezone || 'UTC';
29
31
  const [timezone, setTimezone] = useState(initialTimezone);
@@ -51,7 +53,11 @@ export const CalendarDropdown = props => {
51
53
  const noValue = isRangePicker ? ((value === null || value === void 0 ? void 0 : value.length) ?? 0) === 0 : !value;
52
54
  let buttonText;
53
55
  if (noValue) {
54
- buttonText = isRangePicker ? 'Select period' : 'Select date';
56
+ buttonText = isRangePicker ? lang({
57
+ message: 'DUMB.CALENDAR.SELECT_PERIOD'
58
+ }) : lang({
59
+ message: 'DUMB.CALENDAR.SELECT_DATE'
60
+ });
55
61
  } else {
56
62
  buttonText = stringifyValue(value, withTime, timezone);
57
63
  }
@@ -136,7 +142,11 @@ export const CalendarDropdown = props => {
136
142
  setTimezone(initialTimezone);
137
143
  }
138
144
  }
139
- }, noValue ? 'Cancel' : 'Reset'), React.createElement(Button, {
145
+ }, noValue ? React.createElement(Lang, {
146
+ message: "DUMB.CALENDAR.CANCEL"
147
+ }) : React.createElement(Lang, {
148
+ message: "DUMB.CALENDAR.RESET"
149
+ })), React.createElement(Button, {
140
150
  color: "primary",
141
151
  size: "compact",
142
152
  onClick: () => {
@@ -155,5 +165,7 @@ export const CalendarDropdown = props => {
155
165
  closePopover();
156
166
  }
157
167
  }
158
- }, "Apply"))))));
168
+ }, React.createElement(Lang, {
169
+ message: "DUMB.CALENDAR.APPLY"
170
+ })))))));
159
171
  };
@@ -6,6 +6,7 @@ import { H5, Text } from '@pushwoosh/kit-typography';
6
6
  import { Button } from '../../../../Button';
7
7
  import { extendPeriodStruct, formatTwoDigitNumber } from '../../../helpers';
8
8
  import { formatTimezoneShort } from '../../../helpers-tz';
9
+ import { Lang } from '../../../polyglot';
9
10
  import { CalendarTimeInput } from '../CalendarTimeInput';
10
11
  import { CalendarTimezoneSelect } from '../CalendarTimezoneSelect';
11
12
  export const CalendarTimeAndTimezoneSection = ({
@@ -70,16 +71,22 @@ export const CalendarTimeAndTimezoneSection = ({
70
71
  size: "compact",
71
72
  view: "ghost",
72
73
  onClick: () => setExpanded(true)
73
- }, "Expand time")) : React.createElement(React.Fragment, null, isRangePicker && React.createElement(Columns, {
74
+ }, React.createElement(Lang, {
75
+ message: "DUMB.CALENDAR.EXPAND_TIME"
76
+ }))) : React.createElement(React.Fragment, null, isRangePicker && React.createElement(Columns, {
74
77
  "$sizes": "1fr max-content",
75
78
  "$gap": 8,
76
79
  "$alignItems": "center"
77
- }, React.createElement(H5, null, "Time range:"), React.createElement(Button, {
80
+ }, React.createElement(H5, null, React.createElement(Lang, {
81
+ message: "DUMB.CALENDAR.TIME_RANGE"
82
+ })), React.createElement(Button, {
78
83
  color: "secondary",
79
84
  size: "compact",
80
85
  view: "ghost",
81
86
  onClick: () => setExpanded(false)
82
- }, "Collapse time")), !isRangePicker ? React.createElement(Horizontal, {
87
+ }, React.createElement(Lang, {
88
+ message: "DUMB.CALENDAR.COLLAPSE_TIME"
89
+ }))), !isRangePicker ? React.createElement(Horizontal, {
83
90
  "$alignItems": "center",
84
91
  "$gap": 8,
85
92
  "$justifyContent": "start"
@@ -131,5 +138,8 @@ export const CalendarTimeAndTimezoneSection = ({
131
138
  }, React.createElement(Text, {
132
139
  "$variant": "footnote",
133
140
  "$color": Color.LOCKED
134
- }, "Please select", ' ', isRangePicker ? 'date range' : 'date', ' ', "first to set time"))));
141
+ }, React.createElement(Lang, {
142
+ message: "DUMB.CALENDAR.SELECT_FIRST_HINT",
143
+ isRange: Boolean(isRangePicker)
144
+ })))));
135
145
  };
@@ -0,0 +1,2 @@
1
+ import { type CalendarMessages } from './types';
2
+ export declare const Lang: import("react").FC<import("../../polyglot").LangProps<CalendarMessages>>, useLang: () => (props: import("../../polyglot").LangProps<CalendarMessages>) => string;
@@ -0,0 +1,10 @@
1
+ import { messages as en } from './messages_en';
2
+ import { messages as ru } from './messages_ru';
3
+ import { createLang } from '../../polyglot';
4
+ export const {
5
+ Lang,
6
+ useLang
7
+ } = createLang({
8
+ en,
9
+ ru
10
+ });
@@ -0,0 +1,3 @@
1
+ import { type CalendarMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<CalendarMessages>;
@@ -0,0 +1,11 @@
1
+ export const messages = {
2
+ 'DUMB.CALENDAR.SELECT_PERIOD': 'Select period',
3
+ 'DUMB.CALENDAR.SELECT_DATE': 'Select date',
4
+ 'DUMB.CALENDAR.CANCEL': 'Cancel',
5
+ 'DUMB.CALENDAR.RESET': 'Reset',
6
+ 'DUMB.CALENDAR.APPLY': 'Apply',
7
+ 'DUMB.CALENDAR.EXPAND_TIME': 'Expand time',
8
+ 'DUMB.CALENDAR.COLLAPSE_TIME': 'Collapse time',
9
+ 'DUMB.CALENDAR.TIME_RANGE': 'Time range:',
10
+ 'DUMB.CALENDAR.SELECT_FIRST_HINT': 'Please select {% if isRange == true %}date range{% else %}date{% endif %} first to set time'
11
+ };
@@ -0,0 +1,3 @@
1
+ import { type CalendarMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<CalendarMessages>;
@@ -0,0 +1,11 @@
1
+ export const messages = {
2
+ 'DUMB.CALENDAR.SELECT_PERIOD': 'Выберите период',
3
+ 'DUMB.CALENDAR.SELECT_DATE': 'Выберите дату',
4
+ 'DUMB.CALENDAR.CANCEL': 'Отмена',
5
+ 'DUMB.CALENDAR.RESET': 'Сбросить',
6
+ 'DUMB.CALENDAR.APPLY': 'Применить',
7
+ 'DUMB.CALENDAR.EXPAND_TIME': 'Развернуть время',
8
+ 'DUMB.CALENDAR.COLLAPSE_TIME': 'Свернуть время',
9
+ 'DUMB.CALENDAR.TIME_RANGE': 'Диапазон времени:',
10
+ 'DUMB.CALENDAR.SELECT_FIRST_HINT': 'Сначала выберите {% if isRange == true %}диапазон дат{% else %}дату{% endif %}, чтобы задать время'
11
+ };
@@ -0,0 +1,14 @@
1
+ import type { NoParams } from '../../polyglot';
2
+ export type CalendarMessages = {
3
+ 'DUMB.CALENDAR.SELECT_PERIOD': NoParams;
4
+ 'DUMB.CALENDAR.SELECT_DATE': NoParams;
5
+ 'DUMB.CALENDAR.CANCEL': NoParams;
6
+ 'DUMB.CALENDAR.RESET': NoParams;
7
+ 'DUMB.CALENDAR.APPLY': NoParams;
8
+ 'DUMB.CALENDAR.EXPAND_TIME': NoParams;
9
+ 'DUMB.CALENDAR.COLLAPSE_TIME': NoParams;
10
+ 'DUMB.CALENDAR.TIME_RANGE': NoParams;
11
+ 'DUMB.CALENDAR.SELECT_FIRST_HINT': {
12
+ isRange: boolean;
13
+ };
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -5,11 +5,13 @@ import { OpenIcon } from '@pushwoosh/kit-icons';
5
5
  import { Description } from './components/Description';
6
6
  import { EditCappingSettings } from './components/Settings';
7
7
  import { getCappingOption } from './helpers/getCappingOption';
8
+ import { getGlobalCappingLinkText } from './helpers/getGlobalCappingLinkText';
8
9
  import { CappingTypes } from './types';
9
10
  import { FieldBox } from '../FieldBox';
10
11
  import { Link } from '../Link';
11
12
  import { Select } from '../Select';
12
13
  import { cappingOptions } from './constants';
14
+ import { useLang } from './polyglot';
13
15
  import { Container, LinkWrapper } from './styles';
14
16
  export function FrequencyCappingEdit({
15
17
  capping,
@@ -20,6 +22,7 @@ export function FrequencyCappingEdit({
20
22
  isInJourney = false,
21
23
  isDisabled = false
22
24
  }) {
25
+ const lang = useLang();
23
26
  const {
24
27
  enabled,
25
28
  messages,
@@ -28,7 +31,7 @@ export function FrequencyCappingEdit({
28
31
  } = capping;
29
32
  const cappingOption = getCappingOption(enabled, ignoreGlobalCapping);
30
33
  const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
31
- const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
34
+ const globalCappingLinkText = getGlobalCappingLinkText(lang, isGlobalCappingDisabled);
32
35
  const onChangeFrequencyCapping = useCallback(value => {
33
36
  if (value === CappingTypes.IGNORE) {
34
37
  onChange({
@@ -68,7 +71,9 @@ export function FrequencyCappingEdit({
68
71
  }, React.createElement(Vertical, {
69
72
  "$gap": 12
70
73
  }, React.createElement(FieldBox, {
71
- title: "Frequency capping"
74
+ title: lang({
75
+ message: 'DUMB.FREQUENCY_CAPPING.FIELD_TITLE'
76
+ })
72
77
  }, React.createElement(Select, {
73
78
  name: "cappingOption",
74
79
  isDisabled: isDisabled,
@@ -5,11 +5,13 @@ import { OpenIcon } from '@pushwoosh/kit-icons';
5
5
  import { Description } from './components/Description';
6
6
  import { EditInAppCappingSettings } from './components/Settings';
7
7
  import { getCappingOption } from './helpers/getCappingOption';
8
+ import { getGlobalCappingLinkText } from './helpers/getGlobalCappingLinkText';
8
9
  import { CappingTypes } from './types';
9
10
  import { FieldBox } from '../FieldBox';
10
11
  import { Link } from '../Link';
11
12
  import { Select } from '../Select';
12
13
  import { cappingOptions } from './constants';
14
+ import { useLang } from './polyglot';
13
15
  import { Container, LinkWrapper } from './styles';
14
16
  export function FrequencyCappingInApps(props) {
15
17
  const {
@@ -21,13 +23,14 @@ export function FrequencyCappingInApps(props) {
21
23
  isInJourney = false,
22
24
  isDisabled = false
23
25
  } = props;
26
+ const lang = useLang();
24
27
  const {
25
28
  enabled,
26
29
  ignoreGlobalCapping
27
30
  } = capping;
28
31
  const cappingOption = getCappingOption(enabled, ignoreGlobalCapping);
29
32
  const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
30
- const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
33
+ const globalCappingLinkText = getGlobalCappingLinkText(lang, isGlobalCappingDisabled);
31
34
  const onChangeFrequencyCapping = useCallback(value => {
32
35
  if (value === CappingTypes.IGNORE) {
33
36
  onChange({
@@ -61,7 +64,9 @@ export function FrequencyCappingInApps(props) {
61
64
  }, React.createElement(Vertical, {
62
65
  "$gap": 12
63
66
  }, React.createElement(FieldBox, {
64
- title: "Frequency capping"
67
+ title: lang({
68
+ message: 'DUMB.FREQUENCY_CAPPING.FIELD_TITLE'
69
+ })
65
70
  }, React.createElement(Select, {
66
71
  name: "cappingOption",
67
72
  isDisabled: isDisabled,
@@ -3,7 +3,9 @@ import { Horizontal, Vertical } from '@pushwoosh/kit-helpers';
3
3
  import { OpenIcon } from '@pushwoosh/kit-icons';
4
4
  import { Link } from '../Link';
5
5
  import { getCappingOption } from './helpers/getCappingOption';
6
+ import { getGlobalCappingLinkText } from './helpers/getGlobalCappingLinkText';
6
7
  import { getReadonlyCappingLabel } from './helpers/getReadonlyCappingHelpers';
8
+ import { useLang } from './polyglot';
7
9
  import { CappingTypes } from './types';
8
10
  export function FrequencyCappingReadonly({
9
11
  capping,
@@ -12,10 +14,11 @@ export function FrequencyCappingReadonly({
12
14
  editGlobalClicked,
13
15
  isInJourney = false
14
16
  }) {
17
+ const lang = useLang();
15
18
  const cappingOption = getCappingOption(capping === null || capping === void 0 ? void 0 : capping.enabled, capping === null || capping === void 0 ? void 0 : capping.ignoreGlobalCapping);
16
19
  const isGlobalCappingDisabled = globalCapping.count === 0 && globalCapping.days === 0;
17
- const globalCappingLinkText = isGlobalCappingDisabled ? 'Set up' : 'Settings';
18
- const label = getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled, capping, globalCapping, isInJourney);
20
+ const globalCappingLinkText = getGlobalCappingLinkText(lang, isGlobalCappingDisabled);
21
+ const label = getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled, capping, globalCapping, isInJourney, lang);
19
22
  return React.createElement(Vertical, {
20
23
  "$gap": 24
21
24
  }, React.createElement(Horizontal, {
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Paragraph } from '@pushwoosh/kit-typography';
3
3
  import { getDescriptionMessages } from '../../helpers/getDescriptionMessages';
4
+ import { useLang } from '../../polyglot';
4
5
  import { ChipFrequencyCapping } from '../Condition';
5
6
  export function Description(props) {
6
7
  const {
@@ -11,6 +12,7 @@ export function Description(props) {
11
12
  isInJourney,
12
13
  variant = 'message'
13
14
  } = props;
15
+ const lang = useLang();
14
16
  const {
15
17
  prefix,
16
18
  chip,
@@ -21,7 +23,7 @@ export function Description(props) {
21
23
  messages,
22
24
  days,
23
25
  isInJourney
24
- });
26
+ }, lang);
25
27
  return React.createElement(Paragraph, null, prefix, chip && React.createElement(ChipFrequencyCapping, {
26
28
  text: chip,
27
29
  "$inText": true
@@ -2,6 +2,7 @@ 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';
5
+ import { Lang } from '../../polyglot';
5
6
  export function EditCappingSettings(props) {
6
7
  const {
7
8
  messages,
@@ -20,15 +21,21 @@ export function EditCappingSettings(props) {
20
21
  style: {
21
22
  gridTemplateColumns: '145px 70px 90px 70px 40px'
22
23
  }
23
- }, React.createElement(Paragraph, null, "Limit to a\u00A0maximum\u00A0of"), React.createElement(NumberPicker, {
24
+ }, React.createElement(Paragraph, null, React.createElement(Lang, {
25
+ message: "DUMB.FREQUENCY_CAPPING.SETTINGS.LIMIT_TO_MAX"
26
+ })), React.createElement(NumberPicker, {
24
27
  value: messages,
25
28
  minValue: 1,
26
29
  maxValue: 1000,
27
30
  onChange: value => onMessagesChange(value)
28
- }), React.createElement(Paragraph, null, "messages per"), React.createElement(NumberPicker, {
31
+ }), React.createElement(Paragraph, null, React.createElement(Lang, {
32
+ message: "DUMB.FREQUENCY_CAPPING.SETTINGS.MESSAGES_PER"
33
+ })), React.createElement(NumberPicker, {
29
34
  maxValue: 30,
30
35
  minValue: 1,
31
36
  value: days,
32
37
  onChange: value => onDaysChange(value)
33
- }), React.createElement(Paragraph, null, "day(s)"));
38
+ }), React.createElement(Paragraph, null, React.createElement(Lang, {
39
+ message: "DUMB.FREQUENCY_CAPPING.SETTINGS.DAYS"
40
+ })));
34
41
  }
@@ -3,6 +3,7 @@ import { Columns, Vertical } from '@pushwoosh/kit-helpers';
3
3
  import { Paragraph, Text } from '@pushwoosh/kit-typography';
4
4
  import { Checkbox } from '../../../Checkbox';
5
5
  import { NumberPicker } from '../../../NumberPicker';
6
+ import { Lang } from '../../polyglot';
6
7
  export function EditInAppCappingSettings(props) {
7
8
  var _capping$total, _capping$perDays, _capping$perDays2, _capping$leastDays;
8
9
  const {
@@ -88,13 +89,17 @@ export function EditInAppCappingSettings(props) {
88
89
  }, [capping, onChange]);
89
90
  return React.createElement(Vertical, {
90
91
  "$gap": 8
91
- }, React.createElement(Paragraph, null, "Limit frequency of displaying this In-App to a particular user"), React.createElement(Columns, {
92
+ }, React.createElement(Paragraph, null, React.createElement(Lang, {
93
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.LIMIT_DESC"
94
+ })), React.createElement(Columns, {
92
95
  "$sizes": "100px 80px auto",
93
96
  "$alignItems": "center",
94
97
  "$justifyContent": "start",
95
98
  "$gap": 8
96
99
  }, React.createElement(Checkbox, {
97
- label: "Limited to",
100
+ label: React.createElement(Lang, {
101
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.LIMITED_TO"
102
+ }),
98
103
  isChecked: hasTotal,
99
104
  onChange: onTotalToggle
100
105
  }), React.createElement(NumberPicker, {
@@ -103,13 +108,17 @@ export function EditInAppCappingSettings(props) {
103
108
  maxValue: 1000,
104
109
  isDisabled: !hasTotal,
105
110
  onChange: onTotalCountChange
106
- }), React.createElement(Text, null, "total impressions")), React.createElement(Columns, {
111
+ }), React.createElement(Text, null, React.createElement(Lang, {
112
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.TOTAL_IMPRESSIONS"
113
+ }))), React.createElement(Columns, {
107
114
  "$sizes": "100px 80px auto 80px auto",
108
115
  "$alignItems": "center",
109
116
  "$justifyContent": "start",
110
117
  "$gap": 8
111
118
  }, React.createElement(Checkbox, {
112
- label: "Limited to",
119
+ label: React.createElement(Lang, {
120
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.LIMITED_TO"
121
+ }),
113
122
  isChecked: hasPerDays,
114
123
  onChange: onPerDaysToggle
115
124
  }), React.createElement(NumberPicker, {
@@ -118,19 +127,25 @@ export function EditInAppCappingSettings(props) {
118
127
  maxValue: 1000,
119
128
  isDisabled: !hasPerDays,
120
129
  onChange: onPerDaysCountChange
121
- }), React.createElement(Text, null, "impressions in"), React.createElement(NumberPicker, {
130
+ }), React.createElement(Text, null, React.createElement(Lang, {
131
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.IMPRESSIONS_IN"
132
+ })), React.createElement(NumberPicker, {
122
133
  value: ((_capping$perDays2 = capping.perDays) === null || _capping$perDays2 === void 0 ? void 0 : _capping$perDays2.days) ?? 1,
123
134
  minValue: 1,
124
135
  maxValue: 366,
125
136
  isDisabled: !hasPerDays,
126
137
  onChange: onPerDaysDaysChange
127
- }), React.createElement(Text, null, "day(s)")), React.createElement(Columns, {
138
+ }), React.createElement(Text, null, React.createElement(Lang, {
139
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.DAYS"
140
+ }))), React.createElement(Columns, {
128
141
  "$sizes": "100px 80px auto",
129
142
  "$alignItems": "center",
130
143
  "$justifyContent": "start",
131
144
  "$gap": 8
132
145
  }, React.createElement(Checkbox, {
133
- label: "Enable",
146
+ label: React.createElement(Lang, {
147
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.ENABLE"
148
+ }),
134
149
  isChecked: hasLeastDays,
135
150
  onChange: onLeastDaysToggle
136
151
  }), React.createElement(NumberPicker, {
@@ -139,5 +154,7 @@ export function EditInAppCappingSettings(props) {
139
154
  maxValue: 366,
140
155
  isDisabled: !hasLeastDays,
141
156
  onChange: onLeastDaysCountChange
142
- }), React.createElement(Text, null, "day(s) interval between impressions")));
157
+ }), React.createElement(Text, null, React.createElement(Lang, {
158
+ message: "DUMB.FREQUENCY_CAPPING.INAPP.DAYS_INTERVAL"
159
+ }))));
143
160
  }
@@ -1,3 +1,4 @@
1
+ import { type FrequencyCappingLang } from '../polyglot';
1
2
  type Unit = 'message' | 'in-app';
2
- export declare function getCappingChipText(messages: number, days: number, unit?: Unit): string;
3
+ export declare function getCappingChipText(lang: FrequencyCappingLang, messages: number, days: number, unit?: Unit): string;
3
4
  export {};
@@ -1,18 +1,16 @@
1
- const unitLabels = {
2
- message: {
3
- singular: 'message',
4
- plural: 'messages'
5
- },
6
- 'in-app': {
7
- singular: 'in-app',
8
- plural: 'in-apps'
9
- }
10
- };
11
- export function getCappingChipText(messages, days, unit = 'message') {
1
+ export function getCappingChipText(lang, messages, days, unit = 'message') {
12
2
  if (messages === 0 && days === 0) {
13
- return 'unlimited';
3
+ return lang({
4
+ message: 'DUMB.FREQUENCY_CAPPING.CHIP.UNLIMITED'
5
+ });
14
6
  }
15
- const unitLabel = messages === 1 ? unitLabels[unit].singular : unitLabels[unit].plural;
16
- const daysLabel = days > 1 ? 'days' : 'day';
17
- return `${messages} ${unitLabel} per ${days} ${daysLabel}`;
7
+ return unit === 'in-app' ? lang({
8
+ message: 'DUMB.FREQUENCY_CAPPING.CHIP.INAPP',
9
+ count: messages,
10
+ days
11
+ }) : lang({
12
+ message: 'DUMB.FREQUENCY_CAPPING.CHIP.MESSAGE',
13
+ count: messages,
14
+ days
15
+ });
18
16
  }
@@ -1,3 +1,4 @@
1
+ import { type FrequencyCappingLang } from '../polyglot';
1
2
  import { CappingTypes } from '../types';
2
3
  type Variant = 'message' | 'in-app';
3
4
  type Params = {
@@ -12,5 +13,5 @@ export type DescriptionMessages = {
12
13
  chip?: string;
13
14
  suffix?: string;
14
15
  };
15
- export declare function getDescriptionMessages(params: Params): DescriptionMessages;
16
+ export declare function getDescriptionMessages(params: Params, lang: FrequencyCappingLang): DescriptionMessages;
16
17
  export {};
@@ -1,66 +1,86 @@
1
1
  import { CappingTypes } from '../types';
2
2
  import { getCappingChipText } from './getCappingChipText';
3
- export function getDescriptionMessages(params) {
3
+ export function getDescriptionMessages(params, lang) {
4
4
  const {
5
5
  cappingOption
6
6
  } = params;
7
7
  if (cappingOption === CappingTypes.GLOBAL) {
8
- return getGlobalMessages(params);
8
+ return getGlobalMessages(params, lang);
9
9
  }
10
10
  if (cappingOption === CappingTypes.CUSTOM) {
11
- return getCustomMessages(params);
11
+ return getCustomMessages(params, lang);
12
12
  }
13
- return getIgnoreMessages();
13
+ return getIgnoreMessages(lang);
14
14
  }
15
15
  function getGlobalMessages({
16
16
  variant,
17
17
  messages,
18
18
  days,
19
19
  isInJourney
20
- }) {
20
+ }, lang) {
21
21
  const isUnset = messages === 0 && days === 0;
22
22
  if (variant === 'in-app') {
23
23
  if (isUnset) {
24
24
  return {
25
- prefix: 'This in-app will use a global frequency capping because limit isn’t set.'
25
+ prefix: lang({
26
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_INAPP_UNSET'
27
+ })
26
28
  };
27
29
  }
28
30
  return {
29
- prefix: 'Under the current setup, If the user receives more than',
30
- chip: getCappingChipText(messages, days, 'in-app'),
31
- suffix: 'this in-app will not be delivered.'
31
+ prefix: lang({
32
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_PREFIX'
33
+ }),
34
+ chip: getCappingChipText(lang, messages, days, 'in-app'),
35
+ suffix: lang({
36
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_INAPP_SUFFIX'
37
+ })
32
38
  };
33
39
  }
34
40
  if (isUnset) {
35
41
  return {
36
- prefix: 'This message will use an',
37
- chip: getCappingChipText(0, 0),
38
- suffix: 'global frequency capping because limit isn’t set.'
42
+ prefix: lang({
43
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_MSG_UNSET_PREFIX'
44
+ }),
45
+ chip: getCappingChipText(lang, 0, 0),
46
+ suffix: lang({
47
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_MSG_UNSET_SUFFIX'
48
+ })
39
49
  };
40
50
  }
41
- const journeySuffix = isInJourney ? ', and the user will proceed to the next step' : '';
42
51
  return {
43
- prefix: 'Under the current setup, If the user receives more than',
44
- chip: getCappingChipText(messages, days),
45
- suffix: `, this message will not be delivered${journeySuffix}.`
52
+ prefix: lang({
53
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_PREFIX'
54
+ }),
55
+ chip: getCappingChipText(lang, messages, days),
56
+ suffix: lang({
57
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_MSG_SUFFIX',
58
+ isInJourney
59
+ })
46
60
  };
47
61
  }
48
62
  function getCustomMessages({
49
63
  variant,
50
64
  isInJourney
51
- }) {
65
+ }, lang) {
52
66
  if (variant === 'in-app') {
53
67
  return {
54
- prefix: 'Instead of Global frequency capping, the limit of shown in-apps you set will be used. ' + 'If the subscriber exceeds the limit of received in-apps, they will not see the in-app again.'
68
+ prefix: lang({
69
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.CUSTOM_INAPP'
70
+ })
55
71
  };
56
72
  }
57
- const journeySuffix = isInJourney ? ', and will proceed to the next step' : '';
58
73
  return {
59
- prefix: '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${journeySuffix}.`
74
+ prefix: lang({
75
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.CUSTOM_MSG',
76
+ isInJourney
77
+ })
60
78
  };
61
79
  }
62
- function getIgnoreMessages() {
80
+ function getIgnoreMessages(lang) {
63
81
  return {
64
- prefix: '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.'
82
+ prefix: lang({
83
+ message: 'DUMB.FREQUENCY_CAPPING.DESC.IGNORE'
84
+ })
65
85
  };
66
86
  }
@@ -0,0 +1,2 @@
1
+ import { type FrequencyCappingLang } from '../polyglot';
2
+ export declare function getGlobalCappingLinkText(lang: FrequencyCappingLang, isGlobalCappingDisabled: boolean): string;
@@ -0,0 +1,7 @@
1
+ export function getGlobalCappingLinkText(lang, isGlobalCappingDisabled) {
2
+ return isGlobalCappingDisabled ? lang({
3
+ message: 'DUMB.FREQUENCY_CAPPING.LINK.SET_UP'
4
+ }) : lang({
5
+ message: 'DUMB.FREQUENCY_CAPPING.LINK.SETTINGS'
6
+ });
7
+ }
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
+ import { type FrequencyCappingLang } from '../polyglot';
2
3
  import { type CappingBase, CappingTypes } from '../types';
3
4
  export declare function getReadonlyCappingLabel<T extends CappingBase>(cappingOption: CappingTypes, isGlobalCappingDisabled: boolean, capping: T, globalCapping: {
4
5
  count: number;
5
6
  days: number;
6
- }, isInJourney: boolean): React.JSX.Element;
7
+ }, isInJourney: boolean, lang: FrequencyCappingLang): React.JSX.Element;