cozy-keys-lib 4.1.9 → 4.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cozy-keys-lib",
|
|
3
|
-
"version": "4.1
|
|
3
|
+
"version": "4.2.1",
|
|
4
4
|
"description": "Interactions between cozy-keys and a bitwarden server",
|
|
5
5
|
"browser": "transpiled/index.js",
|
|
6
6
|
"main": "transpiled/index.node.js",
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"babel-preset-cozy-app": "^1.6.0",
|
|
52
52
|
"cozy-client": "^16.10.2",
|
|
53
53
|
"cozy-flags": "2.6.0",
|
|
54
|
+
"cozy-intent": "^2.0.2",
|
|
54
55
|
"cozy-ui": "^42.3.0",
|
|
55
56
|
"enzyme": "^3.10.0",
|
|
56
57
|
"enzyme-adapter-react-16": "^1.14.0",
|
|
@@ -86,6 +87,7 @@
|
|
|
86
87
|
"peerDependencies": {
|
|
87
88
|
"cozy-client": "^16.10.2",
|
|
88
89
|
"cozy-flags": "^2.6.0",
|
|
90
|
+
"cozy-intent": "^2.0.2",
|
|
89
91
|
"cozy-ui": "^42.3.0",
|
|
90
92
|
"react": "^16.8.3",
|
|
91
93
|
"react-dom": "^16.9.0"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useCallback, useMemo } from 'react'
|
|
1
|
+
import React, { useState, useCallback, useMemo, useEffect } from 'react'
|
|
2
2
|
import cx from 'classnames'
|
|
3
3
|
import get from 'lodash/get'
|
|
4
4
|
import PropTypes from 'prop-types'
|
|
@@ -13,6 +13,7 @@ import Icon from 'cozy-ui/transpiled/react/Icon'
|
|
|
13
13
|
import CozyTheme from 'cozy-ui/transpiled/react/CozyTheme'
|
|
14
14
|
import { IllustrationDialog } from 'cozy-ui/transpiled/react/CozyDialogs'
|
|
15
15
|
import KeychainIcon from 'cozy-ui/transpiled/react/Icons/Keychain'
|
|
16
|
+
import { useWebviewIntent } from 'cozy-intent'
|
|
16
17
|
|
|
17
18
|
import CloudIcon from './IconCozySecurity'
|
|
18
19
|
import PasswordField from './PasswordField'
|
|
@@ -77,6 +78,31 @@ const UnlockForm = props => {
|
|
|
77
78
|
|
|
78
79
|
const canAuthWithOIDC = canClientAuthWithOIDC(client)
|
|
79
80
|
|
|
81
|
+
const webviewIntent = useWebviewIntent()
|
|
82
|
+
|
|
83
|
+
useEffect(() => {
|
|
84
|
+
webviewIntent &&
|
|
85
|
+
webviewIntent.call(
|
|
86
|
+
'setFlagshipUI',
|
|
87
|
+
{
|
|
88
|
+
bottomTheme: 'light',
|
|
89
|
+
topTheme: 'light'
|
|
90
|
+
},
|
|
91
|
+
'cozy-keys-lib/UnlockForm'
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return () =>
|
|
95
|
+
webviewIntent &&
|
|
96
|
+
webviewIntent.call(
|
|
97
|
+
'setFlagshipUI',
|
|
98
|
+
{
|
|
99
|
+
bottomTheme: 'light',
|
|
100
|
+
topTheme: 'light'
|
|
101
|
+
},
|
|
102
|
+
'cozy-keys-lib/UnlockForm'
|
|
103
|
+
)
|
|
104
|
+
}, [webviewIntent])
|
|
105
|
+
|
|
80
106
|
return (
|
|
81
107
|
<CozyTheme variant="inverted">
|
|
82
108
|
<IllustrationDialog
|
|
@@ -127,6 +127,10 @@ const withVaultClient = BaseComponent => {
|
|
|
127
127
|
|
|
128
128
|
const useVaultClient = () => {
|
|
129
129
|
const ctx = useContext(VaultContext)
|
|
130
|
+
|
|
131
|
+
if (!ctx) {
|
|
132
|
+
throw new Error('useVaultClient must be used within a VaultProvider')
|
|
133
|
+
}
|
|
130
134
|
return ctx.vaultClient
|
|
131
135
|
}
|
|
132
136
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
4
|
-
import React, { useState, useCallback, useMemo } from 'react';
|
|
4
|
+
import React, { useState, useCallback, useMemo, useEffect } from 'react';
|
|
5
5
|
import cx from 'classnames';
|
|
6
6
|
import get from 'lodash/get';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
@@ -15,6 +15,7 @@ import Icon from 'cozy-ui/transpiled/react/Icon';
|
|
|
15
15
|
import CozyTheme from 'cozy-ui/transpiled/react/CozyTheme';
|
|
16
16
|
import { IllustrationDialog } from 'cozy-ui/transpiled/react/CozyDialogs';
|
|
17
17
|
import KeychainIcon from 'cozy-ui/transpiled/react/Icons/Keychain';
|
|
18
|
+
import { useWebviewIntent } from 'cozy-intent';
|
|
18
19
|
import CloudIcon from './IconCozySecurity';
|
|
19
20
|
import PasswordField from './PasswordField';
|
|
20
21
|
import { useVaultClient } from './VaultContext';
|
|
@@ -104,6 +105,19 @@ var UnlockForm = function UnlockForm(props) {
|
|
|
104
105
|
return getPassphraseResetUrl(client);
|
|
105
106
|
}, [client]);
|
|
106
107
|
var canAuthWithOIDC = canClientAuthWithOIDC(client);
|
|
108
|
+
var webviewIntent = useWebviewIntent();
|
|
109
|
+
useEffect(function () {
|
|
110
|
+
webviewIntent && webviewIntent.call('setFlagshipUI', {
|
|
111
|
+
bottomTheme: 'light',
|
|
112
|
+
topTheme: 'light'
|
|
113
|
+
}, 'cozy-keys-lib/UnlockForm');
|
|
114
|
+
return function () {
|
|
115
|
+
return webviewIntent && webviewIntent.call('setFlagshipUI', {
|
|
116
|
+
bottomTheme: 'light',
|
|
117
|
+
topTheme: 'light'
|
|
118
|
+
}, 'cozy-keys-lib/UnlockForm');
|
|
119
|
+
};
|
|
120
|
+
}, [webviewIntent]);
|
|
107
121
|
return React.createElement(CozyTheme, {
|
|
108
122
|
variant: "inverted"
|
|
109
123
|
}, React.createElement(IllustrationDialog, {
|
|
@@ -178,6 +178,11 @@ var withVaultClient = function withVaultClient(BaseComponent) {
|
|
|
178
178
|
|
|
179
179
|
var useVaultClient = function useVaultClient() {
|
|
180
180
|
var ctx = useContext(VaultContext);
|
|
181
|
+
|
|
182
|
+
if (!ctx) {
|
|
183
|
+
throw new Error('useVaultClient must be used within a VaultProvider');
|
|
184
|
+
}
|
|
185
|
+
|
|
181
186
|
return ctx.vaultClient;
|
|
182
187
|
};
|
|
183
188
|
|