@automattic/jetpack-components 0.69.1 → 0.70.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
@@ -2,6 +2,10 @@
2
2
 
3
3
  ### This is a list detailing changes for the Jetpack RNA Components package releases.
4
4
 
5
+ ## [0.70.0] - 2025-03-24
6
+ ### Changed
7
+ - Update component that renders the terms of service to have a text-only version. [#42600]
8
+
5
9
  ## [0.69.1] - 2025-03-18
6
10
  ### Changed
7
11
  - Update package dependencies. [#42509] [#42511]
@@ -1318,6 +1322,7 @@
1318
1322
  ### Changed
1319
1323
  - Update node version requirement to 14.16.1
1320
1324
 
1325
+ [0.70.0]: https://github.com/Automattic/jetpack-components/compare/0.69.1...0.70.0
1321
1326
  [0.69.1]: https://github.com/Automattic/jetpack-components/compare/0.69.0...0.69.1
1322
1327
  [0.69.0]: https://github.com/Automattic/jetpack-components/compare/0.68.2...0.69.0
1323
1328
  [0.68.2]: https://github.com/Automattic/jetpack-components/compare/0.68.1...0.68.2
@@ -5,7 +5,18 @@ import clsx from 'clsx';
5
5
  import { getRedirectUrl } from '../../../components/index.js';
6
6
  import Text from '../text/index.js';
7
7
  import './styles.scss';
8
- const TermsOfService = ({ className, multipleButtons, agreeButtonLabel, ...textProps }) => (_jsx(Text, { className: clsx(className, 'terms-of-service'), ...textProps, children: multipleButtons ? (_jsx(MultipleButtonsText, { multipleButtonsLabels: multipleButtons })) : (_jsx(SingleButtonText, { agreeButtonLabel: agreeButtonLabel })) }));
8
+ const TermsOfService = ({ className, multipleButtons, agreeButtonLabel, isTextOnly, ...textProps }) => {
9
+ const getTOSContent = () => {
10
+ if (isTextOnly) {
11
+ return _jsx(TermsOfServiceTextOnly, {});
12
+ }
13
+ if (multipleButtons) {
14
+ return _jsx(MultipleButtonsText, { multipleButtonsLabels: multipleButtons });
15
+ }
16
+ return _jsx(SingleButtonText, { agreeButtonLabel: agreeButtonLabel });
17
+ };
18
+ return (_jsx(Text, { className: clsx(className, 'terms-of-service'), ...textProps, children: getTOSContent() }));
19
+ };
9
20
  const MultipleButtonsText = ({ multipleButtonsLabels }) => {
10
21
  if (Array.isArray(multipleButtonsLabels) && multipleButtonsLabels.length > 1) {
11
22
  return createInterpolateElement(sprintf(
@@ -28,5 +39,9 @@ __('By clicking <strong>%s</strong>, you agree to our <tosLink>Terms of Service<
28
39
  tosLink: _jsx(Link, { slug: "wpcom-tos" }),
29
40
  shareDetailsLink: _jsx(Link, { slug: "jetpack-support-what-data-does-jetpack-sync" }),
30
41
  });
42
+ const TermsOfServiceTextOnly = () => createInterpolateElement(__('By continuing you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site’s data</shareDetailsLink> with us. We’ll check if that email is linked to an existing WordPress.com account or create a new one instantly.', 'jetpack-components'), {
43
+ tosLink: _jsx(Link, { slug: "wpcom-tos" }),
44
+ shareDetailsLink: _jsx(Link, { slug: "jetpack-support-what-data-does-jetpack-sync" }),
45
+ });
31
46
  const Link = ({ slug, children }) => (_jsx("a", { className: "terms-of-service__link", href: getRedirectUrl(slug), rel: "noopener noreferrer", target: "_blank", children: children }));
32
47
  export default TermsOfService;
@@ -8,6 +8,7 @@ type MultipleButtonsProps = {
8
8
  * The text label of the button someone would click to agree to the terms.
9
9
  */
10
10
  agreeButtonLabel?: undefined;
11
+ isTextOnly?: false;
11
12
  };
12
13
  type SingleButtonProps = {
13
14
  /**
@@ -18,6 +19,15 @@ type SingleButtonProps = {
18
19
  * The text label of the button someone would click to agree to the terms.
19
20
  */
20
21
  agreeButtonLabel: string;
22
+ isTextOnly?: false;
21
23
  };
22
- export type TermsOfServiceProps = Pick<TextProps, 'variant' | 'm' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'className' | 'component'> & (MultipleButtonsProps | SingleButtonProps);
24
+ type OnlyTextProps = {
25
+ /**
26
+ * If true, displays a simpler version of the terms without button references
27
+ */
28
+ isTextOnly: true;
29
+ multipleButtons?: undefined;
30
+ agreeButtonLabel?: undefined;
31
+ };
32
+ export type TermsOfServiceProps = Pick<TextProps, 'variant' | 'm' | 'mt' | 'mr' | 'mb' | 'ml' | 'mx' | 'my' | 'p' | 'pt' | 'pr' | 'pb' | 'pl' | 'px' | 'py' | 'className' | 'component'> & (MultipleButtonsProps | SingleButtonProps | OnlyTextProps);
23
33
  export {};
@@ -10,16 +10,25 @@ const TermsOfService: React.FC< TermsOfServiceProps > = ( {
10
10
  className,
11
11
  multipleButtons,
12
12
  agreeButtonLabel,
13
+ isTextOnly,
13
14
  ...textProps
14
- } ) => (
15
- <Text className={ clsx( className, 'terms-of-service' ) } { ...textProps }>
16
- { multipleButtons ? (
17
- <MultipleButtonsText multipleButtonsLabels={ multipleButtons } />
18
- ) : (
19
- <SingleButtonText agreeButtonLabel={ agreeButtonLabel } />
20
- ) }
21
- </Text>
22
- );
15
+ } ) => {
16
+ const getTOSContent = () => {
17
+ if ( isTextOnly ) {
18
+ return <TermsOfServiceTextOnly />;
19
+ }
20
+ if ( multipleButtons ) {
21
+ return <MultipleButtonsText multipleButtonsLabels={ multipleButtons } />;
22
+ }
23
+ return <SingleButtonText agreeButtonLabel={ agreeButtonLabel } />;
24
+ };
25
+
26
+ return (
27
+ <Text className={ clsx( className, 'terms-of-service' ) } { ...textProps }>
28
+ { getTOSContent() }
29
+ </Text>
30
+ );
31
+ };
23
32
 
24
33
  const MultipleButtonsText = ( { multipleButtonsLabels } ) => {
25
34
  if ( Array.isArray( multipleButtonsLabels ) && multipleButtonsLabels.length > 1 ) {
@@ -70,6 +79,18 @@ const SingleButtonText = ( { agreeButtonLabel } ) =>
70
79
  }
71
80
  );
72
81
 
82
+ const TermsOfServiceTextOnly = () =>
83
+ createInterpolateElement(
84
+ __(
85
+ 'By continuing you agree to our <tosLink>Terms of Service</tosLink> and to <shareDetailsLink>sync your site’s data</shareDetailsLink> with us. We’ll check if that email is linked to an existing WordPress.com account or create a new one instantly.',
86
+ 'jetpack-components'
87
+ ),
88
+ {
89
+ tosLink: <Link slug="wpcom-tos" />,
90
+ shareDetailsLink: <Link slug="jetpack-support-what-data-does-jetpack-sync" />,
91
+ }
92
+ );
93
+
73
94
  const Link: React.FC< { slug: string; children?: React.ReactNode } > = ( { slug, children } ) => (
74
95
  <a
75
96
  className="terms-of-service__link"
@@ -10,6 +10,8 @@ type MultipleButtonsProps = {
10
10
  * The text label of the button someone would click to agree to the terms.
11
11
  */
12
12
  agreeButtonLabel?: undefined;
13
+
14
+ isTextOnly?: false;
13
15
  };
14
16
 
15
17
  type SingleButtonProps = {
@@ -22,6 +24,17 @@ type SingleButtonProps = {
22
24
  * The text label of the button someone would click to agree to the terms.
23
25
  */
24
26
  agreeButtonLabel: string;
27
+
28
+ isTextOnly?: false;
29
+ };
30
+
31
+ type OnlyTextProps = {
32
+ /**
33
+ * If true, displays a simpler version of the terms without button references
34
+ */
35
+ isTextOnly: true;
36
+ multipleButtons?: undefined;
37
+ agreeButtonLabel?: undefined;
25
38
  };
26
39
 
27
40
  export type TermsOfServiceProps = Pick<
@@ -44,4 +57,4 @@ export type TermsOfServiceProps = Pick<
44
57
  | 'className'
45
58
  | 'component'
46
59
  > &
47
- ( MultipleButtonsProps | SingleButtonProps );
60
+ ( MultipleButtonsProps | SingleButtonProps | OnlyTextProps );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automattic/jetpack-components",
3
- "version": "0.69.1",
3
+ "version": "0.70.0",
4
4
  "description": "Jetpack Components Package",
5
5
  "author": "Automattic",
6
6
  "license": "GPL-2.0-or-later",