@pushwoosh/dumb-components 1.1.133 → 1.1.135

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 (139) hide show
  1. package/AccessForbidden/AccessForbidden.js +10 -2
  2. package/AccessForbidden/polyglot/index.d.ts +2 -0
  3. package/AccessForbidden/polyglot/index.js +10 -0
  4. package/AccessForbidden/polyglot/messages_en.d.ts +3 -0
  5. package/AccessForbidden/polyglot/messages_en.js +4 -0
  6. package/AccessForbidden/polyglot/messages_ru.d.ts +3 -0
  7. package/AccessForbidden/polyglot/messages_ru.js +4 -0
  8. package/AccessForbidden/polyglot/types.d.ts +5 -0
  9. package/AccessForbidden/polyglot/types.js +1 -0
  10. package/Calendar/CalendarDropdown/CalendarDropdown.js +15 -3
  11. package/Calendar/CalendarSuperForm/components/CalendarTimeAndTimezoneSection/CalendarTimeAndTimezoneSection.js +14 -4
  12. package/Calendar/polyglot/index.d.ts +2 -0
  13. package/Calendar/polyglot/index.js +10 -0
  14. package/Calendar/polyglot/messages_en.d.ts +3 -0
  15. package/Calendar/polyglot/messages_en.js +11 -0
  16. package/Calendar/polyglot/messages_ru.d.ts +3 -0
  17. package/Calendar/polyglot/messages_ru.js +11 -0
  18. package/Calendar/polyglot/types.d.ts +14 -0
  19. package/Calendar/polyglot/types.js +1 -0
  20. package/CrashScreen/CrashScreen.js +6 -1
  21. package/CrashScreen/polyglot/index.d.ts +2 -0
  22. package/CrashScreen/polyglot/index.js +10 -0
  23. package/CrashScreen/polyglot/messages_en.d.ts +3 -0
  24. package/CrashScreen/polyglot/messages_en.js +4 -0
  25. package/CrashScreen/polyglot/messages_ru.d.ts +3 -0
  26. package/CrashScreen/polyglot/messages_ru.js +4 -0
  27. package/CrashScreen/polyglot/types.d.ts +5 -0
  28. package/CrashScreen/polyglot/types.js +1 -0
  29. package/DateTimePicker/components/DatePickerField/DatePickerField.js +4 -1
  30. package/DateTimePicker/components/DateTimePickerField/DateTimePickerField.js +4 -1
  31. package/DateTimePicker/components/Month/Month.js +16 -1
  32. package/DateTimePicker/polyglot/index.d.ts +2 -0
  33. package/DateTimePicker/polyglot/index.js +9 -0
  34. package/DateTimePicker/polyglot/messages_en.d.ts +3 -0
  35. package/DateTimePicker/polyglot/messages_en.js +11 -0
  36. package/DateTimePicker/polyglot/messages_ru.d.ts +3 -0
  37. package/DateTimePicker/polyglot/messages_ru.js +11 -0
  38. package/DateTimePicker/polyglot/types.d.ts +12 -0
  39. package/DateTimePicker/polyglot/types.js +1 -0
  40. package/Drawer/components/DrawerDocs/DrawerDocs.js +9 -3
  41. package/Drawer/polyglot/index.d.ts +2 -0
  42. package/Drawer/polyglot/index.js +10 -0
  43. package/Drawer/polyglot/messages_en.d.ts +3 -0
  44. package/Drawer/polyglot/messages_en.js +4 -0
  45. package/Drawer/polyglot/messages_ru.d.ts +3 -0
  46. package/Drawer/polyglot/messages_ru.js +4 -0
  47. package/Drawer/polyglot/types.d.ts +5 -0
  48. package/Drawer/polyglot/types.js +1 -0
  49. package/EditableField/EditableField.js +7 -2
  50. package/EditableField/polyglot/index.d.ts +2 -0
  51. package/EditableField/polyglot/index.js +9 -0
  52. package/EditableField/polyglot/messages_en.d.ts +3 -0
  53. package/EditableField/polyglot/messages_en.js +4 -0
  54. package/EditableField/polyglot/messages_ru.d.ts +3 -0
  55. package/EditableField/polyglot/messages_ru.js +4 -0
  56. package/EditableField/polyglot/types.d.ts +5 -0
  57. package/EditableField/polyglot/types.js +1 -0
  58. package/EmailTemplatePreview/components/NoEmailTemplatePreview/NoEmailTemplatePreview.js +11 -3
  59. package/EmailTemplatePreview/polyglot/index.d.ts +2 -0
  60. package/EmailTemplatePreview/polyglot/index.js +10 -0
  61. package/EmailTemplatePreview/polyglot/messages_en.d.ts +3 -0
  62. package/EmailTemplatePreview/polyglot/messages_en.js +5 -0
  63. package/EmailTemplatePreview/polyglot/messages_ru.d.ts +3 -0
  64. package/EmailTemplatePreview/polyglot/messages_ru.js +5 -0
  65. package/EmailTemplatePreview/polyglot/types.d.ts +6 -0
  66. package/EmailTemplatePreview/polyglot/types.js +1 -0
  67. package/FrequencyCapping/FrequencyCappingEdit.js +7 -2
  68. package/FrequencyCapping/FrequencyCappingInApps.js +7 -2
  69. package/FrequencyCapping/FrequencyCappingReadonly.js +5 -2
  70. package/FrequencyCapping/components/Description/index.js +3 -1
  71. package/FrequencyCapping/components/Settings/EditCappingSettings.js +10 -3
  72. package/FrequencyCapping/components/Settings/EditInAppCappingSettings.js +25 -8
  73. package/FrequencyCapping/helpers/getCappingChipText.d.ts +2 -1
  74. package/FrequencyCapping/helpers/getCappingChipText.js +13 -15
  75. package/FrequencyCapping/helpers/getDescriptionMessages.d.ts +2 -1
  76. package/FrequencyCapping/helpers/getDescriptionMessages.js +42 -22
  77. package/FrequencyCapping/helpers/getGlobalCappingLinkText.d.ts +2 -0
  78. package/FrequencyCapping/helpers/getGlobalCappingLinkText.js +7 -0
  79. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.d.ts +2 -1
  80. package/FrequencyCapping/helpers/getReadonlyCappingHelpers.js +27 -15
  81. package/FrequencyCapping/polyglot/index.d.ts +4 -0
  82. package/FrequencyCapping/polyglot/index.js +10 -0
  83. package/FrequencyCapping/polyglot/messages_en.d.ts +3 -0
  84. package/FrequencyCapping/polyglot/messages_en.js +33 -0
  85. package/FrequencyCapping/polyglot/messages_ru.d.ts +3 -0
  86. package/FrequencyCapping/polyglot/messages_ru.js +33 -0
  87. package/FrequencyCapping/polyglot/types.d.ts +46 -0
  88. package/FrequencyCapping/polyglot/types.js +1 -0
  89. package/Modal/components/ModalConfirm/ModalConfirm.js +21 -8
  90. package/Modal/components/ModalConfirm/types.d.ts +1 -1
  91. package/Modal/polyglot/index.d.ts +2 -0
  92. package/Modal/polyglot/index.js +9 -0
  93. package/Modal/polyglot/messages_en.d.ts +3 -0
  94. package/Modal/polyglot/messages_en.js +6 -0
  95. package/Modal/polyglot/messages_ru.d.ts +3 -0
  96. package/Modal/polyglot/messages_ru.js +6 -0
  97. package/Modal/polyglot/types.d.ts +7 -0
  98. package/Modal/polyglot/types.js +1 -0
  99. package/NotificationInbox/NotificationBell.js +7 -1
  100. package/NotificationInbox/NotificationInbox.js +19 -5
  101. package/NotificationInbox/polyglot/index.d.ts +2 -0
  102. package/NotificationInbox/polyglot/index.js +10 -0
  103. package/NotificationInbox/polyglot/messages_en.d.ts +3 -0
  104. package/NotificationInbox/polyglot/messages_en.js +8 -0
  105. package/NotificationInbox/polyglot/messages_ru.d.ts +3 -0
  106. package/NotificationInbox/polyglot/messages_ru.js +8 -0
  107. package/NotificationInbox/polyglot/types.d.ts +11 -0
  108. package/NotificationInbox/polyglot/types.js +1 -0
  109. package/PushPreview/components/MissedContentPreview/MissedContentPreview.js +7 -2
  110. package/PushPreview/polyglot/index.d.ts +2 -0
  111. package/PushPreview/polyglot/index.js +9 -0
  112. package/PushPreview/polyglot/messages_en.d.ts +3 -0
  113. package/PushPreview/polyglot/messages_en.js +4 -0
  114. package/PushPreview/polyglot/messages_ru.d.ts +3 -0
  115. package/PushPreview/polyglot/messages_ru.js +4 -0
  116. package/PushPreview/polyglot/types.d.ts +5 -0
  117. package/PushPreview/polyglot/types.js +1 -0
  118. package/SendRate/SendRateEdit.js +7 -2
  119. package/SendRate/SendRateReadonly.js +5 -2
  120. package/SendRate/components/Condition/index.js +8 -1
  121. package/SendRate/components/Description/index.js +20 -6
  122. package/SendRate/components/Settings/index.js +7 -2
  123. package/SendRate/helpers/getGlobalSendRateLinkText.d.ts +2 -0
  124. package/SendRate/helpers/getGlobalSendRateLinkText.js +7 -0
  125. package/SendRate/helpers/getReadonlySendRateHelpers.d.ts +2 -1
  126. package/SendRate/helpers/getReadonlySendRateHelpers.js +20 -11
  127. package/SendRate/polyglot/index.d.ts +4 -0
  128. package/SendRate/polyglot/index.js +10 -0
  129. package/SendRate/polyglot/messages_en.d.ts +3 -0
  130. package/SendRate/polyglot/messages_en.js +20 -0
  131. package/SendRate/polyglot/messages_ru.d.ts +3 -0
  132. package/SendRate/polyglot/messages_ru.js +20 -0
  133. package/SendRate/polyglot/types.d.ts +23 -0
  134. package/SendRate/polyglot/types.js +1 -0
  135. package/package.json +1 -1
  136. package/polyglot/index.d.ts +1 -1
  137. package/polyglot/index.js +1 -1
  138. package/polyglot/react.d.ts +12 -2
  139. package/polyglot/react.js +80 -45
