@pushwoosh/smart-components-kit 1.3.7 → 1.3.9
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/LanguagesSelector/LanguagesModal.d.ts +2 -0
- package/LanguagesSelector/LanguagesModal.js +4 -2
- package/LanguagesSelector/LanguagesSelectFormLoader.d.ts +2 -0
- package/LanguagesSelector/LanguagesSelectFormLoader.js +5 -3
- package/LanguagesSelector/LanguagesSelector.d.ts +3 -0
- package/LanguagesSelector/LanguagesSelector.js +3 -1
- package/LanguagesSelector/index.d.ts +1 -0
- package/LanguagesSelector/index.js +2 -1
- package/LanguagesSelector/platforms.d.ts +13 -0
- package/LanguagesSelector/platforms.js +14 -0
- package/Table/components/Loading/styles.js +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
+
import { type AllPlatforms } from '@pushwoosh/kit-constants';
|
|
2
3
|
type LanguagesModalProps = {
|
|
3
4
|
applicationCode: string;
|
|
4
5
|
initialLanguages: string[];
|
|
5
6
|
onSubmit: (languages: string[]) => void;
|
|
6
7
|
onClose: () => void;
|
|
8
|
+
platforms?: AllPlatforms[];
|
|
7
9
|
};
|
|
8
10
|
export declare const LanguagesModal: FC<LanguagesModalProps>;
|
|
9
11
|
export {};
|
|
@@ -9,7 +9,8 @@ export const LanguagesModal = ({
|
|
|
9
9
|
applicationCode,
|
|
10
10
|
initialLanguages,
|
|
11
11
|
onSubmit,
|
|
12
|
-
onClose
|
|
12
|
+
onClose,
|
|
13
|
+
platforms
|
|
13
14
|
}) => {
|
|
14
15
|
const lang = useLang();
|
|
15
16
|
const [selectedLanguages, setSelectedLanguages] = useState(initialLanguages);
|
|
@@ -24,7 +25,8 @@ export const LanguagesModal = ({
|
|
|
24
25
|
children: _jsx(LanguagesSelectFormLoader, {
|
|
25
26
|
application: applicationCode,
|
|
26
27
|
onChange: setSelectedLanguages,
|
|
27
|
-
value: selectedLanguages
|
|
28
|
+
value: selectedLanguages,
|
|
29
|
+
platforms: platforms
|
|
28
30
|
})
|
|
29
31
|
}), _jsx(ModalFooter, {
|
|
30
32
|
children: _jsxs(Horizontal, {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
+
import { type AllPlatforms } from '@pushwoosh/kit-constants';
|
|
2
3
|
type LanguagesSelectFormLoaderProps = {
|
|
3
4
|
application: string;
|
|
4
5
|
value: string[];
|
|
5
6
|
onChange: (languages: string[]) => void;
|
|
6
7
|
systemLanguage?: string;
|
|
8
|
+
platforms?: AllPlatforms[];
|
|
7
9
|
};
|
|
8
10
|
export declare const LanguagesSelectFormLoader: FC<LanguagesSelectFormLoaderProps>;
|
|
9
11
|
export {};
|
|
@@ -9,7 +9,8 @@ export const LanguagesSelectFormLoader = ({
|
|
|
9
9
|
application,
|
|
10
10
|
value,
|
|
11
11
|
onChange,
|
|
12
|
-
systemLanguage = 'en'
|
|
12
|
+
systemLanguage = 'en',
|
|
13
|
+
platforms
|
|
13
14
|
}) => {
|
|
14
15
|
const getLangName = useGetLangName(systemLanguage);
|
|
15
16
|
const {
|
|
@@ -20,7 +21,8 @@ export const LanguagesSelectFormLoader = ({
|
|
|
20
21
|
values
|
|
21
22
|
} = await rpcGateway.tags.GetTagValues({
|
|
22
23
|
application,
|
|
23
|
-
name: 'Language'
|
|
24
|
+
name: 'Language',
|
|
25
|
+
platforms
|
|
24
26
|
});
|
|
25
27
|
const valuesLangCodes = values.map(v => canonicalizeLangCode(v.value));
|
|
26
28
|
const allLangCodes = Array.from(new Set([...valuesLangCodes, ...langCodes.map(canonicalizeLangCode)]).values());
|
|
@@ -33,7 +35,7 @@ export const LanguagesSelectFormLoader = ({
|
|
|
33
35
|
name: getLangName(code),
|
|
34
36
|
subscribers: values.find(val => canonicalizeLangCode(val.value) === code)?.count || 0
|
|
35
37
|
}));
|
|
36
|
-
}, [application, getLangName, systemLanguage]);
|
|
38
|
+
}, [application, getLangName, systemLanguage, platforms]);
|
|
37
39
|
if (langAsync.loading) {
|
|
38
40
|
return _jsx(Horizontal, {
|
|
39
41
|
"$placeItems": "center",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
|
+
import { type AllPlatforms } from '@pushwoosh/kit-constants';
|
|
2
3
|
type SelectLanguageProps = {
|
|
3
4
|
applicationCode: string;
|
|
4
5
|
value: string;
|
|
@@ -6,6 +7,8 @@ type SelectLanguageProps = {
|
|
|
6
7
|
isDisabled?: boolean;
|
|
7
8
|
onChange: (language: string) => void;
|
|
8
9
|
onChangeLanguages: (languages: string[]) => void;
|
|
10
|
+
/** Count subscribers on these platforms only; see LANGUAGE_PLATFORMS. */
|
|
11
|
+
platforms?: AllPlatforms[];
|
|
9
12
|
};
|
|
10
13
|
export declare const LanguagesSelector: FC<SelectLanguageProps>;
|
|
11
14
|
export {};
|
|
@@ -13,7 +13,8 @@ export const LanguagesSelector = ({
|
|
|
13
13
|
languages,
|
|
14
14
|
isDisabled,
|
|
15
15
|
onChange,
|
|
16
|
-
onChangeLanguages
|
|
16
|
+
onChangeLanguages,
|
|
17
|
+
platforms
|
|
17
18
|
}) => {
|
|
18
19
|
const [showLanguagesModal, setShowLanguagesModal] = useState(false);
|
|
19
20
|
const lang = useLang();
|
|
@@ -107,6 +108,7 @@ export const LanguagesSelector = ({
|
|
|
107
108
|
children: _jsx(LanguagesModal, {
|
|
108
109
|
applicationCode: applicationCode,
|
|
109
110
|
initialLanguages: languages,
|
|
111
|
+
platforms: platforms,
|
|
110
112
|
onSubmit: langs => {
|
|
111
113
|
onChangeLanguages(langs);
|
|
112
114
|
setShowLanguagesModal(false);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { LanguagesSelector } from './LanguagesSelector';
|
|
1
|
+
export { LanguagesSelector } from './LanguagesSelector';
|
|
2
|
+
export { LANGUAGE_PLATFORMS } from './platforms';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AllPlatforms } from '@pushwoosh/kit-constants';
|
|
2
|
+
/**
|
|
3
|
+
* Platforms a channel delivers to, so its language list counts only those
|
|
4
|
+
* devices. Wallet passes are out of inApp: they render no in-app content.
|
|
5
|
+
*/
|
|
6
|
+
export declare const LANGUAGE_PLATFORMS: {
|
|
7
|
+
email: AllPlatforms.Email[];
|
|
8
|
+
sms: AllPlatforms.SMS[];
|
|
9
|
+
line: AllPlatforms.Line[];
|
|
10
|
+
whatsApp: AllPlatforms.WhatsApp[];
|
|
11
|
+
push: AllPlatforms[];
|
|
12
|
+
inApp: (AllPlatforms.IOS | AllPlatforms.Blackberry | AllPlatforms.Android | AllPlatforms.Asha | AllPlatforms.WindowsPhone | AllPlatforms.Bada | AllPlatforms.OSX | AllPlatforms.Windows | AllPlatforms.Amazon | AllPlatforms.Safari | AllPlatforms.Chrome | AllPlatforms.Firefox | AllPlatforms.IE | AllPlatforms.Email | AllPlatforms.FBMessenger | AllPlatforms.BaiduAndroid | AllPlatforms.HuaweiAndroid | AllPlatforms.SMS | AllPlatforms.Xiaomi | AllPlatforms.Web | AllPlatforms.WhatsApp | AllPlatforms.Line | AllPlatforms.KakaoTalk | AllPlatforms.Telegram | AllPlatforms.Viber)[];
|
|
13
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AllPlatforms } from '@pushwoosh/kit-constants';
|
|
2
|
+
const PUSH_PLATFORMS = [AllPlatforms.IOS, AllPlatforms.Android, AllPlatforms.HuaweiAndroid, AllPlatforms.BaiduAndroid, AllPlatforms.Amazon, AllPlatforms.OSX, AllPlatforms.Windows, AllPlatforms.Safari, AllPlatforms.Chrome, AllPlatforms.Firefox, AllPlatforms.IE, AllPlatforms.Web, AllPlatforms.AppleWallet, AllPlatforms.GoogleWallet];
|
|
3
|
+
/**
|
|
4
|
+
* Platforms a channel delivers to, so its language list counts only those
|
|
5
|
+
* devices. Wallet passes are out of inApp: they render no in-app content.
|
|
6
|
+
*/
|
|
7
|
+
export const LANGUAGE_PLATFORMS = {
|
|
8
|
+
email: [AllPlatforms.Email],
|
|
9
|
+
sms: [AllPlatforms.SMS],
|
|
10
|
+
line: [AllPlatforms.Line],
|
|
11
|
+
whatsApp: [AllPlatforms.WhatsApp],
|
|
12
|
+
push: PUSH_PLATFORMS,
|
|
13
|
+
inApp: PUSH_PLATFORMS.filter(platform => platform !== AllPlatforms.AppleWallet && platform !== AllPlatforms.GoogleWallet)
|
|
14
|
+
};
|
|
@@ -3,4 +3,4 @@ import { Color, FontSize } from '@pushwoosh/kit-constants';
|
|
|
3
3
|
export const Wrapper = styled.div.withConfig({
|
|
4
4
|
displayName: "Wrapper",
|
|
5
5
|
componentId: "sc-x57qck-0"
|
|
6
|
-
})(["position:relative;font-size:", ";line-height:12px;background-color:", ";& > div{height:52px;border-bottom:1px solid ", ";& > div{transition:width 200ms linear;}}&:after{content:'';position:absolute;left:0;right:0;top:0;bottom:0;background-image:linear-gradient(to bottom,
|
|
6
|
+
})(["position:relative;font-size:", ";line-height:12px;background-color:", ";& > div{height:52px;border-bottom:1px solid ", ";& > div{transition:width 200ms linear;}}&:after{content:'';position:absolute;left:0;right:0;top:0;bottom:0;background-image:linear-gradient(to bottom,hsl(from ", " h s l / 0),hsl(from ", " h s l / 0.9));}"], FontSize.SMALL, Color.CLEAR, Color.DIVIDER, Color.CLEAR, Color.CLEAR);
|
package/package.json
CHANGED
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@floating-ui/react-dom": "^2.1.2",
|
|
27
|
-
"@pushwoosh/dumb-components": "^1.1.
|
|
28
|
-
"@pushwoosh/kit-constants": "^1.
|
|
27
|
+
"@pushwoosh/dumb-components": "^1.1.192",
|
|
28
|
+
"@pushwoosh/kit-constants": "^1.10.0",
|
|
29
29
|
"@pushwoosh/kit-helpers": "^4.12.0",
|
|
30
30
|
"@pushwoosh/kit-icons": "^2.1.22",
|
|
31
31
|
"@pushwoosh/kit-typography": "^1.7.6",
|
|
32
|
-
"@pushwoosh/rpc-v2-http-api-data": "^0.2.
|
|
32
|
+
"@pushwoosh/rpc-v2-http-api-data": "^0.2.114",
|
|
33
33
|
"@pushwoosh/spa-context": "^1.7.1",
|
|
34
34
|
"idb-keyval": "^6.2.2",
|
|
35
35
|
"react-hook-form": "^7.68.0",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"react": "^16.14.0 || ^18.0.0",
|
|
53
53
|
"react-dom": "^16.14.0 || ^18.0.0"
|
|
54
54
|
},
|
|
55
|
-
"version": "1.3.
|
|
55
|
+
"version": "1.3.9"
|
|
56
56
|
}
|