cozy-ui 88.1.1 → 88.2.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [88.2.1](https://github.com/cozy/cozy-ui/compare/v88.2.0...v88.2.1) (2023-07-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **InstallFlagshipAppDialog:** Assets were not in the good directory ([512bcef](https://github.com/cozy/cozy-ui/commit/512bcef))
7
+
8
+ # [88.2.0](https://github.com/cozy/cozy-ui/compare/v88.1.1...v88.2.0) (2023-07-05)
9
+
10
+
11
+ ### Features
12
+
13
+ * **InstallFlagshipAppDialog:** Add InstallFlagshipAppDialog new component ([6c984e9](https://github.com/cozy/cozy-ui/commit/6c984e9))
14
+
1
15
  ## [88.1.1](https://github.com/cozy/cozy-ui/compare/v88.1.0...v88.1.1) (2023-06-30)
2
16
 
3
17
 
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "88.1.1",
3
+ "version": "88.2.1",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -0,0 +1,80 @@
1
+ import React, { forwardRef } from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import { IllustrationDialog } from '..'
5
+ import { useI18n } from '../../I18n'
6
+ import Link from '../../Link'
7
+ import Typography from '../../Typography'
8
+
9
+ import DefaultQRCode from 'cozy-ui/assets/images/QRCodeInstallFlagshipAppDialog.png'
10
+ import appStoreIcon from 'cozy-ui/assets/images/appstore.png'
11
+ import playStoreIcon from 'cozy-ui/assets/images/playstore.png'
12
+ import withSpecificDialogsLocales from './withSpecificDialogsLocales'
13
+
14
+ const InstallFlagshipAppDialog = forwardRef(
15
+ ({ onClose, playStoreUrl, appStoreUrl, QRCode }, ref) => {
16
+ const { t } = useI18n()
17
+
18
+ return (
19
+ <IllustrationDialog
20
+ open
21
+ ref={ref}
22
+ size="small"
23
+ onClose={onClose}
24
+ componentsProps={{ dialogTitle: { className: 'u-pt-2-half' } }}
25
+ title={
26
+ <Link
27
+ href={`https://cozy.io/download`}
28
+ target="_blank"
29
+ rel="noopener noreferrer"
30
+ >
31
+ <img src={QRCode} width="100%" alt="" aria-hidden />
32
+ <span className="u-visuallyhidden">
33
+ {t('install-flagship-app-dialog.a11n')}
34
+ </span>
35
+ </Link>
36
+ }
37
+ content={
38
+ <div className="u-ta-center">
39
+ <Typography gutterBottom variant="h3" color="textPrimary">
40
+ {t('install-flagship-app-dialog.title')}
41
+ </Typography>
42
+ <Typography
43
+ color="textSecondary"
44
+ className="u-ta-center"
45
+ dangerouslySetInnerHTML={{
46
+ __html: t('install-flagship-app-dialog.text', {
47
+ androidUrl: playStoreUrl,
48
+ androidIconSrc: playStoreIcon,
49
+ iosUrl: appStoreUrl,
50
+ iosIconSrc: appStoreIcon
51
+ })
52
+ }}
53
+ />
54
+ </div>
55
+ }
56
+ />
57
+ )
58
+ }
59
+ )
60
+
61
+ InstallFlagshipAppDialog.propTypes = {
62
+ onClose: PropTypes.func,
63
+ /** Url to the Play Store link in the dialog description */
64
+ playStoreUrl: PropTypes.string,
65
+ /** Url to the App Store link in the dialog description */
66
+ appStoreUrl: PropTypes.string,
67
+ /** An image representing a QR code to a link where you can download the flagship app */
68
+ QRCode: PropTypes.any
69
+ }
70
+
71
+ InstallFlagshipAppDialog.defaultProps = {
72
+ playStoreUrl:
73
+ 'https://play.google.com/store/apps/details?id=io.cozy.flagship.mobile',
74
+ appStoreUrl: 'https://apps.apple.com/app/my-cozy/id1600636174',
75
+ QRCode: DefaultQRCode
76
+ }
77
+
78
+ InstallFlagshipAppDialog.displayName = 'InstallFlagshipAppDialog'
79
+
80
+ export default withSpecificDialogsLocales(InstallFlagshipAppDialog)
@@ -0,0 +1,23 @@
1
+ ### InstallFlagshipApp dialog
2
+
3
+ You can customize links and image with `playStoreUrl`, `appStoreUrl` and `QRCode` props.
4
+
5
+ ```jsx
6
+ import { useState } from 'react';
7
+
8
+ import DemoProvider from 'cozy-ui/docs/components/DemoProvider';
9
+ import { InstallFlagshipAppDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
10
+ import Buttons from 'cozy-ui/transpiled/react/Buttons';
11
+
12
+ const [open, setOpen] = useState(isTesting());
13
+
14
+
15
+ <DemoProvider>
16
+ { open && (
17
+ <InstallFlagshipAppDialog
18
+ onClose={() => { setOpen(false)}}
19
+ />
20
+ )}
21
+ <Buttons onClick={() => { setOpen(true) }} label="Open InstallFlagshipAppDialog" />
22
+ </DemoProvider>
23
+ ```
@@ -0,0 +1 @@
1
+ export { default as InstallFlagshipAppDialog } from './InstallFlagshipAppDialog'
@@ -0,0 +1,7 @@
1
+ {
2
+ "install-flagship-app-dialog": {
3
+ "title": "Scan the QR Code",
4
+ "text": "or go directly to the <img src=%{iosIconSrc} /> <a href='%{iosUrl}' class='u-link' target='_blank' rel='noopener'>App Store</a><br>or <img src=%{androidIconSrc} /> <a href='%{androidUrl}' class='u-link' target='_blank' rel='noopener'>Play Store</a> to install the Cozy Cloud app",
5
+ "a11n": "Go to the Cozy Cloud application download page"
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "install-flagship-app-dialog": {
3
+ "title": "Scannez le QR Code",
4
+ "text": "ou rendez vous directement sur <img src=%{iosIconSrc} /> <a href='%{iosUrl}' class='u-link' target='_blank' rel='noopener'>l’App Store</a><br>ou sur le <img src=%{androidIconSrc} /> <a href='%{androidUrl}' class='u-link' target='_blank' rel='noopener'>Play Store</a> pour installer l’app Cloud Personnel Cozy",
5
+ "a11n": "Aller sur la page de téléchargement de l'application Cloud Personnel Cozy"
6
+ }
7
+ }
@@ -0,0 +1,11 @@
1
+ import withOnlyLocales from '../../I18n/withOnlyLocales'
2
+
3
+ import en from './locales/en.json'
4
+ import fr from './locales/fr.json'
5
+
6
+ export const locales = {
7
+ en,
8
+ fr
9
+ }
10
+
11
+ export default withOnlyLocales(locales)
@@ -8,3 +8,4 @@ export { default as FixedDialog } from './FixedDialog'
8
8
  export { default as IllustrationDialog } from './IllustrationDialog'
9
9
  export { default as useCozyDialog } from './useCozyDialog'
10
10
  export { default as TopAnchoredDialog } from './TopAnchoredDialog'
11
+ export { InstallFlagshipAppDialog } from './SpecificDialogs'
@@ -1,4 +1,7 @@
1
- A paywall is a modal designed to restrict access to a feature to encourage upgrading. There is different variant for each features so the wording can be different to adapt to the context of use.
1
+ A paywall is a modal designed to restrict access to a feature to encourage upgrading.
2
+ There is different variant for each features so the wording can be different to adapt to the context of use.
3
+
4
+ On mobile devices, we display "I understand" instead of the action button label for reasons of compatibility with the mobile application store.
2
5
 
3
6
  ### Variants
4
7
 
@@ -0,0 +1,26 @@
1
+ ### Create new variant
2
+
3
+ A new variant is essentially a set of translations adapted to a specific context of use.
4
+
5
+ To create a new one, add your translation to the `src/react/Paywall/locales` directory. The translations for each case (default, premium or public) are grouped together under the name of your variant. A case includes a title, content and a label for the action.
6
+ ```static
7
+ "variantNamePaywall": {
8
+ "premium": {
9
+ "title": "Upgrade your Cozy!",
10
+ "content": "Your offer allows you to connect %{max} in your Cozy. \n \nTo unlock this feature, or simply support us, you can change your Cozy offer.",
11
+ "action": "Check our plans"
12
+ },
13
+ ...otherCase
14
+ }
15
+ ```
16
+
17
+ Next, we create a new component returning the `Paywall`, specifying the name of the new variant. You can also use `contentInterpolation` to insert variables into the content translation.
18
+ ```js static
19
+ <Paywall
20
+ variant="variantName"
21
+ contentInterpolation={{
22
+ max: 10
23
+ }}
24
+ onClose={onClose}
25
+ />
26
+ ```
@@ -0,0 +1,80 @@
1
+ import React, { forwardRef } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { IllustrationDialog } from "cozy-ui/transpiled/react/CozyDialogs";
4
+ import { useI18n } from "cozy-ui/transpiled/react/I18n";
5
+ import Link from "cozy-ui/transpiled/react/Link";
6
+ import Typography from "cozy-ui/transpiled/react/Typography";
7
+ import DefaultQRCode from 'cozy-ui/assets/images/QRCodeInstallFlagshipAppDialog.png';
8
+ import appStoreIcon from 'cozy-ui/assets/images/appstore.png';
9
+ import playStoreIcon from 'cozy-ui/assets/images/playstore.png';
10
+ import withSpecificDialogsLocales from "cozy-ui/transpiled/react/CozyDialogs/SpecificDialogs/withSpecificDialogsLocales";
11
+ var InstallFlagshipAppDialog = /*#__PURE__*/forwardRef(function (_ref, ref) {
12
+ var onClose = _ref.onClose,
13
+ playStoreUrl = _ref.playStoreUrl,
14
+ appStoreUrl = _ref.appStoreUrl,
15
+ QRCode = _ref.QRCode;
16
+
17
+ var _useI18n = useI18n(),
18
+ t = _useI18n.t;
19
+
20
+ return /*#__PURE__*/React.createElement(IllustrationDialog, {
21
+ open: true,
22
+ ref: ref,
23
+ size: "small",
24
+ onClose: onClose,
25
+ componentsProps: {
26
+ dialogTitle: {
27
+ className: 'u-pt-2-half'
28
+ }
29
+ },
30
+ title: /*#__PURE__*/React.createElement(Link, {
31
+ href: "https://cozy.io/download",
32
+ target: "_blank",
33
+ rel: "noopener noreferrer"
34
+ }, /*#__PURE__*/React.createElement("img", {
35
+ src: QRCode,
36
+ width: "100%",
37
+ alt: "",
38
+ "aria-hidden": true
39
+ }), /*#__PURE__*/React.createElement("span", {
40
+ className: "u-visuallyhidden"
41
+ }, t('install-flagship-app-dialog.a11n'))),
42
+ content: /*#__PURE__*/React.createElement("div", {
43
+ className: "u-ta-center"
44
+ }, /*#__PURE__*/React.createElement(Typography, {
45
+ gutterBottom: true,
46
+ variant: "h3",
47
+ color: "textPrimary"
48
+ }, t('install-flagship-app-dialog.title')), /*#__PURE__*/React.createElement(Typography, {
49
+ color: "textSecondary",
50
+ className: "u-ta-center",
51
+ dangerouslySetInnerHTML: {
52
+ __html: t('install-flagship-app-dialog.text', {
53
+ androidUrl: playStoreUrl,
54
+ androidIconSrc: playStoreIcon,
55
+ iosUrl: appStoreUrl,
56
+ iosIconSrc: appStoreIcon
57
+ })
58
+ }
59
+ }))
60
+ });
61
+ });
62
+ InstallFlagshipAppDialog.propTypes = {
63
+ onClose: PropTypes.func,
64
+
65
+ /** Url to the Play Store link in the dialog description */
66
+ playStoreUrl: PropTypes.string,
67
+
68
+ /** Url to the App Store link in the dialog description */
69
+ appStoreUrl: PropTypes.string,
70
+
71
+ /** An image representing a QR code to a link where you can download the flagship app */
72
+ QRCode: PropTypes.any
73
+ };
74
+ InstallFlagshipAppDialog.defaultProps = {
75
+ playStoreUrl: 'https://play.google.com/store/apps/details?id=io.cozy.flagship.mobile',
76
+ appStoreUrl: 'https://apps.apple.com/app/my-cozy/id1600636174',
77
+ QRCode: DefaultQRCode
78
+ };
79
+ InstallFlagshipAppDialog.displayName = 'InstallFlagshipAppDialog';
80
+ export default withSpecificDialogsLocales(InstallFlagshipAppDialog);
@@ -0,0 +1 @@
1
+ export { default as InstallFlagshipAppDialog } from './InstallFlagshipAppDialog';
@@ -0,0 +1,20 @@
1
+ import withOnlyLocales from "cozy-ui/transpiled/react/I18n/withOnlyLocales";
2
+ var en = {
3
+ "install-flagship-app-dialog": {
4
+ title: "Scan the QR Code",
5
+ text: "or go directly to the <img src=%{iosIconSrc} /> <a href='%{iosUrl}' class='u-link' target='_blank' rel='noopener'>App Store</a><br>or <img src=%{androidIconSrc} /> <a href='%{androidUrl}' class='u-link' target='_blank' rel='noopener'>Play Store</a> to install the Cozy Cloud app",
6
+ a11n: "Go to the Cozy Cloud application download page"
7
+ }
8
+ };
9
+ var fr = {
10
+ "install-flagship-app-dialog": {
11
+ title: "Scannez le QR Code",
12
+ text: "ou rendez vous directement sur <img src=%{iosIconSrc} /> <a href='%{iosUrl}' class='u-link' target='_blank' rel='noopener'>l\u2019App Store</a><br>ou sur le <img src=%{androidIconSrc} /> <a href='%{androidUrl}' class='u-link' target='_blank' rel='noopener'>Play Store</a> pour installer l\u2019app Cloud Personnel Cozy",
13
+ a11n: "Aller sur la page de t\xE9l\xE9chargement de l'application Cloud Personnel Cozy"
14
+ }
15
+ };
16
+ export var locales = {
17
+ en: en,
18
+ fr: fr
19
+ };
20
+ export default withOnlyLocales(locales);
@@ -6,4 +6,5 @@ export { default as FixedActionsDialog } from './FixedActionsDialog';
6
6
  export { default as FixedDialog } from './FixedDialog';
7
7
  export { default as IllustrationDialog } from './IllustrationDialog';
8
8
  export { default as useCozyDialog } from './useCozyDialog';
9
- export { default as TopAnchoredDialog } from './TopAnchoredDialog';
9
+ export { default as TopAnchoredDialog } from './TopAnchoredDialog';
10
+ export { InstallFlagshipAppDialog } from './SpecificDialogs';