@@ -4,7 +4,9 @@ import { Vertical } from '@pushwoosh/kit-helpers';
4
4
  import { Text } from '@pushwoosh/kit-typography';
5
5
  import Email from './assets/email.svg?url';
6
6
  import { Container, PreviewMock } from './styles';
7
+ import { Lang, useLang } from '../../polyglot';
7
8
  export function NoEmailTemplatePreview() {
9
+ const lang = useLang();
8
10
  return React.createElement(Container, {
9
11
  "$padding": "12px 12px 24px",
10
12
  "$gap": 12
@@ -13,12 +15,18 @@ export function NoEmailTemplatePreview() {
13
15
  "$justifyContent": "center"
14
16
  }, React.createElement("img", {
15
17
  src: Email,
16
- alt: "Email envelop icon"
18
+ alt: lang({
19
+ message: 'DUMB.EMAIL_TEMPLATE_PREVIEW.ALT'
20
+ })
17
21
  })), React.createElement(Vertical, null, React.createElement(Text, {
18
22
  "$variant": "footnote",
19
23
  "$color": Color.LOCKED
20
- }, "Content missed..."), React.createElement(Text, {
24
+ }, React.createElement(Lang, {
25
+ message: "DUMB.EMAIL_TEMPLATE_PREVIEW.CONTENT_MISSED"
26
+ })), React.createElement(Text, {
21
27
  "$variant": "footnote",
22
28
  "$color": Color.LOCKED
23
- }, "Might be old data or deleted presets")));
29
+ }, React.createElement(Lang, {
30
+ message: "DUMB.EMAIL_TEMPLATE_PREVIEW.HINT"
31
+ }))));
24
32
  }
