cozy-sharing 29.0.0 → 30.0.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 +10 -0
- package/dist/components/SharingBanner/components/PublicBanner.js +28 -22
- package/dist/components/SharingBanner/components/PublicBanner.spec.js +3 -2
- package/dist/styles/publicBanner.styl +4 -4
- package/dist/stylesheet.css +7 -28
- package/package.json +5 -5
- package/src/components/SharingBanner/components/PublicBanner.jsx +50 -42
- package/src/components/SharingBanner/components/PublicBanner.spec.jsx +9 -6
- package/src/styles/publicBanner.styl +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
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
|
+
# [30.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@29.0.0...cozy-sharing@30.0.0) (2026-03-24)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- Upgrade cozy-ui and cozy-ui-plus in cozy-search and cozy-sharing ([f5fd252](https://github.com/cozy/cozy-libs/commit/f5fd2520150e276c8b55feeb1b994ba33d0a114b))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
- You must have `cozy-ui >= 138.1.0 and cozy-ui-plus >= 6.0.0`
|
|
15
|
+
|
|
6
16
|
# [29.0.0](https://github.com/cozy/cozy-libs/compare/cozy-sharing@28.11.3...cozy-sharing@29.0.0) (2026-03-24)
|
|
7
17
|
|
|
8
18
|
### Features
|
|
@@ -4,8 +4,10 @@ import React from 'react';
|
|
|
4
4
|
import snarkdown from 'snarkdown';
|
|
5
5
|
import { useClient } from 'cozy-client';
|
|
6
6
|
import flag from 'cozy-flags';
|
|
7
|
-
import
|
|
7
|
+
import Alert from 'cozy-ui/transpiled/react/Alert';
|
|
8
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar';
|
|
8
9
|
import Button from 'cozy-ui/transpiled/react/Buttons';
|
|
10
|
+
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
9
11
|
import { useI18n } from 'twake-i18n';
|
|
10
12
|
import CozyHomeLinkIcon from './CozyHomeLinkIcon';
|
|
11
13
|
var styles = {
|
|
@@ -36,7 +38,7 @@ var PublicBannerCozyToCozyContent = function PublicBannerCozyToCozyContent(_ref)
|
|
|
36
38
|
userBoldName = _beginning$1$split$1$2[0],
|
|
37
39
|
ending = _beginning$1$split$1$2[1];
|
|
38
40
|
|
|
39
|
-
return /*#__PURE__*/React.createElement(
|
|
41
|
+
return /*#__PURE__*/React.createElement(Avatar, {
|
|
40
42
|
className: styles['bannermarkdown']
|
|
41
43
|
}, beginning[0], /*#__PURE__*/React.createElement("img", {
|
|
42
44
|
src: avatarURL,
|
|
@@ -61,6 +63,9 @@ var SharingBannerCozyToCozy = function SharingBannerCozyToCozy(_ref2) {
|
|
|
61
63
|
var _useI18n2 = useI18n(),
|
|
62
64
|
t = _useI18n2.t;
|
|
63
65
|
|
|
66
|
+
var _useBreakpoints = useBreakpoints(),
|
|
67
|
+
isMobile = _useBreakpoints.isMobile;
|
|
68
|
+
|
|
64
69
|
var action = function action() {
|
|
65
70
|
return openExternalLink(addSharingLink);
|
|
66
71
|
};
|
|
@@ -78,24 +83,23 @@ var SharingBannerCozyToCozy = function SharingBannerCozyToCozy(_ref2) {
|
|
|
78
83
|
icon: 'to-the-cloud',
|
|
79
84
|
action: action
|
|
80
85
|
};
|
|
81
|
-
return /*#__PURE__*/React.createElement(
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
buttonOne: /*#__PURE__*/React.createElement(Button, {
|
|
86
|
+
return /*#__PURE__*/React.createElement(Alert, {
|
|
87
|
+
color: "var(--defaultBackgroundColor)",
|
|
88
|
+
square: true,
|
|
89
|
+
block: isMobile,
|
|
90
|
+
action: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
87
91
|
variant: "text",
|
|
88
92
|
label: buttonOne.label,
|
|
89
93
|
icon: buttonOne.icon,
|
|
90
94
|
onClick: buttonOne.action
|
|
91
|
-
}),
|
|
92
|
-
buttonTwo: /*#__PURE__*/React.createElement(Button, {
|
|
95
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
93
96
|
variant: "text",
|
|
94
97
|
label: t('Share.banner.close'),
|
|
95
98
|
onClick: onClose
|
|
96
|
-
})
|
|
97
|
-
|
|
98
|
-
|
|
99
|
+
}))
|
|
100
|
+
}, /*#__PURE__*/React.createElement(PublicBannerCozyToCozyContent, {
|
|
101
|
+
sharing: sharing
|
|
102
|
+
}));
|
|
99
103
|
};
|
|
100
104
|
|
|
101
105
|
var SharingBannerByLinkText = function SharingBannerByLinkText() {
|
|
@@ -122,6 +126,9 @@ var SharingBannerByLink = function SharingBannerByLink(_ref3) {
|
|
|
122
126
|
var _useI18n4 = useI18n(),
|
|
123
127
|
t = _useI18n4.t;
|
|
124
128
|
|
|
129
|
+
var _useBreakpoints2 = useBreakpoints(),
|
|
130
|
+
isMobile = _useBreakpoints2.isMobile;
|
|
131
|
+
|
|
125
132
|
var HOME_LINK_HREF = flag('signup.url');
|
|
126
133
|
var canNotCreateTwakeFromPublicSharingLink = flag('drive.twake-creation-from-public-sharing.disabled');
|
|
127
134
|
|
|
@@ -129,10 +136,11 @@ var SharingBannerByLink = function SharingBannerByLink(_ref3) {
|
|
|
129
136
|
return null;
|
|
130
137
|
}
|
|
131
138
|
|
|
132
|
-
return /*#__PURE__*/React.createElement(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
return /*#__PURE__*/React.createElement(Alert, {
|
|
140
|
+
color: "var(--defaultBackgroundColor)",
|
|
141
|
+
square: true,
|
|
142
|
+
block: isMobile,
|
|
143
|
+
action: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button, {
|
|
136
144
|
component: "a",
|
|
137
145
|
variant: "text",
|
|
138
146
|
label: t('Share.create-cozy', {
|
|
@@ -140,14 +148,12 @@ var SharingBannerByLink = function SharingBannerByLink(_ref3) {
|
|
|
140
148
|
}),
|
|
141
149
|
icon: CozyHomeLinkIcon,
|
|
142
150
|
href: HOME_LINK_HREF
|
|
143
|
-
}),
|
|
144
|
-
buttonTwo: /*#__PURE__*/React.createElement(Button, {
|
|
151
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
145
152
|
variant: "text",
|
|
146
153
|
label: t('Share.banner.close'),
|
|
147
154
|
onClick: onClose
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
});
|
|
155
|
+
}))
|
|
156
|
+
}, /*#__PURE__*/React.createElement(SharingBannerByLinkText, null));
|
|
151
157
|
};
|
|
152
158
|
|
|
153
159
|
SharingBannerCozyToCozy.propTypes = {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { render } from '@testing-library/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useClient } from 'cozy-client';
|
|
4
|
+
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints';
|
|
4
5
|
import { useI18n } from 'twake-i18n';
|
|
5
6
|
import { SharingBannerCozyToCozy } from './PublicBanner';
|
|
6
7
|
jest.mock('twake-i18n');
|
|
@@ -33,12 +34,12 @@ describe('PublicBanner', function () {
|
|
|
33
34
|
}
|
|
34
35
|
}; // When
|
|
35
36
|
|
|
36
|
-
var _render = render( /*#__PURE__*/React.createElement(SharingBannerCozyToCozy, {
|
|
37
|
+
var _render = render( /*#__PURE__*/React.createElement(BreakpointsProvider, null, /*#__PURE__*/React.createElement(SharingBannerCozyToCozy, {
|
|
37
38
|
sharing: sharing,
|
|
38
39
|
isSharingShortcutCreated: true,
|
|
39
40
|
addSharingLink: "discoveryLink",
|
|
40
41
|
onClose: function onClose() {}
|
|
41
|
-
})),
|
|
42
|
+
}))),
|
|
42
43
|
container = _render.container; // Then
|
|
43
44
|
|
|
44
45
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@require 'components/avatar'
|
|
2
|
-
@require 'components/circle'
|
|
3
1
|
.bannermarkdown
|
|
4
2
|
display inline-block
|
|
3
|
+
background-color var(--paleGrey)
|
|
4
|
+
color var(--silver)
|
|
5
|
+
position relative
|
|
6
|
+
|
|
5
7
|
img
|
|
6
|
-
@extend $avatar
|
|
7
|
-
@extend $circle
|
|
8
8
|
width rem(16)
|
|
9
9
|
height rem(16)
|
|
10
10
|
min-width rem(16)
|
package/dist/stylesheet.css
CHANGED
|
@@ -518,39 +518,18 @@ input[type=text] {
|
|
|
518
518
|
}
|
|
519
519
|
/* imported from publicBanner.styl */
|
|
520
520
|
|
|
521
|
-
.publicBanner__bannermarkdown___1dR1E
|
|
521
|
+
.publicBanner__bannermarkdown___1dR1E {
|
|
522
|
+
display: inline-block;
|
|
522
523
|
background-color: var(--paleGrey);
|
|
523
524
|
color: var(--silver);
|
|
524
525
|
position: relative;
|
|
525
526
|
}
|
|
526
|
-
.publicBanner__bannermarkdown___1dR1E img svg {
|
|
527
|
-
width: 50%;
|
|
528
|
-
height: 50%;
|
|
529
|
-
}
|
|
530
|
-
.publicBanner__bannermarkdown___1dR1E img {
|
|
531
|
-
--circleSize: 2.5rem;
|
|
532
|
-
width: var(--circleSize);
|
|
533
|
-
height: var(--circleSize);
|
|
534
|
-
min-width: var(--circleSize);
|
|
535
|
-
min-height: var(--circleSize);
|
|
536
|
-
font-size: calc(var(--circleSize) / 2.28);
|
|
537
|
-
display: inline-flex;
|
|
538
|
-
align-items: center;
|
|
539
|
-
justify-content: center;
|
|
540
|
-
border-radius: 50%;
|
|
541
|
-
overflow: hidden;
|
|
542
|
-
background-color: var(--dodgerBlue);
|
|
543
|
-
color: var(--white);
|
|
544
|
-
}
|
|
545
|
-
.publicBanner__bannermarkdown___1dR1E {
|
|
546
|
-
display: inline-block;
|
|
547
|
-
}
|
|
548
527
|
.publicBanner__bannermarkdown___1dR1E img {
|
|
549
|
-
width:
|
|
550
|
-
height:
|
|
551
|
-
min-width:
|
|
552
|
-
min-height:
|
|
553
|
-
font-size:
|
|
528
|
+
width: rem(16);
|
|
529
|
+
height: rem(16);
|
|
530
|
+
min-width: rem(16);
|
|
531
|
+
min-height: rem(16);
|
|
532
|
+
font-size: rem(7);
|
|
554
533
|
vertical-align: text-bottom;
|
|
555
534
|
}
|
|
556
535
|
/* imported from tooltip.styl */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-sharing",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "30.0.0",
|
|
4
4
|
"description": "Provides sharing login for React applications.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Cozy",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"cozy-device-helper": "^3.7.1",
|
|
59
59
|
"cozy-intent": "^2.31.1",
|
|
60
60
|
"cozy-minilog": "^3.10.1",
|
|
61
|
-
"cozy-ui": "^
|
|
61
|
+
"cozy-ui": "^138.1.0",
|
|
62
62
|
"cozy-ui-plus": "^6.0.0",
|
|
63
63
|
"jest": "30.3.0",
|
|
64
64
|
"jest-environment-jsdom": "30.3.0",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"cozy-flags": ">=4.8.1",
|
|
75
75
|
"cozy-intent": ">=2.29.1",
|
|
76
76
|
"cozy-minilog": ">=3.9.1",
|
|
77
|
-
"cozy-ui": ">=
|
|
78
|
-
"cozy-ui-plus": ">=
|
|
77
|
+
"cozy-ui": ">=138.1.0",
|
|
78
|
+
"cozy-ui-plus": ">=6.0.0",
|
|
79
79
|
"prop-types": ">=15.7.2",
|
|
80
80
|
"react": ">=16.12.0",
|
|
81
81
|
"react-router": ">=5.0.1",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"sideEffects": [
|
|
85
85
|
"*.css"
|
|
86
86
|
],
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "9655a128354d92bbb108ed6ec830704dd158d48a"
|
|
88
88
|
}
|
|
@@ -4,8 +4,10 @@ import snarkdown from 'snarkdown'
|
|
|
4
4
|
|
|
5
5
|
import { useClient } from 'cozy-client'
|
|
6
6
|
import flag from 'cozy-flags'
|
|
7
|
-
import
|
|
7
|
+
import Alert from 'cozy-ui/transpiled/react/Alert'
|
|
8
|
+
import Avatar from 'cozy-ui/transpiled/react/Avatar'
|
|
8
9
|
import Button from 'cozy-ui/transpiled/react/Buttons'
|
|
10
|
+
import { useBreakpoints } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
9
11
|
import { useI18n } from 'twake-i18n'
|
|
10
12
|
|
|
11
13
|
import CozyHomeLinkIcon from './CozyHomeLinkIcon'
|
|
@@ -32,11 +34,11 @@ const PublicBannerCozyToCozyContent = ({ sharing }) => {
|
|
|
32
34
|
.split('</strong>')
|
|
33
35
|
|
|
34
36
|
return (
|
|
35
|
-
<
|
|
37
|
+
<Avatar className={styles['bannermarkdown']}>
|
|
36
38
|
{beginning[0]}
|
|
37
39
|
<img src={avatarURL} alt="avatar" /> <strong>{userBoldName}</strong>
|
|
38
40
|
{ending}
|
|
39
|
-
</
|
|
41
|
+
</Avatar>
|
|
40
42
|
)
|
|
41
43
|
}
|
|
42
44
|
PublicBannerCozyToCozyContent.propTypes = {
|
|
@@ -52,6 +54,7 @@ const SharingBannerCozyToCozy = ({
|
|
|
52
54
|
onClose
|
|
53
55
|
}) => {
|
|
54
56
|
const { t } = useI18n()
|
|
57
|
+
const { isMobile } = useBreakpoints()
|
|
55
58
|
|
|
56
59
|
const action = () => openExternalLink(addSharingLink)
|
|
57
60
|
const buttonOne = isSharingShortcutCreated
|
|
@@ -66,26 +69,28 @@ const SharingBannerCozyToCozy = ({
|
|
|
66
69
|
action
|
|
67
70
|
}
|
|
68
71
|
return (
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
72
|
+
<Alert
|
|
73
|
+
color="var(--defaultBackgroundColor)"
|
|
74
|
+
square
|
|
75
|
+
block={isMobile}
|
|
76
|
+
action={
|
|
77
|
+
<>
|
|
78
|
+
<Button
|
|
79
|
+
variant="text"
|
|
80
|
+
label={buttonOne.label}
|
|
81
|
+
icon={buttonOne.icon}
|
|
82
|
+
onClick={buttonOne.action}
|
|
83
|
+
/>
|
|
84
|
+
<Button
|
|
85
|
+
variant="text"
|
|
86
|
+
label={t('Share.banner.close')}
|
|
87
|
+
onClick={onClose}
|
|
88
|
+
/>
|
|
89
|
+
</>
|
|
86
90
|
}
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
>
|
|
92
|
+
<PublicBannerCozyToCozyContent sharing={sharing} />
|
|
93
|
+
</Alert>
|
|
89
94
|
)
|
|
90
95
|
}
|
|
91
96
|
|
|
@@ -111,6 +116,7 @@ const SharingBannerByLinkText = () => {
|
|
|
111
116
|
|
|
112
117
|
const SharingBannerByLink = ({ onClose }) => {
|
|
113
118
|
const { t } = useI18n()
|
|
119
|
+
const { isMobile } = useBreakpoints()
|
|
114
120
|
|
|
115
121
|
const HOME_LINK_HREF = flag('signup.url')
|
|
116
122
|
const canNotCreateTwakeFromPublicSharingLink = flag(
|
|
@@ -122,27 +128,29 @@ const SharingBannerByLink = ({ onClose }) => {
|
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
return (
|
|
125
|
-
<
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
131
|
+
<Alert
|
|
132
|
+
color="var(--defaultBackgroundColor)"
|
|
133
|
+
square
|
|
134
|
+
block={isMobile}
|
|
135
|
+
action={
|
|
136
|
+
<>
|
|
137
|
+
<Button
|
|
138
|
+
component="a"
|
|
139
|
+
variant="text"
|
|
140
|
+
label={t('Share.create-cozy', { smart_count: 2 })}
|
|
141
|
+
icon={CozyHomeLinkIcon}
|
|
142
|
+
href={HOME_LINK_HREF}
|
|
143
|
+
/>
|
|
144
|
+
<Button
|
|
145
|
+
variant="text"
|
|
146
|
+
label={t('Share.banner.close')}
|
|
147
|
+
onClick={onClose}
|
|
148
|
+
/>
|
|
149
|
+
</>
|
|
136
150
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
label={t('Share.banner.close')}
|
|
141
|
-
onClick={onClose}
|
|
142
|
-
/>
|
|
143
|
-
}
|
|
144
|
-
inline
|
|
145
|
-
/>
|
|
151
|
+
>
|
|
152
|
+
<SharingBannerByLinkText />
|
|
153
|
+
</Alert>
|
|
146
154
|
)
|
|
147
155
|
}
|
|
148
156
|
SharingBannerCozyToCozy.propTypes = {
|
|
@@ -2,6 +2,7 @@ import { render } from '@testing-library/react'
|
|
|
2
2
|
import React from 'react'
|
|
3
3
|
|
|
4
4
|
import { useClient } from 'cozy-client'
|
|
5
|
+
import { BreakpointsProvider } from 'cozy-ui/transpiled/react/providers/Breakpoints'
|
|
5
6
|
import { useI18n } from 'twake-i18n'
|
|
6
7
|
|
|
7
8
|
import { SharingBannerCozyToCozy } from './PublicBanner'
|
|
@@ -31,12 +32,14 @@ describe('PublicBanner', () => {
|
|
|
31
32
|
|
|
32
33
|
// When
|
|
33
34
|
const { container } = render(
|
|
34
|
-
<
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
<BreakpointsProvider>
|
|
36
|
+
<SharingBannerCozyToCozy
|
|
37
|
+
sharing={sharing}
|
|
38
|
+
isSharingShortcutCreated={true}
|
|
39
|
+
addSharingLink="discoveryLink"
|
|
40
|
+
onClose={() => {}}
|
|
41
|
+
/>
|
|
42
|
+
</BreakpointsProvider>
|
|
40
43
|
)
|
|
41
44
|
|
|
42
45
|
// Then
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
@require 'components/avatar'
|
|
2
|
-
@require 'components/circle'
|
|
3
1
|
.bannermarkdown
|
|
4
2
|
display inline-block
|
|
3
|
+
background-color var(--paleGrey)
|
|
4
|
+
color var(--silver)
|
|
5
|
+
position relative
|
|
6
|
+
|
|
5
7
|
img
|
|
6
|
-
@extend $avatar
|
|
7
|
-
@extend $circle
|
|
8
8
|
width rem(16)
|
|
9
9
|
height rem(16)
|
|
10
10
|
min-width rem(16)
|