cozy-sharing 16.15.1 → 16.17.0

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
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [16.17.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.16.0...cozy-sharing@16.17.0) (2024-12-12)
7
+
8
+
9
+ ### Features
10
+
11
+ * **cozy-sharing:** Add isShortLabel prop to OpenSharing's buttons ([1085567](https://github.com/cozy/cozy-libs/commit/108556765800f6972a6b4c801fa09fd7c5d08c65))
12
+
13
+
14
+
15
+
16
+
17
+ # [16.16.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.15.1...cozy-sharing@16.16.0) (2024-12-12)
18
+
19
+
20
+ ### Features
21
+
22
+ * **cozy-sharing:** Add conditionnal prop to openSharingLink action ([ec2a8be](https://github.com/cozy/cozy-libs/commit/ec2a8be595215745e85ae0cc1e9b7493e2c5b8a4))
23
+
24
+
25
+
26
+
27
+
6
28
  ## [16.15.1](https://github.com/cozy/cozy-libs/compare/cozy-sharing@16.15.0...cozy-sharing@16.15.1) (2024-12-11)
7
29
 
8
30
 
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- var _excluded = ["link", "isSharingShortcutCreated"];
3
+ var _excluded = ["link", "isSharingShortcutCreated", "isShortLabel"];
4
4
  import PropTypes from 'prop-types';
5
5
  import React from 'react';
6
6
  import Button from 'cozy-ui/transpiled/react/Buttons';
@@ -15,6 +15,7 @@ import withLocales from './hoc/withLocales';
15
15
  * @param {Object} props - The props for the component.
16
16
  * @param {string} props.link - The URL to be opened when the button is clicked.
17
17
  * @param {boolean} [props.isSharingShortcutCreated=false] - Indicates if a sharing shortcut has been created. (default false)
18
+ * @param {boolean} [props.isShortLabel] - Display a short label for the button.
18
19
  * @param {Object} [props] - Additional props to be passed to the Button component.
19
20
  */
20
21
 
@@ -22,6 +23,8 @@ var OpenSharingLinkButton = function OpenSharingLinkButton(_ref) {
22
23
  var link = _ref.link,
23
24
  _ref$isSharingShortcu = _ref.isSharingShortcutCreated,
24
25
  isSharingShortcutCreated = _ref$isSharingShortcu === void 0 ? false : _ref$isSharingShortcu,
26
+ _ref$isShortLabel = _ref.isShortLabel,
27
+ isShortLabel = _ref$isShortLabel === void 0 ? false : _ref$isShortLabel,
25
28
  props = _objectWithoutProperties(_ref, _excluded);
26
29
 
27
30
  var _useI18n = useI18n(),
@@ -34,6 +37,7 @@ var OpenSharingLinkButton = function OpenSharingLinkButton(_ref) {
34
37
  var _getIconWithlabel = getIconWithlabel({
35
38
  link: link,
36
39
  isSharingShortcutCreated: isSharingShortcutCreated,
40
+ isShortLabel: isShortLabel,
37
41
  t: t
38
42
  }),
39
43
  icon = _getIconWithlabel.icon,
@@ -50,6 +54,7 @@ var OpenSharingLinkButton = function OpenSharingLinkButton(_ref) {
50
54
 
51
55
  OpenSharingLinkButton.propTypes = {
52
56
  link: PropTypes.string,
53
- isSharingShortcutCreated: PropTypes.bool
57
+ isSharingShortcutCreated: PropTypes.bool,
58
+ isShortLabel: PropTypes.bool
54
59
  };
55
60
  export default withLocales(OpenSharingLinkButton);
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/extends";
2
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
4
4
  var _excluded = ["position", "right", "bottom"],
5
- _excluded2 = ["link", "isSharingShortcutCreated"],
5
+ _excluded2 = ["link", "isSharingShortcutCreated", "isShortLabel"],
6
6
  _excluded3 = ["style"];
7
7
 
8
8
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -35,6 +35,7 @@ var makeStyles = function makeStyles(customStyle) {
35
35
  * @param {Object} props - The props for the component.
36
36
  * @param {string} props.link - The URL to be opened when the button is clicked.
37
37
  * @param {boolean} [props.isSharingShortcutCreated=false] - Indicates if a sharing shortcut has been created. (default false)
38
+ * @param {boolean} [props.isShortLabel] - Display a short label for the button.
38
39
  * @param {Object} [props] - Additional props to be passed to the ExtendableFab component.
39
40
  */
40
41
 
@@ -43,6 +44,7 @@ var OpenSharingLinkFabButton = function OpenSharingLinkFabButton(_ref) {
43
44
  var link = _ref.link,
44
45
  _ref$isSharingShortcu = _ref.isSharingShortcutCreated,
45
46
  isSharingShortcutCreated = _ref$isSharingShortcu === void 0 ? false : _ref$isSharingShortcu,
47
+ isShortLabel = _ref.isShortLabel,
46
48
  props = _objectWithoutProperties(_ref, _excluded2);
47
49
 
48
50
  var _props$style = props.style,
@@ -61,6 +63,7 @@ var OpenSharingLinkFabButton = function OpenSharingLinkFabButton(_ref) {
61
63
  var _getIconWithlabel = getIconWithlabel({
62
64
  link: link,
63
65
  isSharingShortcutCreated: isSharingShortcutCreated,
66
+ isShortLabel: isShortLabel,
64
67
  t: t
65
68
  }),
66
69
  icon = _getIconWithlabel.icon,
@@ -78,6 +81,7 @@ var OpenSharingLinkFabButton = function OpenSharingLinkFabButton(_ref) {
78
81
 
79
82
  OpenSharingLinkFabButton.propTypes = {
80
83
  link: PropTypes.string.isRequired,
81
- isSharingShortcutCreated: PropTypes.bool
84
+ isSharingShortcutCreated: PropTypes.bool,
85
+ isShortLabel: PropTypes.bool
82
86
  };
83
87
  export default withLocales(OpenSharingLinkFabButton);
@@ -23,6 +23,10 @@ var makeComponent = function makeComponent(label, icon) {
23
23
 
24
24
  export var openSharingLink = function openSharingLink(_ref) {
25
25
  var isSharingShortcutCreated = _ref.isSharingShortcutCreated,
26
+ _ref$openSharingLinkD = _ref.openSharingLinkDisplayed,
27
+ openSharingLinkDisplayed = _ref$openSharingLinkD === void 0 ? true : _ref$openSharingLinkD,
28
+ _ref$isShortLabel = _ref.isShortLabel,
29
+ isShortLabel = _ref$isShortLabel === void 0 ? false : _ref$isShortLabel,
26
30
  link = _ref.link;
27
31
 
28
32
  var _getActionsI18n = getActionsI18n(),
@@ -31,6 +35,7 @@ export var openSharingLink = function openSharingLink(_ref) {
31
35
  var _getIconWithlabel = getIconWithlabel({
32
36
  link: link,
33
37
  isSharingShortcutCreated: isSharingShortcutCreated,
38
+ isShortLabel: isShortLabel,
34
39
  t: t
35
40
  }),
36
41
  icon = _getIconWithlabel.icon,
@@ -40,6 +45,9 @@ export var openSharingLink = function openSharingLink(_ref) {
40
45
  name: 'openSharingLink',
41
46
  label: label,
42
47
  icon: icon,
48
+ displayCondition: function displayCondition() {
49
+ return openSharingLinkDisplayed;
50
+ },
43
51
  action: function action() {
44
52
  openExternalLink(link);
45
53
  },
@@ -66,11 +66,15 @@ var SharingBannerCozyToCozy = function SharingBannerCozyToCozy(_ref2) {
66
66
  };
67
67
 
68
68
  var buttonOne = isSharingShortcutCreated ? {
69
- label: t('Share.banner.sync_to_mine'),
69
+ label: t('Share.banner.sync_to_mine', {
70
+ smart_count: 2
71
+ }),
70
72
  icon: 'sync-cozy',
71
73
  action: action
72
74
  } : {
73
- label: t('Share.banner.add_to_mine'),
75
+ label: t('Share.banner.add_to_mine', {
76
+ smart_count: 2
77
+ }),
74
78
  icon: 'to-the-cloud',
75
79
  action: action
76
80
  };
@@ -124,7 +128,9 @@ var SharingBannerByLink = function SharingBannerByLink(_ref3) {
124
128
  buttonOne: /*#__PURE__*/React.createElement(Button, {
125
129
  component: "a",
126
130
  variant: "text",
127
- label: t('Share.create-cozy'),
131
+ label: t('Share.create-cozy', {
132
+ smart_count: 2
133
+ }),
128
134
  icon: CozyHomeLinkIcon,
129
135
  href: HOME_LINK_HREF
130
136
  }),
@@ -130,24 +130,31 @@ export var openExternalLink = function openExternalLink(url) {
130
130
  export var getIconWithlabel = function getIconWithlabel(_ref4) {
131
131
  var link = _ref4.link,
132
132
  isSharingShortcutCreated = _ref4.isSharingShortcutCreated,
133
+ isShortLabel = _ref4.isShortLabel,
133
134
  t = _ref4.t;
134
135
 
135
136
  if (link === CREATE_COZY_HREF) {
136
137
  return {
137
138
  icon: ToTheCloudIcon,
138
- label: t('Share.create-cozy')
139
+ label: t('Share.create-cozy', {
140
+ smart_count: isShortLabel ? 1 : 2
141
+ })
139
142
  };
140
143
  }
141
144
 
142
145
  if (!isSharingShortcutCreated) {
143
146
  return {
144
147
  icon: CloudPlusOutlinedIcon,
145
- label: t('Share.banner.add_to_mine')
148
+ label: t('Share.banner.add_to_mine', {
149
+ smart_count: isShortLabel ? 1 : 2
150
+ })
146
151
  };
147
152
  }
148
153
 
149
154
  return {
150
155
  icon: SyncIcon,
151
- label: t('Share.banner.sync_to_mine')
156
+ label: t('Share.banner.sync_to_mine', {
157
+ smart_count: isShortLabel ? 1 : 2
158
+ })
152
159
  };
153
160
  };
package/locales/en.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "anyoneWithTheLink": "Anyone with the link",
29
29
  "accessCount": "%{count} people have access"
30
30
  },
31
- "create-cozy": "Create my cozy",
31
+ "create-cozy": "Create |||| Create my cozy",
32
32
  "members": {
33
33
  "count": "%{smart_count} member |||| %{smart_count} members",
34
34
  "others": "and 1 other… |||| and %{smart_count} others…",
@@ -59,8 +59,8 @@
59
59
  "shared_from": "The items below are displayed from ![avatar](%{image}) **%{name}**'s Cozy. You can add a link to this share in your Cozy",
60
60
  "whats_cozy": "Cozy is a secure digital home for all your data, hosted in France - ",
61
61
  "know_more": "More information",
62
- "sync_to_mine": "Synchronise in my Cozy",
63
- "add_to_mine": "Add to my Cozy",
62
+ "sync_to_mine": "Synchronise |||| Synchronise in my Cozy",
63
+ "add_to_mine": "Add |||| Add to my Cozy",
64
64
  "close": "Close"
65
65
  },
66
66
  "permissionLink": {
package/locales/fr.json CHANGED
@@ -28,7 +28,7 @@
28
28
  "anyoneWithTheLink": "N'importe qui avec le lien",
29
29
  "accessCount": "%{count} personnes y ont accès"
30
30
  },
31
- "create-cozy": "Créer mon Cozy",
31
+ "create-cozy": "Créer |||| Créer mon Cozy",
32
32
  "members": {
33
33
  "count": "%{smart_count} membre |||| %{smart_count} membres",
34
34
  "others": "et 1 autre… |||| et %{smart_count} autres…",
@@ -59,8 +59,8 @@
59
59
  "shared_from": "Les éléments ci-dessous sont affichés depuis le Cozy de ![avatar](%{image}) **%{name}**. Vous pouvez ajouter un lien vers ce partage dans votre Cozy.",
60
60
  "whats_cozy": "Cozy est un domicile numérique sécurisé pour toutes vos données, hébergé en France - ",
61
61
  "know_more": "En savoir plus",
62
- "sync_to_mine": "Synchroniser dans mon Cozy",
63
- "add_to_mine": "Ajouter à mon Cozy",
62
+ "sync_to_mine": "Synchroniser |||| Synchroniser dans mon Cozy",
63
+ "add_to_mine": "Ajouter |||| Ajouter à mon Cozy",
64
64
  "close": "Fermer"
65
65
  },
66
66
  "permissionLink": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-sharing",
3
- "version": "16.15.1",
3
+ "version": "16.17.0",
4
4
  "description": "Provides sharing login for React applications.",
5
5
  "main": "dist/index.js",
6
6
  "author": "Cozy",
@@ -74,5 +74,5 @@
74
74
  "sideEffects": [
75
75
  "*.css"
76
76
  ],
77
- "gitHead": "af2b4b48c01544820dd385be5914f6fd42ae72e5"
77
+ "gitHead": "b112d2808c21ed0ee2d73f23a0630128deca0a12"
78
78
  }
@@ -15,11 +15,13 @@ import withLocales from './hoc/withLocales'
15
15
  * @param {Object} props - The props for the component.
16
16
  * @param {string} props.link - The URL to be opened when the button is clicked.
17
17
  * @param {boolean} [props.isSharingShortcutCreated=false] - Indicates if a sharing shortcut has been created. (default false)
18
+ * @param {boolean} [props.isShortLabel] - Display a short label for the button.
18
19
  * @param {Object} [props] - Additional props to be passed to the Button component.
19
20
  */
20
21
  const OpenSharingLinkButton = ({
21
22
  link,
22
23
  isSharingShortcutCreated = false,
24
+ isShortLabel = false,
23
25
  ...props
24
26
  }) => {
25
27
  const { t } = useI18n()
@@ -31,6 +33,7 @@ const OpenSharingLinkButton = ({
31
33
  const { icon, label } = getIconWithlabel({
32
34
  link,
33
35
  isSharingShortcutCreated,
36
+ isShortLabel,
34
37
  t
35
38
  })
36
39
 
@@ -46,7 +49,8 @@ const OpenSharingLinkButton = ({
46
49
 
47
50
  OpenSharingLinkButton.propTypes = {
48
51
  link: PropTypes.string,
49
- isSharingShortcutCreated: PropTypes.bool
52
+ isSharingShortcutCreated: PropTypes.bool,
53
+ isShortLabel: PropTypes.bool
50
54
  }
51
55
 
52
56
  export default withLocales(OpenSharingLinkButton)
@@ -24,11 +24,13 @@ const makeStyles = customStyle => {
24
24
  * @param {Object} props - The props for the component.
25
25
  * @param {string} props.link - The URL to be opened when the button is clicked.
26
26
  * @param {boolean} [props.isSharingShortcutCreated=false] - Indicates if a sharing shortcut has been created. (default false)
27
+ * @param {boolean} [props.isShortLabel] - Display a short label for the button.
27
28
  * @param {Object} [props] - Additional props to be passed to the ExtendableFab component.
28
29
  */
29
30
  const OpenSharingLinkFabButton = ({
30
31
  link,
31
32
  isSharingShortcutCreated = false,
33
+ isShortLabel,
32
34
  ...props
33
35
  }) => {
34
36
  const { style = {}, ...rest } = props
@@ -42,6 +44,7 @@ const OpenSharingLinkFabButton = ({
42
44
  const { icon, label } = getIconWithlabel({
43
45
  link,
44
46
  isSharingShortcutCreated,
47
+ isShortLabel,
45
48
  t
46
49
  })
47
50
 
@@ -60,7 +63,8 @@ const OpenSharingLinkFabButton = ({
60
63
 
61
64
  OpenSharingLinkFabButton.propTypes = {
62
65
  link: PropTypes.string.isRequired,
63
- isSharingShortcutCreated: PropTypes.bool
66
+ isSharingShortcutCreated: PropTypes.bool,
67
+ isShortLabel: PropTypes.bool
64
68
  }
65
69
 
66
70
  export default withLocales(OpenSharingLinkFabButton)
@@ -24,11 +24,17 @@ const makeComponent = (label, icon) => {
24
24
  return Component
25
25
  }
26
26
 
27
- export const openSharingLink = ({ isSharingShortcutCreated, link }) => {
27
+ export const openSharingLink = ({
28
+ isSharingShortcutCreated,
29
+ openSharingLinkDisplayed = true,
30
+ isShortLabel = false,
31
+ link
32
+ }) => {
28
33
  const { t } = getActionsI18n()
29
34
  const { icon, label } = getIconWithlabel({
30
35
  link,
31
36
  isSharingShortcutCreated,
37
+ isShortLabel,
32
38
  t
33
39
  })
34
40
 
@@ -36,6 +42,7 @@ export const openSharingLink = ({ isSharingShortcutCreated, link }) => {
36
42
  name: 'openSharingLink',
37
43
  label,
38
44
  icon,
45
+ displayCondition: () => openSharingLinkDisplayed,
39
46
  action: () => {
40
47
  openExternalLink(link)
41
48
  },
@@ -57,12 +57,12 @@ const SharingBannerCozyToCozy = ({
57
57
  const action = () => openExternalLink(discoveryLink)
58
58
  const buttonOne = isSharingShortcutCreated
59
59
  ? {
60
- label: t('Share.banner.sync_to_mine'),
60
+ label: t('Share.banner.sync_to_mine', { smart_count: 2 }),
61
61
  icon: 'sync-cozy',
62
62
  action
63
63
  }
64
64
  : {
65
- label: t('Share.banner.add_to_mine'),
65
+ label: t('Share.banner.add_to_mine', { smart_count: 2 }),
66
66
  icon: 'to-the-cloud',
67
67
  action
68
68
  }
@@ -120,7 +120,7 @@ const SharingBannerByLink = ({ onClose }) => {
120
120
  <Button
121
121
  component="a"
122
122
  variant="text"
123
- label={t('Share.create-cozy')}
123
+ label={t('Share.create-cozy', { smart_count: 2 })}
124
124
  icon={CozyHomeLinkIcon}
125
125
  href={HOME_LINK_HREF}
126
126
  />
@@ -70,12 +70,28 @@ export const openExternalLink = url => {
70
70
  * @param {object} params.t
71
71
  * @returns {{ icon: React.Component, label: string }}
72
72
  */
73
- export const getIconWithlabel = ({ link, isSharingShortcutCreated, t }) => {
73
+ export const getIconWithlabel = ({
74
+ link,
75
+ isSharingShortcutCreated,
76
+ isShortLabel,
77
+ t
78
+ }) => {
74
79
  if (link === CREATE_COZY_HREF) {
75
- return { icon: ToTheCloudIcon, label: t('Share.create-cozy') }
80
+ return {
81
+ icon: ToTheCloudIcon,
82
+ label: t('Share.create-cozy', { smart_count: isShortLabel ? 1 : 2 })
83
+ }
76
84
  }
77
85
  if (!isSharingShortcutCreated) {
78
- return { icon: CloudPlusOutlinedIcon, label: t('Share.banner.add_to_mine') }
86
+ return {
87
+ icon: CloudPlusOutlinedIcon,
88
+ label: t('Share.banner.add_to_mine', {
89
+ smart_count: isShortLabel ? 1 : 2
90
+ })
91
+ }
92
+ }
93
+ return {
94
+ icon: SyncIcon,
95
+ label: t('Share.banner.sync_to_mine', { smart_count: isShortLabel ? 1 : 2 })
79
96
  }
80
- return { icon: SyncIcon, label: t('Share.banner.sync_to_mine') }
81
97
  }