@@ -0,0 +1,2 @@
1
+ import { type EmailTemplatePreviewMessages } from './types';
2
+ export declare const Lang: import("react").FC<import("../../polyglot").LangProps<EmailTemplatePreviewMessages>>, useLang: () => (props: import("../../polyglot").LangProps<EmailTemplatePreviewMessages>) => 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 EmailTemplatePreviewMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<EmailTemplatePreviewMessages>;
@@ -0,0 +1,5 @@
1
+ export const messages = {
2
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.ALT': 'Email envelope icon',
3
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.CONTENT_MISSED': 'Content missed...',
4
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.HINT': 'Might be old data or deleted presets'
5
+ };
@@ -0,0 +1,3 @@
1
+ import { type EmailTemplatePreviewMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<EmailTemplatePreviewMessages>;
@@ -0,0 +1,5 @@
1
+ export const messages = {
2
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.ALT': 'Иконка конверта email',
3
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.CONTENT_MISSED': 'Контент отсутствует...',
4
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.HINT': 'Возможно, устаревшие данные или удалённые пресеты'
5
+ };
@@ -0,0 +1,6 @@
1
+ import type { NoParams } from '../../polyglot';
2
+ export type EmailTemplatePreviewMessages = {
3
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.ALT': NoParams;
4
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.CONTENT_MISSED': NoParams;
5
+ 'DUMB.EMAIL_TEMPLATE_PREVIEW.HINT': NoParams;
6
+ };
@@ -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;
@@ -6,11 +6,13 @@ import { Tooltip } from '../../Tooltip';
6
6
  import { ChipFrequencyCapping } from '../components/Condition';
7
7
  import { IconWrapper } from '../styles';
8
8
  import { CappingTypes } from '../types';
9
- export function getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled, capping, globalCapping, isInJourney) {
10
- const tooltip = getReadonlyTooltip(cappingOption, isInJourney);
9
+ export function getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled, capping, globalCapping, isInJourney, lang) {
10
+ const tooltip = getReadonlyTooltip(cappingOption, isInJourney, lang);
11
11
  if (cappingOption === CappingTypes.CUSTOM) {
12
- return React.createElement(React.Fragment, null, "Custom frequency capping for this message:", React.createElement(ChipFrequencyCapping, {
13
- text: getCappingChipText(capping.messages, capping.days),
12
+ return React.createElement(React.Fragment, null, lang({
13
+ message: 'DUMB.FREQUENCY_CAPPING.RO.CUSTOM_LABEL'
14
+ }), React.createElement(ChipFrequencyCapping, {
15
+ text: getCappingChipText(lang, capping.messages, capping.days),
14
16
  tooltip: tooltip
15
17
  }));
16
18
  }
@@ -19,7 +21,9 @@ export function getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled,
19
21
  "$alignItems": "center",
20
22
  "$gap": 4,
21
23
  "$justifyContent": "start"
22
- }, "Send messages without global frequency capping", React.createElement(Tooltip, {
24
+ }, lang({
25
+ message: 'DUMB.FREQUENCY_CAPPING.RO.IGNORE_LABEL'
26
+ }), React.createElement(Tooltip, {
23
27
  content: tooltip,
24
28
  position: "top-middle"
25
29
  }, React.createElement(IconWrapper, {
@@ -29,19 +33,27 @@ export function getReadonlyCappingLabel(cappingOption, isGlobalCappingDisabled,
29
33
  view: "lined"
30
34
  }))));
31
35
  }
32
- return isGlobalCappingDisabled ? React.createElement(React.Fragment, null, "Global frequency capping:", React.createElement(ChipFrequencyCapping, {
33
- text: getCappingChipText(0, 0)
34
- }), "because limit isn\u2019t set") : React.createElement(React.Fragment, null, "Global frequency capping:", React.createElement(ChipFrequencyCapping, {
35
- text: getCappingChipText(globalCapping.count, globalCapping.days),
36
+ return isGlobalCappingDisabled ? React.createElement(React.Fragment, null, lang({
37
+ message: 'DUMB.FREQUENCY_CAPPING.RO.GLOBAL_LABEL'
38
+ }), React.createElement(ChipFrequencyCapping, {
39
+ text: getCappingChipText(lang, 0, 0)
40
+ }), lang({
41
+ message: 'DUMB.FREQUENCY_CAPPING.RO.BECAUSE_UNSET'
42
+ })) : React.createElement(React.Fragment, null, lang({
43
+ message: 'DUMB.FREQUENCY_CAPPING.RO.GLOBAL_LABEL'
44
+ }), React.createElement(ChipFrequencyCapping, {
45
+ text: getCappingChipText(lang, globalCapping.count, globalCapping.days),
36
46
  tooltip: tooltip
37
47
  }));
38
48
  }
39
- function getReadonlyTooltip(cappingOption, isInJourney) {
40
- if (cappingOption === CappingTypes.CUSTOM) {
41
- return isInJourney ? 'If the subscriber exceeds the limit of received messages, they will not receive this message and will proceed to the next step' : 'If the subscriber exceeds the limit of received messages, they will not receive this message';
42
- }
49
+ function getReadonlyTooltip(cappingOption, isInJourney, lang) {
43
50
  if (cappingOption === CappingTypes.IGNORE) {
44
- return 'The user will receive this message regardless, even if they have exceeded the set limits for the channel';
51
+ return lang({
52
+ message: 'DUMB.FREQUENCY_CAPPING.RO.TOOLTIP_IGNORE'
53
+ });
45
54
  }
46
- return isInJourney ? 'If the subscriber exceeds the limit of received messages, they will not receive this message and will proceed to the next step' : 'If the subscriber exceeds the limit of received messages, they will not receive this message';
55
+ return lang({
56
+ message: 'DUMB.FREQUENCY_CAPPING.RO.TOOLTIP_LIMIT',
57
+ isInJourney
58
+ });
47
59
  }
@@ -0,0 +1,4 @@
1
+ import { type FrequencyCappingMessages } from './types';
2
+ import { type LangProps } from '../../polyglot';
3
+ export declare const Lang: import("react").FC<LangProps<FrequencyCappingMessages>>, useLang: () => (props: LangProps<FrequencyCappingMessages>) => string;
4
+ export type FrequencyCappingLang = (props: LangProps<FrequencyCappingMessages>) => 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 FrequencyCappingMessages } from './types';
2
+ import type { LangMessages } from '../../polyglot';
3
+ export declare const messages: LangMessages<FrequencyCappingMessages>;
@@ -0,0 +1,33 @@
1
+ export const messages = {
2
+ 'DUMB.FREQUENCY_CAPPING.FIELD_TITLE': 'Frequency capping',
3
+ 'DUMB.FREQUENCY_CAPPING.LINK.SET_UP': 'Set up',
4
+ 'DUMB.FREQUENCY_CAPPING.LINK.SETTINGS': 'Settings',
5
+ 'DUMB.FREQUENCY_CAPPING.SETTINGS.LIMIT_TO_MAX': 'Limit to a&nbsp;maximum&nbsp;of',
6
+ 'DUMB.FREQUENCY_CAPPING.SETTINGS.MESSAGES_PER': 'messages per',
7
+ 'DUMB.FREQUENCY_CAPPING.SETTINGS.DAYS': 'day(s)',
8
+ 'DUMB.FREQUENCY_CAPPING.INAPP.LIMIT_DESC': 'Limit frequency of displaying this In-App to a particular user',
9
+ 'DUMB.FREQUENCY_CAPPING.INAPP.LIMITED_TO': 'Limited to',
10
+ 'DUMB.FREQUENCY_CAPPING.INAPP.TOTAL_IMPRESSIONS': 'total impressions',
11
+ 'DUMB.FREQUENCY_CAPPING.INAPP.IMPRESSIONS_IN': 'impressions in',
12
+ 'DUMB.FREQUENCY_CAPPING.INAPP.DAYS': 'day(s)',
13
+ 'DUMB.FREQUENCY_CAPPING.INAPP.ENABLE': 'Enable',
14
+ 'DUMB.FREQUENCY_CAPPING.INAPP.DAYS_INTERVAL': 'day(s) interval between impressions',
15
+ 'DUMB.FREQUENCY_CAPPING.CHIP.UNLIMITED': 'unlimited',
16
+ 'DUMB.FREQUENCY_CAPPING.CHIP.MESSAGE': '{{count}} {{count | pluralize: "message", "messages"}} per {{days}} {{days | pluralize: "day", "days"}}',
17
+ 'DUMB.FREQUENCY_CAPPING.CHIP.INAPP': '{{count}} {{count | pluralize: "in-app", "in-apps"}} per {{days}} {{days | pluralize: "day", "days"}}',
18
+ 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_INAPP_UNSET': 'This in-app will use a global frequency capping because limit isn’t set.',
19
+ 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_PREFIX': 'Under the current setup, If the user receives more than',
20
+ 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_INAPP_SUFFIX': 'this in-app will not be delivered.',
21
+ 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_MSG_UNSET_PREFIX': 'This message will use an',
22
+ 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_MSG_UNSET_SUFFIX': 'global frequency capping because limit isn’t set.',
23
+ 'DUMB.FREQUENCY_CAPPING.DESC.GLOBAL_MSG_SUFFIX': ', this message will not be delivered{% if isInJourney == true %}, and the user will proceed to the next step{% endif %}.',
24
+ 'DUMB.FREQUENCY_CAPPING.DESC.CUSTOM_INAPP': '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.',
25
+ 'DUMB.FREQUENCY_CAPPING.DESC.CUSTOM_MSG': '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{% if isInJourney == true %}, and will proceed to the next step{% endif %}.',
26
+ 'DUMB.FREQUENCY_CAPPING.DESC.IGNORE': '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.',
27
+ 'DUMB.FREQUENCY_CAPPING.RO.CUSTOM_LABEL': 'Custom frequency capping for this message:',
28
+ 'DUMB.FREQUENCY_CAPPING.RO.IGNORE_LABEL': 'Send messages without global frequency capping',
29
+ 'DUMB.FREQUENCY_CAPPING.RO.GLOBAL_LABEL': 'Global frequency capping:',
30
+ 'DUMB.FREQUENCY_CAPPING.RO.BECAUSE_UNSET': 'because limit isn’t set',
31
+ 'DUMB.FREQUENCY_CAPPING.RO.TOOLTIP_LIMIT': 'If the subscriber exceeds the limit of received messages, they will not receive this message{% if isInJourney == true %} and will proceed to the next step{% endif %}',
32
+ 'DUMB.FREQUENCY_CAPPING.RO.TOOLTIP_IGNORE': 'The user will receive this message regardless, even if they have exceeded the set limits for the channel'
33
+ };