cozy-ui 131.1.0 → 132.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 CHANGED
@@ -1,3 +1,28 @@
1
+ # [132.0.0](https://github.com/cozy/cozy-ui/compare/v131.2.0...v132.0.0) (2025-10-27)
2
+
3
+
4
+ ### Features
5
+
6
+ * **AppSections:** Replace cozy-flags by `config` prop ([6ecdad0](https://github.com/cozy/cozy-ui/commit/6ecdad0))
7
+ * **Paywall:** Replace cozy-flags by `isIapEnabled` prop ([953f28a](https://github.com/cozy/cozy-ui/commit/953f28a))
8
+ * **QualificationGrid:** Replace cozy-flags by `noHealth` prop ([68f14dc](https://github.com/cozy/cozy-ui/commit/68f14dc))
9
+ * Remove cozy-flags from peerDeps ([5131237](https://github.com/cozy/cozy-ui/commit/5131237))
10
+
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **AppSections:** You must use `config={flag('store.alternative-source')}` prop
15
+ * **QualificationGrid:** You must use `noHealth={flag('hide.healthTheme.enabled')}` prop
16
+ * **Paywall:** You must use `isIapEnabled={flag('flagship.iap.enabled')}` prop
17
+ * You no longer need to install `cozy-flags` package
18
+
19
+ # [131.2.0](https://github.com/cozy/cozy-ui/compare/v131.1.0...v131.2.0) (2025-10-27)
20
+
21
+
22
+ ### Features
23
+
24
+ * Change peerDep config for `react` and `react-dom` ([a923bfc](https://github.com/cozy/cozy-ui/commit/a923bfc))
25
+
1
26
  # [131.1.0](https://github.com/cozy/cozy-ui/compare/v131.0.1...v131.1.0) (2025-10-22)
2
27
 
3
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-ui",
3
- "version": "131.1.0",
3
+ "version": "132.0.0",
4
4
  "description": "Cozy apps UI SDK",
5
5
  "main": "./index.js",
6
6
  "bin": {
@@ -194,12 +194,11 @@
194
194
  "peerDependencies": {
195
195
  "cozy-client": ">=60.5.0",
196
196
  "cozy-device-helper": ">=2.0.0",
197
- "cozy-flags": ">=2.10.1",
198
197
  "cozy-intent": ">=2.29.1",
199
- "react": "^16.14.0",
198
+ "react": "^16 || ^17 || ^18",
200
199
  "react-dnd": "^16.0.1",
201
200
  "react-dnd-html5-backend": "^16.0.1",
202
- "react-dom": "^16.14.0"
201
+ "react-dom": "^16 || ^17 || ^18"
203
202
  },
204
203
  "eslintConfig": {
205
204
  "extends": [
@@ -2,8 +2,6 @@ import cx from 'classnames'
2
2
  import PropTypes from 'prop-types'
3
3
  import React, { Component } from 'react'
4
4
 
5
- import flag from 'cozy-flags'
6
-
7
5
  import styles from './Sections.styl'
8
6
  import * as catUtils from './categories'
9
7
  import AppsSection from './components/AppsSection'
@@ -228,8 +226,7 @@ export class Sections extends Component {
228
226
  }
229
227
  }
230
228
 
231
- const SectionsWrapper = props => {
232
- const config = flag('store.alternative-source')
229
+ const SectionsWrapper = ({ config, ...props }) => {
233
230
  const i18nConfig = generateI18nConfig(config?.categories)
234
231
  useExtendI18n(i18nConfig)
235
232
 
@@ -246,6 +243,7 @@ Sections.propTypes = {
246
243
  apps: PropTypes.array.isRequired,
247
244
  error: PropTypes.object,
248
245
 
246
+ config: PropTypes.object,
249
247
  onAppClick: PropTypes.func.isRequired,
250
248
 
251
249
  /** Whether to display the category selector */
@@ -4,7 +4,6 @@ import React, { useEffect, useState } from 'react'
4
4
  import { useInstanceInfo } from 'cozy-client'
5
5
  import { buildPremiumLink } from 'cozy-client/dist/models/instance'
6
6
  import { isFlagshipApp } from 'cozy-device-helper'
7
- import flag from 'cozy-flags'
8
7
  import { useWebviewIntent } from 'cozy-intent'
9
8
 
10
9
  import { makeType } from './helpers'
@@ -21,7 +20,13 @@ import { useI18n } from '../providers/I18n'
21
20
  /**
22
21
  * Component with the core logic of the paywall, which is then declined in several variants to adapt to the user case
23
22
  */
24
- const Paywall = ({ variant, onClose, isPublic, contentInterpolation }) => {
23
+ const Paywall = ({
24
+ variant,
25
+ onClose,
26
+ isPublic,
27
+ isIapEnabled,
28
+ contentInterpolation
29
+ }) => {
25
30
  const instanceInfo = useInstanceInfo()
26
31
  const { t } = useI18n()
27
32
 
@@ -54,9 +59,7 @@ const Paywall = ({ variant, onClose, isPublic, contentInterpolation }) => {
54
59
 
55
60
  const canOpenPremiumLink =
56
61
  !isFlagshipApp() ||
57
- (isFlagshipApp() &&
58
- !!flag('flagship.iap.enabled') &&
59
- isFlagshipAppIapAvailable)
62
+ (isFlagshipApp() && isIapEnabled && isFlagshipAppIapAvailable)
60
63
 
61
64
  const link = buildPremiumLink(instanceInfo)
62
65
  const type = makeType(instanceInfo, isPublic, link)
@@ -112,12 +115,15 @@ Paywall.propTypes = {
112
115
  onClose: PropTypes.func.isRequired,
113
116
  /** Whether paywall is display in a public context */
114
117
  isPublic: PropTypes.bool,
118
+ /** Whether the IAP is enabled */
119
+ isIapEnabled: PropTypes.bool,
115
120
  /** Translation interpolation for the content of the paywall */
116
121
  contentInterpolation: PropTypes.object
117
122
  }
118
123
 
119
124
  Paywall.defaultProps = {
120
125
  isPublic: false,
126
+ isIapEnabled: false,
121
127
  contentInterpolation: {}
122
128
  }
123
129
 
@@ -3,7 +3,6 @@ import React from 'react'
3
3
 
4
4
  import { createMockClient, useInstanceInfo } from 'cozy-client'
5
5
  import { isFlagshipApp } from 'cozy-device-helper'
6
- import flag from 'cozy-flags'
7
6
  import { useWebviewIntent } from 'cozy-intent'
8
7
 
9
8
  import Paywall from './Paywall'
@@ -21,7 +20,6 @@ jest.mock('cozy-intent', () => ({
21
20
  ...jest.requireActual('cozy-intent'),
22
21
  useWebviewIntent: jest.fn()
23
22
  }))
24
- jest.mock('cozy-flags')
25
23
 
26
24
  describe('Paywall', () => {
27
25
  const onCloseSpy = jest.fn()
@@ -36,7 +34,7 @@ describe('Paywall', () => {
36
34
  enablePremiumLinks = false,
37
35
  hasUuid = false,
38
36
  isFlagshipApp: isFlagshipAppReturnValue = false,
39
- isIapEnabled = null,
37
+ isIapEnabled = false,
40
38
  isIapAvailable = false
41
39
  } = {}) => {
42
40
  useInstanceInfo.mockReturnValue({
@@ -55,7 +53,6 @@ describe('Paywall', () => {
55
53
  })
56
54
 
57
55
  isFlagshipApp.mockReturnValue(isFlagshipAppReturnValue)
58
- flag.mockReturnValue(isIapEnabled)
59
56
  const mockCall = jest.fn().mockResolvedValue(isIapAvailable)
60
57
  useWebviewIntent.mockReturnValue({
61
58
  call: mockCall
@@ -68,6 +65,7 @@ describe('Paywall', () => {
68
65
  variant="onlyOffice"
69
66
  onClose={onCloseSpy}
70
67
  isPublic={isPublic}
68
+ isIapEnabled={isIapEnabled}
71
69
  />
72
70
  </DemoProvider>
73
71
  )
@@ -31,6 +31,7 @@ import Button from 'cozy-ui/transpiled/react/Buttons'
31
31
  const initialVariants = [
32
32
  {
33
33
  isPublic: false,
34
+ isIapEnabled: false,
34
35
  premiumLink: false
35
36
  }
36
37
  ]
@@ -124,6 +125,7 @@ const makeClient = premiumLink => ({
124
125
  {state.modalOpened && (
125
126
  <PaywallComponent
126
127
  isPublic={variant.isPublic}
128
+ isIapEnabled={variant.isIapEnabled}
127
129
  max={4}
128
130
  days={30}
129
131
  konnectorName="EDF"
@@ -3,7 +3,7 @@ import DemoProvider from 'cozy-ui/docs/components/DemoProvider'
3
3
  import QualificationGrid from 'cozy-ui/transpiled/react/QualificationGrid'
4
4
  import Variants from 'cozy-ui/docs/components/Variants'
5
5
 
6
- const initialVariants = [{ noUndefined: false, noOthers: false }]
6
+ const initialVariants = [{ noUndefined: false, noOthers: false, noHealth: false }]
7
7
  initialState = { selectedQualification: undefined }
8
8
 
9
9
  ;
@@ -16,6 +16,7 @@ initialState = { selectedQualification: undefined }
16
16
  <QualificationGrid
17
17
  noUndefined={variant.noUndefined}
18
18
  noOthers={variant.noOthers}
19
+ noHealth={variant.noHealth}
19
20
  onClick={qualification => setState({ selectedQualification: qualification })}
20
21
  />
21
22
  </>
@@ -1,7 +1,4 @@
1
1
  import { themesList } from 'cozy-client/dist/models/document/documentTypeData'
2
- import flag from 'cozy-flags'
3
2
 
4
- export const getThemesList = () =>
5
- flag('hide.healthTheme.enabled')
6
- ? themesList.filter(theme => theme.label !== 'health')
7
- : themesList
3
+ export const getThemesList = noHealth =>
4
+ noHealth ? themesList.filter(theme => theme.label !== 'health') : themesList
@@ -10,10 +10,10 @@ import CarIcon from '../Icons/Car'
10
10
  import ChessIcon from '../Icons/Chess'
11
11
  import DotsIcon from '../Icons/Dots'
12
12
  import HeartIcon from '../Icons/Heart'
13
+ import HomeIcon from '../Icons/Home'
13
14
  import PeopleIcon from '../Icons/People'
14
15
  import TeamIcon from '../Icons/Team'
15
16
  import WorkIcon from '../Icons/Work'
16
- import HomeIcon from '../Icons/Home'
17
17
  import QualificationItem from '../QualificationItem'
18
18
  import { useI18n } from '../providers/I18n'
19
19
 
@@ -30,8 +30,8 @@ const IconByName = {
30
30
  dots: DotsIcon
31
31
  }
32
32
 
33
- const QualificationGrid = ({ noUndefined, noOthers, onClick }) => {
34
- const themesList = getThemesList()
33
+ const QualificationGrid = ({ noUndefined, noOthers, noHealth, onClick }) => {
34
+ const themesList = getThemesList(noHealth)
35
35
  const { t } = useI18n()
36
36
  const [selectedQualification, setSelectedQualification] = useState()
37
37
 
@@ -72,6 +72,7 @@ const QualificationGrid = ({ noUndefined, noOthers, onClick }) => {
72
72
  QualificationGrid.defaultProps = {
73
73
  noUndefined: false,
74
74
  noOthers: false,
75
+ noHealth: false,
75
76
  onClick: () => {}
76
77
  }
77
78
 
@@ -80,6 +81,8 @@ QualificationGrid.propTypes = {
80
81
  noUndefined: PropTypes.bool,
81
82
  /** Remove `others` theme */
82
83
  noOthers: PropTypes.bool,
84
+ /** Remove `health` theme */
85
+ noHealth: PropTypes.bool,
83
86
  /** Triggered when an item is clicked */
84
87
  onClick: PropTypes.func
85
88
  }
@@ -19,6 +19,7 @@ export namespace Sections {
19
19
  const t: PropTypes.Validator<(...args: any[]) => any>;
20
20
  const apps: PropTypes.Validator<any[]>;
21
21
  const error: PropTypes.Requireable<object>;
22
+ const config: PropTypes.Requireable<object>;
22
23
  const onAppClick: PropTypes.Validator<(...args: any[]) => any>;
23
24
  const hasNav: PropTypes.Requireable<boolean>;
24
25
  const initialSearch: PropTypes.Requireable<object>;
@@ -1,3 +1,4 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
1
2
  import _extends from "@babel/runtime/helpers/extends";
2
3
  import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
3
4
  import _createClass from "@babel/runtime/helpers/createClass";
@@ -5,6 +6,7 @@ import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized
5
6
  import _inherits from "@babel/runtime/helpers/inherits";
6
7
  import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
7
8
  import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
9
+ var _excluded = ["config"];
8
10
 
9
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
10
12
 
@@ -13,7 +15,6 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
13
15
  import cx from 'classnames';
14
16
  import PropTypes from 'prop-types';
15
17
  import React, { Component } from 'react';
16
- import flag from 'cozy-flags';
17
18
  var styles = {
18
19
  "Sections__section": "Sections__Sections__section___2onYy"
19
20
  };
@@ -362,8 +363,10 @@ export var Sections = /*#__PURE__*/function (_Component) {
362
363
  return Sections;
363
364
  }(Component);
364
365
 
365
- var SectionsWrapper = function SectionsWrapper(props) {
366
- var config = flag('store.alternative-source');
366
+ var SectionsWrapper = function SectionsWrapper(_ref5) {
367
+ var config = _ref5.config,
368
+ props = _objectWithoutProperties(_ref5, _excluded);
369
+
367
370
  var i18nConfig = generateI18nConfig(config === null || config === void 0 ? void 0 : config.categories);
368
371
  useExtendI18n(i18nConfig);
369
372
 
@@ -383,6 +386,7 @@ Sections.propTypes = {
383
386
  /** List of apps that will be displayed into categories */
384
387
  apps: PropTypes.array.isRequired,
385
388
  error: PropTypes.object,
389
+ config: PropTypes.object,
386
390
  onAppClick: PropTypes.func.isRequired,
387
391
 
388
392
  /** Whether to display the category selector */
@@ -12,7 +12,6 @@ import React, { useEffect, useState } from 'react';
12
12
  import { useInstanceInfo } from 'cozy-client';
13
13
  import { buildPremiumLink } from 'cozy-client/dist/models/instance';
14
14
  import { isFlagshipApp } from 'cozy-device-helper';
15
- import flag from 'cozy-flags';
16
15
  import { useWebviewIntent } from 'cozy-intent';
17
16
  import { makeType } from "cozy-ui/transpiled/react/Paywall/helpers";
18
17
  import withPaywallLocales from "cozy-ui/transpiled/react/Paywall/locales/withPaywallLocales";
@@ -32,6 +31,7 @@ var Paywall = function Paywall(_ref) {
32
31
  var variant = _ref.variant,
33
32
  onClose = _ref.onClose,
34
33
  isPublic = _ref.isPublic,
34
+ isIapEnabled = _ref.isIapEnabled,
35
35
  contentInterpolation = _ref.contentInterpolation;
36
36
  var instanceInfo = useInstanceInfo();
37
37
 
@@ -113,7 +113,7 @@ var Paywall = function Paywall(_ref) {
113
113
  })),
114
114
  onClose: onClose
115
115
  });
116
- var canOpenPremiumLink = !isFlagshipApp() || isFlagshipApp() && !!flag('flagship.iap.enabled') && isFlagshipAppIapAvailable;
116
+ var canOpenPremiumLink = !isFlagshipApp() || isFlagshipApp() && isIapEnabled && isFlagshipAppIapAvailable;
117
117
  var link = buildPremiumLink(instanceInfo);
118
118
  var type = makeType(instanceInfo, isPublic, link);
119
119
 
@@ -157,11 +157,15 @@ Paywall.propTypes = {
157
157
  /** Whether paywall is display in a public context */
158
158
  isPublic: PropTypes.bool,
159
159
 
160
+ /** Whether the IAP is enabled */
161
+ isIapEnabled: PropTypes.bool,
162
+
160
163
  /** Translation interpolation for the content of the paywall */
161
164
  contentInterpolation: PropTypes.object
162
165
  };
163
166
  Paywall.defaultProps = {
164
167
  isPublic: false,
168
+ isIapEnabled: false,
165
169
  contentInterpolation: {}
166
170
  };
167
171
  export default withPaywallLocales(Paywall);
@@ -1 +1 @@
1
- export function getThemesList(): any;
1
+ export function getThemesList(noHealth: any): any;
@@ -1,7 +1,6 @@
1
1
  import { themesList } from 'cozy-client/dist/models/document/documentTypeData';
2
- import flag from 'cozy-flags';
3
- export var getThemesList = function getThemesList() {
4
- return flag('hide.healthTheme.enabled') ? themesList.filter(function (theme) {
2
+ export var getThemesList = function getThemesList(noHealth) {
3
+ return noHealth ? themesList.filter(function (theme) {
5
4
  return theme.label !== 'health';
6
5
  }) : themesList;
7
6
  };
@@ -10,10 +10,10 @@ import CarIcon from "cozy-ui/transpiled/react/Icons/Car";
10
10
  import ChessIcon from "cozy-ui/transpiled/react/Icons/Chess";
11
11
  import DotsIcon from "cozy-ui/transpiled/react/Icons/Dots";
12
12
  import HeartIcon from "cozy-ui/transpiled/react/Icons/Heart";
13
+ import HomeIcon from "cozy-ui/transpiled/react/Icons/Home";
13
14
  import PeopleIcon from "cozy-ui/transpiled/react/Icons/People";
14
15
  import TeamIcon from "cozy-ui/transpiled/react/Icons/Team";
15
16
  import WorkIcon from "cozy-ui/transpiled/react/Icons/Work";
16
- import HomeIcon from "cozy-ui/transpiled/react/Icons/Home";
17
17
  import QualificationItem from "cozy-ui/transpiled/react/QualificationItem";
18
18
  import { useI18n } from "cozy-ui/transpiled/react/providers/I18n";
19
19
  var IconByName = {
@@ -32,8 +32,9 @@ var IconByName = {
32
32
  var QualificationGrid = function QualificationGrid(_ref) {
33
33
  var noUndefined = _ref.noUndefined,
34
34
  noOthers = _ref.noOthers,
35
+ noHealth = _ref.noHealth,
35
36
  onClick = _ref.onClick;
36
- var themesList = getThemesList();
37
+ var themesList = getThemesList(noHealth);
37
38
 
38
39
  var _useI18n = useI18n(),
39
40
  t = _useI18n.t;
@@ -82,6 +83,7 @@ var QualificationGrid = function QualificationGrid(_ref) {
82
83
  QualificationGrid.defaultProps = {
83
84
  noUndefined: false,
84
85
  noOthers: false,
86
+ noHealth: false,
85
87
  onClick: function onClick() {}
86
88
  };
87
89
  QualificationGrid.propTypes = {
@@ -91,6 +93,9 @@ QualificationGrid.propTypes = {
91
93
  /** Remove `others` theme */
92
94
  noOthers: PropTypes.bool,
93
95
 
96
+ /** Remove `health` theme */
97
+ noHealth: PropTypes.bool,
98
+
94
99
  /** Triggered when an item is clicked */
95
100
  onClick: PropTypes.func
96
101
  };