@webiny/app-admin-cognito 0.0.0-unstable.99666aeb00 → 0.0.0-unstable.a9593f74dd
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/index.d.ts +4 -2
- package/index.js +75 -106
- package/index.js.map +1 -1
- package/package.json +20 -20
- package/types.js +3 -1
- package/views/FederatedLogin.d.ts +7 -0
- package/views/FederatedLogin.js +41 -0
- package/views/FederatedLogin.js.map +1 -0
- package/views/ForgotPassword.d.ts +2 -2
- package/views/ForgotPassword.js +3 -1
- package/views/ForgotPassword.js.map +1 -1
- package/views/LoggingIn.d.ts +2 -2
- package/views/LoggingIn.js +3 -1
- package/views/LoggingIn.js.map +1 -1
- package/views/RequireNewPassword.d.ts +2 -2
- package/views/RequireNewPassword.js +3 -1
- package/views/RequireNewPassword.js.map +1 -1
- package/views/SetNewPassword.d.ts +2 -2
- package/views/SetNewPassword.js +3 -1
- package/views/SetNewPassword.js.map +1 -1
- package/views/SignIn.d.ts +6 -2
- package/views/SignIn.js +10 -3
- package/views/SignIn.js.map +1 -1
- package/views/SignedIn.d.ts +4 -1
- package/views/SignedIn.js +3 -1
- package/views/SignedIn.js.map +1 -1
- package/views/StateContainer.d.ts +4 -1
- package/views/StateContainer.js +3 -1
- package/views/StateContainer.js.map +1 -1
- package/views/StyledComponents.d.ts +0 -2
- package/views/StyledComponents.js +3 -1
- package/views/StyledComponents.js.map +1 -1
package/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AuthOptions } from "@aws-amplify/auth/lib-esm/types";
|
|
2
|
+
import { AuthOptions, CognitoHostedUIIdentityProvider } from "@aws-amplify/auth/lib-esm/types";
|
|
3
3
|
import ApolloClient from "apollo-client";
|
|
4
4
|
export interface AuthenticationProps {
|
|
5
5
|
children: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
+
export declare type CognitoFederatedProvider = keyof typeof CognitoHostedUIIdentityProvider;
|
|
7
8
|
export interface AuthenticationFactoryConfig extends AuthOptions {
|
|
9
|
+
federatedProviders?: CognitoFederatedProvider[];
|
|
8
10
|
onError?(error: Error): void;
|
|
9
11
|
getIdentityData(params: {
|
|
10
12
|
client: ApolloClient<any>;
|
|
@@ -16,7 +18,7 @@ export interface AuthenticationFactoryConfig extends AuthOptions {
|
|
|
16
18
|
}>;
|
|
17
19
|
}
|
|
18
20
|
interface AuthenticationFactory {
|
|
19
|
-
(params: AuthenticationFactoryConfig): React.
|
|
21
|
+
(params: AuthenticationFactoryConfig): React.ComponentType<AuthenticationProps>;
|
|
20
22
|
}
|
|
21
23
|
export declare const createAuthentication: AuthenticationFactory;
|
|
22
24
|
export {};
|
package/index.js
CHANGED
|
@@ -8,9 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.createAuthentication = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
|
-
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
12
11
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
14
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
15
13
|
var _auth = require("@aws-amplify/auth");
|
|
16
14
|
var _reactHooks = require("@apollo/react-hooks");
|
|
@@ -30,64 +28,51 @@ var _excluded = ["getIdentityData", "onError"],
|
|
|
30
28
|
_excluded2 = ["id", "displayName", "type", "permissions"];
|
|
31
29
|
var createApolloLinkPlugin = function createApolloLinkPlugin() {
|
|
32
30
|
return new _ApolloLinkPlugin.ApolloLinkPlugin(function () {
|
|
33
|
-
return (0, _apolloLinkContext.setContext)(
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (!(headers && headers.Authorization)) {
|
|
54
|
-
_context.next = 9;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
return _context.abrupt("return", {
|
|
58
|
-
headers: headers
|
|
59
|
-
});
|
|
60
|
-
case 9:
|
|
61
|
-
return _context.abrupt("return", {
|
|
62
|
-
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headers), {}, {
|
|
63
|
-
Authorization: "Bearer ".concat(idToken.getJwtToken())
|
|
64
|
-
})
|
|
65
|
-
});
|
|
66
|
-
case 10:
|
|
67
|
-
case "end":
|
|
68
|
-
return _context.stop();
|
|
69
|
-
}
|
|
70
|
-
}, _callee);
|
|
71
|
-
}));
|
|
72
|
-
return function (_x, _x2) {
|
|
73
|
-
return _ref2.apply(this, arguments);
|
|
31
|
+
return (0, _apolloLinkContext.setContext)(async function (_, _ref) {
|
|
32
|
+
var headers = _ref.headers;
|
|
33
|
+
var user = await _auth.Auth.currentSession();
|
|
34
|
+
var idToken = user.getIdToken();
|
|
35
|
+
if (!idToken) {
|
|
36
|
+
return {
|
|
37
|
+
headers: headers
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// If "Authorization" header is already set, don't overwrite it.
|
|
42
|
+
if (headers && headers.Authorization) {
|
|
43
|
+
return {
|
|
44
|
+
headers: headers
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
headers: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, headers), {}, {
|
|
49
|
+
Authorization: "Bearer ".concat(idToken.getJwtToken())
|
|
50
|
+
})
|
|
74
51
|
};
|
|
75
|
-
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
var validatePermissions = function validatePermissions(permissions) {
|
|
56
|
+
var appPermissions = permissions.filter(function (p) {
|
|
57
|
+
return p.name !== "aacl";
|
|
76
58
|
});
|
|
59
|
+
if (appPermissions.length === 0) {
|
|
60
|
+
throw new Error("You have no permissions on this tenant!");
|
|
61
|
+
}
|
|
77
62
|
};
|
|
78
63
|
var defaultOptions = {
|
|
79
64
|
region: _config.config.getKey("USER_POOL_REGION", process.env.REACT_APP_USER_POOL_REGION),
|
|
80
65
|
userPoolId: _config.config.getKey("USER_POOL_ID", process.env.REACT_APP_USER_POOL_ID),
|
|
81
66
|
userPoolWebClientId: _config.config.getKey("USER_POOL_WEB_CLIENT_ID", process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID)
|
|
82
67
|
};
|
|
83
|
-
var createAuthentication = function createAuthentication(
|
|
84
|
-
var getIdentityData =
|
|
85
|
-
onError =
|
|
86
|
-
config = (0, _objectWithoutProperties2.default)(
|
|
68
|
+
var createAuthentication = function createAuthentication(_ref2) {
|
|
69
|
+
var getIdentityData = _ref2.getIdentityData,
|
|
70
|
+
onError = _ref2.onError,
|
|
71
|
+
config = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
87
72
|
/**
|
|
88
73
|
* TODO @ts-refactor
|
|
89
74
|
*/
|
|
90
|
-
// @ts-
|
|
75
|
+
// @ts-expect-error
|
|
91
76
|
Object.keys(config).forEach(function (key) {
|
|
92
77
|
return config[key] === undefined && delete config[key];
|
|
93
78
|
});
|
|
@@ -101,69 +86,53 @@ var createAuthentication = function createAuthentication(_ref3) {
|
|
|
101
86
|
var _useSecurity = (0, _appSecurity.useSecurity)(),
|
|
102
87
|
setIdentity = _useSecurity.setIdentity;
|
|
103
88
|
var client = (0, _reactHooks.useApolloClient)();
|
|
104
|
-
var onToken = (0, _react.useCallback)(
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
displayName: displayName,
|
|
128
|
-
type: type,
|
|
129
|
-
permissions: permissions
|
|
130
|
-
}, data), {}, {
|
|
131
|
-
logout: logout || function () {
|
|
132
|
-
return void 0;
|
|
133
|
-
}
|
|
134
|
-
}));
|
|
135
|
-
_context2.next = 18;
|
|
136
|
-
break;
|
|
137
|
-
case 14:
|
|
138
|
-
_context2.prev = 14;
|
|
139
|
-
_context2.t0 = _context2["catch"](2);
|
|
140
|
-
console.log("ERROR", _context2.t0);
|
|
141
|
-
if (typeof onError === "function") {
|
|
142
|
-
onError(_context2.t0);
|
|
143
|
-
} else {
|
|
144
|
-
console.error(_context2.t0);
|
|
145
|
-
}
|
|
146
|
-
case 18:
|
|
147
|
-
_context2.prev = 18;
|
|
148
|
-
setLoadingIdentity(false);
|
|
149
|
-
return _context2.finish(18);
|
|
150
|
-
case 21:
|
|
151
|
-
case "end":
|
|
152
|
-
return _context2.stop();
|
|
89
|
+
var onToken = (0, _react.useCallback)(async function (token) {
|
|
90
|
+
var payload = token.payload,
|
|
91
|
+
logout = token.logout;
|
|
92
|
+
setLoadingIdentity(true);
|
|
93
|
+
try {
|
|
94
|
+
var _await$getIdentityDat = await getIdentityData({
|
|
95
|
+
client: client,
|
|
96
|
+
payload: payload
|
|
97
|
+
}),
|
|
98
|
+
id = _await$getIdentityDat.id,
|
|
99
|
+
displayName = _await$getIdentityDat.displayName,
|
|
100
|
+
type = _await$getIdentityDat.type,
|
|
101
|
+
permissions = _await$getIdentityDat.permissions,
|
|
102
|
+
data = (0, _objectWithoutProperties2.default)(_await$getIdentityDat, _excluded2);
|
|
103
|
+
validatePermissions(permissions);
|
|
104
|
+
setIdentity((0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
105
|
+
id: id,
|
|
106
|
+
displayName: displayName,
|
|
107
|
+
type: type,
|
|
108
|
+
permissions: permissions
|
|
109
|
+
}, data), {}, {
|
|
110
|
+
logout: logout || function () {
|
|
111
|
+
return void 0;
|
|
153
112
|
}
|
|
154
|
-
}
|
|
155
|
-
})
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
113
|
+
}));
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.log("ERROR", err);
|
|
116
|
+
if (typeof onError === "function") {
|
|
117
|
+
onError(err);
|
|
118
|
+
} else {
|
|
119
|
+
console.error(err);
|
|
120
|
+
}
|
|
121
|
+
} finally {
|
|
122
|
+
setLoadingIdentity(false);
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
160
125
|
(0, _react.useEffect)(function () {
|
|
161
126
|
_plugins.plugins.register(createApolloLinkPlugin());
|
|
162
127
|
}, []);
|
|
163
128
|
return /*#__PURE__*/_react.default.createElement(_Authenticator.Authenticator, {
|
|
164
129
|
onToken: onToken
|
|
165
|
-
}, loadingIdentity ? /*#__PURE__*/_react.default.createElement(_LoggingIn.default, null) : /*#__PURE__*/_react.default.createElement(_SignIn.default,
|
|
130
|
+
}, loadingIdentity ? /*#__PURE__*/_react.default.createElement(_LoggingIn.default, null) : /*#__PURE__*/_react.default.createElement(_SignIn.default, {
|
|
131
|
+
federatedProviders: config.federatedProviders
|
|
132
|
+
}), /*#__PURE__*/_react.default.createElement(_RequireNewPassword.default, null), /*#__PURE__*/_react.default.createElement(_ForgotPassword.default, null), /*#__PURE__*/_react.default.createElement(_SetNewPassword.default, null), /*#__PURE__*/_react.default.createElement(_SignedIn.default, null, children));
|
|
166
133
|
};
|
|
167
134
|
return Authentication;
|
|
168
135
|
};
|
|
169
|
-
exports.createAuthentication = createAuthentication;
|
|
136
|
+
exports.createAuthentication = createAuthentication;
|
|
137
|
+
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["createApolloLinkPlugin","ApolloLinkPlugin","setContext","_","headers","Auth","currentSession","user","idToken","getIdToken","Authorization","getJwtToken","defaultOptions","region","appConfig","getKey","process","env","REACT_APP_USER_POOL_REGION","userPoolId","REACT_APP_USER_POOL_ID","userPoolWebClientId","REACT_APP_USER_POOL_WEB_CLIENT_ID","createAuthentication","getIdentityData","onError","config","Object","keys","forEach","key","undefined","configure","Authentication","props","children","useState","loadingIdentity","setLoadingIdentity","useSecurity","setIdentity","client","useApolloClient","onToken","useCallback","token","payload","logout","id","displayName","type","permissions","data","console","log","error","useEffect","plugins","register"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { Auth } from \"@aws-amplify/auth\";\nimport { AuthOptions } from \"@aws-amplify/auth/lib-esm/types\";\nimport ApolloClient from \"apollo-client\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { setContext } from \"apollo-link-context\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloLinkPlugin } from \"@webiny/app/plugins/ApolloLinkPlugin\";\nimport { CognitoIdToken } from \"@webiny/app-cognito-authenticator/types\";\nimport { Authenticator } from \"@webiny/app-cognito-authenticator/Authenticator\";\nimport SignIn from \"~/views/SignIn\";\nimport RequireNewPassword from \"~/views/RequireNewPassword\";\nimport ForgotPassword from \"~/views/ForgotPassword\";\nimport SetNewPassword from \"~/views/SetNewPassword\";\nimport SignedIn from \"~/views/SignedIn\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { config as appConfig } from \"@webiny/app/config\";\nimport LoggingIn from \"~/views/LoggingIn\";\n\nconst createApolloLinkPlugin = (): ApolloLinkPlugin => {\n return new ApolloLinkPlugin(() => {\n return setContext(async (_, { headers }) => {\n const user = await Auth.currentSession();\n const idToken = user.getIdToken();\n\n if (!idToken) {\n return { headers };\n }\n\n // If \"Authorization\" header is already set, don't overwrite it.\n if (headers && headers.Authorization) {\n return { headers };\n }\n\n return {\n headers: {\n ...headers,\n Authorization: `Bearer ${idToken.getJwtToken()}`\n }\n };\n });\n });\n};\n\nconst defaultOptions = {\n region: appConfig.getKey(\"USER_POOL_REGION\", process.env.REACT_APP_USER_POOL_REGION),\n userPoolId: appConfig.getKey(\"USER_POOL_ID\", process.env.REACT_APP_USER_POOL_ID),\n userPoolWebClientId: appConfig.getKey(\n \"USER_POOL_WEB_CLIENT_ID\",\n process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID\n )\n};\n\nexport interface AuthenticationProps {\n children: React.ReactNode;\n}\n\nexport interface AuthenticationFactoryConfig extends AuthOptions {\n onError?(error: Error): void;\n getIdentityData(params: {\n client: ApolloClient<any>;\n payload: { [key: string]: any };\n }): Promise<{ [key: string]: any }>;\n}\n\ninterface AuthenticationFactory {\n (params: AuthenticationFactoryConfig): React.FC<AuthenticationProps>;\n}\nexport const createAuthentication: AuthenticationFactory = ({\n getIdentityData,\n onError,\n ...config\n}) => {\n /**\n * TODO @ts-refactor\n */\n // @ts-ignore\n Object.keys(config).forEach(key => config[key] === undefined && delete config[key]);\n Auth.configure({ ...defaultOptions, ...config });\n\n const Authentication: React.FC<AuthenticationProps> = props => {\n const { children } = props;\n const [loadingIdentity, setLoadingIdentity] = useState(false);\n const { setIdentity } = useSecurity();\n const client = useApolloClient();\n\n const onToken = useCallback(async (token: CognitoIdToken) => {\n const { payload, logout } = token;\n\n setLoadingIdentity(true);\n\n try {\n const { id, displayName, type, permissions, ...data } = await getIdentityData({\n client,\n payload\n });\n\n setIdentity({\n id,\n displayName,\n type,\n permissions,\n ...data,\n logout:\n logout ||\n (() => {\n return void 0;\n })\n });\n } catch (err) {\n console.log(\"ERROR\", err);\n if (typeof onError === \"function\") {\n onError(err);\n } else {\n console.error(err);\n }\n } finally {\n setLoadingIdentity(false);\n }\n }, []);\n\n useEffect(() => {\n plugins.register(createApolloLinkPlugin());\n }, []);\n\n return (\n <Authenticator onToken={onToken}>\n {loadingIdentity ? <LoggingIn /> : <SignIn />}\n <RequireNewPassword />\n <ForgotPassword />\n <SetNewPassword />\n <SignedIn>{children}</SignedIn>\n </Authenticator>\n );\n };\n\n return Authentication;\n};\n"],"mappings":";;;;;;;;;;;;;AAAA;AACA;AAGA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAA0C;EAAA;AAE1C,IAAMA,sBAAsB,GAAG,SAAzBA,sBAAsB,GAA2B;EACnD,OAAO,IAAIC,kCAAgB,CAAC,YAAM;IAC9B,OAAO,IAAAC,6BAAU;MAAA,mGAAC,iBAAOC,CAAC;QAAA;QAAA;UAAA;YAAA;cAAIC,OAAO,QAAPA,OAAO;cAAA;cAAA,OACdC,UAAI,CAACC,cAAc,EAAE;YAAA;cAAlCC,IAAI;cACJC,OAAO,GAAGD,IAAI,CAACE,UAAU,EAAE;cAAA,IAE5BD,OAAO;gBAAA;gBAAA;cAAA;cAAA,iCACD;gBAAEJ,OAAO,EAAPA;cAAQ,CAAC;YAAA;cAAA,MAIlBA,OAAO,IAAIA,OAAO,CAACM,aAAa;gBAAA;gBAAA;cAAA;cAAA,iCACzB;gBAAEN,OAAO,EAAPA;cAAQ,CAAC;YAAA;cAAA,iCAGf;gBACHA,OAAO,8DACAA,OAAO;kBACVM,aAAa,mBAAYF,OAAO,CAACG,WAAW,EAAE;gBAAE;cAExD,CAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CACJ;MAAA;QAAA;MAAA;IAAA,IAAC;EACN,CAAC,CAAC;AACN,CAAC;AAED,IAAMC,cAAc,GAAG;EACnBC,MAAM,EAAEC,cAAS,CAACC,MAAM,CAAC,kBAAkB,EAAEC,OAAO,CAACC,GAAG,CAACC,0BAA0B,CAAC;EACpFC,UAAU,EAAEL,cAAS,CAACC,MAAM,CAAC,cAAc,EAAEC,OAAO,CAACC,GAAG,CAACG,sBAAsB,CAAC;EAChFC,mBAAmB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;cAKnDZ,WAAW;gBACPQ,EAAE,EAAFA,EAAE;gBACFC,WAAW,EAAXA,WAAW;gBACXC,IAAI,EAAJA,IAAI;gBACJC,WAAW,EAAXA;cAAW,GACRC,IAAI;gBACPL,MAAM,EACFA,MAAM,IACL,YAAM;kBACH,OAAO,KAAK,CAAC;gBACjB;cAAE,GACR;cAAC;cAAA;YAAA;cAAA;cAAA;cAEHM,OAAO,CAACC,GAAG,CAAC,OAAO,eAAM;cACzB,IAAI,OAAO7B,OAAO,KAAK,UAAU,EAAE;gBAC/BA,OAAO,cAAK;cAChB,CAAC,MAAM;gBACH4B,OAAO,CAACE,KAAK,cAAK;cACtB;YAAC;cAAA;cAEDjB,kBAAkB,CAAC,KAAK,CAAC;cAAC;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA,CAEjC;MAAA;QAAA;MAAA;IAAA,KAAE,EAAE,CAAC;IAEN,IAAAkB,gBAAS,EAAC,YAAM;MACZC,gBAAO,CAACC,QAAQ,CAAC1D,sBAAsB,EAAE,CAAC;IAC9C,CAAC,EAAE,EAAE,CAAC;IAEN,oBACI,6BAAC,4BAAa;MAAC,OAAO,EAAE2C;IAAQ,GAC3BN,eAAe,gBAAG,6BAAC,kBAAS,OAAG,gBAAG,6BAAC,eAAM,OAAG,eAC7C,6BAAC,2BAAkB,OAAG,eACtB,6BAAC,uBAAc,OAAG,eAClB,6BAAC,uBAAc,OAAG,eAClB,6BAAC,iBAAQ,QAAEF,QAAQ,CAAY,CACnB;EAExB,CAAC;EAED,OAAOF,cAAc;AACzB,CAAC;AAAC"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_auth","_reactHooks","_apolloLinkContext","_plugins","_ApolloLinkPlugin","_Authenticator","_SignIn","_interopRequireDefault","_RequireNewPassword","_ForgotPassword","_SetNewPassword","_SignedIn","_appSecurity","_config","_LoggingIn","_excluded","_excluded2","createApolloLinkPlugin","ApolloLinkPlugin","setContext","_","_ref","headers","user","Auth","currentSession","idToken","getIdToken","Authorization","_objectSpread2","default","concat","getJwtToken","validatePermissions","permissions","appPermissions","filter","p","name","length","Error","defaultOptions","region","appConfig","getKey","process","env","REACT_APP_USER_POOL_REGION","userPoolId","REACT_APP_USER_POOL_ID","userPoolWebClientId","REACT_APP_USER_POOL_WEB_CLIENT_ID","createAuthentication","_ref2","getIdentityData","onError","config","_objectWithoutProperties2","Object","keys","forEach","key","undefined","configure","Authentication","props","children","_useState","useState","_useState2","_slicedToArray2","loadingIdentity","setLoadingIdentity","_useSecurity","useSecurity","setIdentity","client","useApolloClient","onToken","useCallback","token","payload","logout","_await$getIdentityDat","id","displayName","type","data","err","console","log","error","useEffect","plugins","register","createElement","Authenticator","federatedProviders","exports"],"sources":["index.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from \"react\";\nimport { Auth } from \"@aws-amplify/auth\";\nimport { AuthOptions, CognitoHostedUIIdentityProvider } from \"@aws-amplify/auth/lib-esm/types\";\nimport ApolloClient from \"apollo-client\";\nimport { useApolloClient } from \"@apollo/react-hooks\";\nimport { setContext } from \"apollo-link-context\";\nimport { plugins } from \"@webiny/plugins\";\nimport { ApolloLinkPlugin } from \"@webiny/app/plugins/ApolloLinkPlugin\";\nimport { SecurityPermission } from \"@webiny/app-security/types\";\nimport { CognitoIdToken } from \"@webiny/app-cognito-authenticator/types\";\nimport { Authenticator } from \"@webiny/app-cognito-authenticator/Authenticator\";\nimport SignIn from \"~/views/SignIn\";\nimport RequireNewPassword from \"~/views/RequireNewPassword\";\nimport ForgotPassword from \"~/views/ForgotPassword\";\nimport SetNewPassword from \"~/views/SetNewPassword\";\nimport SignedIn from \"~/views/SignedIn\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { config as appConfig } from \"@webiny/app/config\";\nimport LoggingIn from \"~/views/LoggingIn\";\n\nconst createApolloLinkPlugin = (): ApolloLinkPlugin => {\n return new ApolloLinkPlugin(() => {\n return setContext(async (_, { headers }) => {\n const user = await Auth.currentSession();\n const idToken = user.getIdToken();\n\n if (!idToken) {\n return { headers };\n }\n\n // If \"Authorization\" header is already set, don't overwrite it.\n if (headers && headers.Authorization) {\n return { headers };\n }\n\n return {\n headers: {\n ...headers,\n Authorization: `Bearer ${idToken.getJwtToken()}`\n }\n };\n });\n });\n};\n\nconst validatePermissions = (permissions: SecurityPermission[]) => {\n const appPermissions = permissions.filter(p => p.name !== \"aacl\");\n if (appPermissions.length === 0) {\n throw new Error(\"You have no permissions on this tenant!\");\n }\n};\n\nconst defaultOptions = {\n region: appConfig.getKey(\"USER_POOL_REGION\", process.env.REACT_APP_USER_POOL_REGION),\n userPoolId: appConfig.getKey(\"USER_POOL_ID\", process.env.REACT_APP_USER_POOL_ID),\n userPoolWebClientId: appConfig.getKey(\n \"USER_POOL_WEB_CLIENT_ID\",\n process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID\n )\n};\n\nexport interface AuthenticationProps {\n children: React.ReactNode;\n}\n\nexport type CognitoFederatedProvider = keyof typeof CognitoHostedUIIdentityProvider;\n\nexport interface AuthenticationFactoryConfig extends AuthOptions {\n federatedProviders?: CognitoFederatedProvider[];\n onError?(error: Error): void;\n getIdentityData(params: {\n client: ApolloClient<any>;\n payload: { [key: string]: any };\n }): Promise<{ [key: string]: any }>;\n}\n\ninterface AuthenticationFactory {\n (params: AuthenticationFactoryConfig): React.ComponentType<AuthenticationProps>;\n}\n\nexport const createAuthentication: AuthenticationFactory = ({\n getIdentityData,\n onError,\n ...config\n}) => {\n /**\n * TODO @ts-refactor\n */\n // @ts-expect-error\n Object.keys(config).forEach(key => config[key] === undefined && delete config[key]);\n Auth.configure({ ...defaultOptions, ...config });\n\n const Authentication = (props: AuthenticationProps) => {\n const { children } = props;\n const [loadingIdentity, setLoadingIdentity] = useState(false);\n const { setIdentity } = useSecurity();\n const client = useApolloClient();\n\n const onToken = useCallback(async (token: CognitoIdToken) => {\n const { payload, logout } = token;\n\n setLoadingIdentity(true);\n\n try {\n const { id, displayName, type, permissions, ...data } = await getIdentityData({\n client,\n payload\n });\n\n validatePermissions(permissions);\n\n setIdentity({\n id,\n displayName,\n type,\n permissions,\n ...data,\n logout:\n logout ||\n (() => {\n return void 0;\n })\n });\n } catch (err) {\n console.log(\"ERROR\", err);\n if (typeof onError === \"function\") {\n onError(err);\n } else {\n console.error(err);\n }\n } finally {\n setLoadingIdentity(false);\n }\n }, []);\n\n useEffect(() => {\n plugins.register(createApolloLinkPlugin());\n }, []);\n\n return (\n <Authenticator onToken={onToken}>\n {loadingIdentity ? (\n <LoggingIn />\n ) : (\n <SignIn federatedProviders={config.federatedProviders} />\n )}\n <RequireNewPassword />\n <ForgotPassword />\n <SetNewPassword />\n <SignedIn>{children}</SignedIn>\n </Authenticator>\n );\n };\n\n return Authentication;\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAGA,IAAAM,cAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAC,sBAAA,CAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAD,sBAAA,CAAAR,OAAA;AACA,IAAAU,eAAA,GAAAF,sBAAA,CAAAR,OAAA;AACA,IAAAW,eAAA,GAAAH,sBAAA,CAAAR,OAAA;AACA,IAAAY,SAAA,GAAAJ,sBAAA,CAAAR,OAAA;AACA,IAAAa,YAAA,GAAAb,OAAA;AACA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,UAAA,GAAAP,sBAAA,CAAAR,OAAA;AAA0C,IAAAgB,SAAA;EAAAC,UAAA;AAE1C,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA,EAA2B;EACnD,OAAO,IAAIC,kCAAgB,CAAC,YAAM;IAC9B,OAAO,IAAAC,6BAAU,EAAC,gBA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,MAAE,CAAC,gBAEbjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACzF,OAAA,CAAAwB,OAAM;MAACmE,kBAAkB,EAAEzC,MAAM,CAACyC;IAAmB,CAAE,CAC3D,eACDpG,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACvF,mBAAA,CAAAsB,OAAkB,MAAE,CAAC,eACtBjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACtF,eAAA,CAAAqB,OAAc,MAAE,CAAC,eAClBjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACrF,eAAA,CAAAoB,OAAc,MAAE,CAAC,eAClBjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACpF,SAAA,CAAAmB,OAAQ,QAAEoC,QAAmB,CACnB,CAAC;EAExB,CAAC;EAED,OAAOF,cAAc;AACzB,CAAC;AAACkC,OAAA,CAAA9C,oBAAA,GAAAA,oBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-admin-cognito",
|
|
3
|
-
"version": "0.0.0-unstable.
|
|
3
|
+
"version": "0.0.0-unstable.a9593f74dd",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,31 +15,31 @@
|
|
|
15
15
|
"@apollo/react-hooks": "3.1.5",
|
|
16
16
|
"@aws-amplify/auth": "5.1.9",
|
|
17
17
|
"@emotion/styled": "11.10.6",
|
|
18
|
-
"@webiny/app": "0.0.0-unstable.
|
|
19
|
-
"@webiny/app-admin": "0.0.0-unstable.
|
|
20
|
-
"@webiny/app-cognito-authenticator": "0.0.0-unstable.
|
|
21
|
-
"@webiny/app-security": "0.0.0-unstable.
|
|
22
|
-
"@webiny/form": "0.0.0-unstable.
|
|
23
|
-
"@webiny/plugins": "0.0.0-unstable.
|
|
24
|
-
"@webiny/ui": "0.0.0-unstable.
|
|
25
|
-
"@webiny/validation": "0.0.0-unstable.
|
|
18
|
+
"@webiny/app": "0.0.0-unstable.a9593f74dd",
|
|
19
|
+
"@webiny/app-admin": "0.0.0-unstable.a9593f74dd",
|
|
20
|
+
"@webiny/app-cognito-authenticator": "0.0.0-unstable.a9593f74dd",
|
|
21
|
+
"@webiny/app-security": "0.0.0-unstable.a9593f74dd",
|
|
22
|
+
"@webiny/form": "0.0.0-unstable.a9593f74dd",
|
|
23
|
+
"@webiny/plugins": "0.0.0-unstable.a9593f74dd",
|
|
24
|
+
"@webiny/ui": "0.0.0-unstable.a9593f74dd",
|
|
25
|
+
"@webiny/validation": "0.0.0-unstable.a9593f74dd",
|
|
26
26
|
"apollo-client": "2.6.10",
|
|
27
27
|
"apollo-link-context": "1.0.20",
|
|
28
28
|
"emotion": "10.0.27",
|
|
29
29
|
"react": "17.0.2",
|
|
30
|
-
"react-dom": "17.0.2"
|
|
30
|
+
"react-dom": "17.0.2",
|
|
31
|
+
"react-social-login-buttons": "3.9.1"
|
|
31
32
|
},
|
|
32
33
|
"devDependencies": {
|
|
33
|
-
"@babel/cli": "7.
|
|
34
|
-
"@babel/core": "7.
|
|
34
|
+
"@babel/cli": "7.22.6",
|
|
35
|
+
"@babel/core": "7.22.8",
|
|
35
36
|
"@babel/plugin-proposal-class-properties": "7.18.6",
|
|
36
|
-
"@babel/plugin-proposal-throw-expressions": "7.
|
|
37
|
-
"@babel/preset-env": "7.
|
|
38
|
-
"@babel/preset-react": "7.
|
|
39
|
-
"@babel/preset-typescript": "7.
|
|
40
|
-
"@webiny/cli": "0.0.0-unstable.
|
|
41
|
-
"@webiny/project-utils": "0.0.0-unstable.
|
|
42
|
-
"babel-plugin-lodash": "3.3.4",
|
|
37
|
+
"@babel/plugin-proposal-throw-expressions": "7.22.5",
|
|
38
|
+
"@babel/preset-env": "7.22.7",
|
|
39
|
+
"@babel/preset-react": "7.22.5",
|
|
40
|
+
"@babel/preset-typescript": "7.22.5",
|
|
41
|
+
"@webiny/cli": "0.0.0-unstable.a9593f74dd",
|
|
42
|
+
"@webiny/project-utils": "0.0.0-unstable.a9593f74dd",
|
|
43
43
|
"rimraf": "3.0.2",
|
|
44
44
|
"ttypescript": "1.5.15",
|
|
45
45
|
"typescript": "4.7.4"
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
]
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "a9593f74ddf9ce93263eadb0ddc0807ed343f5ee"
|
|
63
63
|
}
|
package/types.js
CHANGED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CognitoFederatedProvider } from "../index";
|
|
3
|
+
interface FederatedLoginProps {
|
|
4
|
+
providers: CognitoFederatedProvider[];
|
|
5
|
+
}
|
|
6
|
+
export declare const FederatedLogin: ({ providers }: FederatedLoginProps) => JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FederatedLogin = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _auth = require("@aws-amplify/auth");
|
|
11
|
+
var _reactSocialLoginButtons = require("react-social-login-buttons");
|
|
12
|
+
var federatedButtons = {
|
|
13
|
+
Facebook: _reactSocialLoginButtons.FacebookLoginButton,
|
|
14
|
+
Google: _reactSocialLoginButtons.GoogleLoginButton,
|
|
15
|
+
Amazon: _reactSocialLoginButtons.AmazonLoginButton,
|
|
16
|
+
Apple: _reactSocialLoginButtons.AppleLoginButton,
|
|
17
|
+
Cognito: function Cognito() {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var FederatedContainer = /*#__PURE__*/(0, _styled.default)("div", {
|
|
22
|
+
label: "FederatedContainer",
|
|
23
|
+
target: "e1ucz8yn0"
|
|
24
|
+
})("border-top:1px solid #ececec;padding-top:20px;");
|
|
25
|
+
var FederatedLogin = function FederatedLogin(_ref) {
|
|
26
|
+
var providers = _ref.providers;
|
|
27
|
+
return /*#__PURE__*/_react.default.createElement(FederatedContainer, null, providers.map(function (provider) {
|
|
28
|
+
var Button = federatedButtons[provider];
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(Button, {
|
|
30
|
+
key: provider,
|
|
31
|
+
onClick: function onClick() {
|
|
32
|
+
return _auth.Auth.federatedSignIn({
|
|
33
|
+
provider: _auth.CognitoHostedUIIdentityProvider[provider]
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}));
|
|
38
|
+
};
|
|
39
|
+
exports.FederatedLogin = FederatedLogin;
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=FederatedLogin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_styled","_auth","_reactSocialLoginButtons","federatedButtons","Facebook","FacebookLoginButton","Google","GoogleLoginButton","Amazon","AmazonLoginButton","Apple","AppleLoginButton","Cognito","FederatedContainer","styled","label","target","FederatedLogin","_ref","providers","default","createElement","map","provider","Button","key","onClick","Auth","federatedSignIn","CognitoHostedUIIdentityProvider","exports"],"sources":["FederatedLogin.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport { Auth, CognitoHostedUIIdentityProvider } from \"@aws-amplify/auth\";\nimport {\n FacebookLoginButton,\n GoogleLoginButton,\n AppleLoginButton,\n AmazonLoginButton\n} from \"react-social-login-buttons\";\nimport { CognitoFederatedProvider } from \"~/index\";\n\nconst federatedButtons = {\n Facebook: FacebookLoginButton,\n Google: GoogleLoginButton,\n Amazon: AmazonLoginButton,\n Apple: AppleLoginButton,\n Cognito: () => null\n};\n\nconst FederatedContainer = styled.div`\n border-top: 1px solid #ececec;\n padding-top: 20px;\n`;\n\ninterface FederatedLoginProps {\n providers: CognitoFederatedProvider[];\n}\n\nexport const FederatedLogin = ({ providers }: FederatedLoginProps) => {\n return (\n <FederatedContainer>\n {providers.map(provider => {\n const Button = federatedButtons[provider];\n\n return (\n <Button\n key={provider}\n onClick={() =>\n Auth.federatedSignIn({\n provider: CognitoHostedUIIdentityProvider[provider]\n })\n }\n />\n );\n })}\n </FederatedContainer>\n );\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,wBAAA,GAAAH,OAAA;AAQA,IAAMI,gBAAgB,GAAG;EACrBC,QAAQ,EAAEC,4CAAmB;EAC7BC,MAAM,EAAEC,0CAAiB;EACzBC,MAAM,EAAEC,0CAAiB;EACzBC,KAAK,EAAEC,yCAAgB;EACvBC,OAAO,EAAE,SAAAA,QAAA;IAAA,OAAM,IAAI;EAAA;AACvB,CAAC;AAED,IAAMC,kBAAkB,oBAAGC,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,oDAGhC;AAMM,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAA2C;EAAA,IAArCC,SAAS,GAAAD,IAAA,CAATC,SAAS;EACtC,oBACItB,MAAA,CAAAuB,OAAA,CAAAC,aAAA,CAACR,kBAAkB,QACdM,SAAS,CAACG,GAAG,CAAC,UAAAC,QAAQ,EAAI;IACvB,IAAMC,MAAM,GAAGrB,gBAAgB,CAACoB,QAAQ,CAAC;IAEzC,oBACI1B,MAAA,CAAAuB,OAAA,CAAAC,aAAA,CAACG,MAAM;MACHC,GAAG,EAAEF,QAAS;MACdG,OAAO,EAAE,SAAAA,QAAA;QAAA,OACLC,UAAI,CAACC,eAAe,CAAC;UACjBL,QAAQ,EAAEM,qCAA+B,CAACN,QAAQ;QACtD,CAAC,CAAC;MAAA;IACL,CACJ,CAAC;EAEV,CAAC,CACe,CAAC;AAE7B,CAAC;AAACO,OAAA,CAAAb,cAAA,GAAAA,cAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const ForgotPassword:
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const ForgotPassword: () => JSX.Element | null;
|
|
3
3
|
export default ForgotPassword;
|
package/views/ForgotPassword.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ForgotPassword","useAuthenticator","authData","changeState","useForgotPassword","loading","codeSent","shouldRender","setPassword","requestCode","error","username","Bind","submit","data","validation","create","val","cb","toLowerCase","alignRight","ev","textAlign"],"sources":["ForgotPassword.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport { useForgotPassword } from \"@webiny/app-cognito-authenticator/hooks/useForgotPassword\";\n\nconst ForgotPassword: React.FC = () => {\n const { authData, changeState } = useAuthenticator();\n const { loading, codeSent, shouldRender, setPassword, requestCode, error } =\n useForgotPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n const { username = \"\" } = authData || {};\n\n return (\n <StateContainer>\n <Form\n data={{ username }}\n onSubmit={({ username }) =>\n codeSent ? setPassword({ username }) : requestCode({ username })\n }\n submitOnEnter\n >\n {({ Bind, submit, data }) => (\n <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Password Recovery</Typography>\n </h1>\n <p>\n <Typography use=\"body2\">\n request a password reset code\n </Typography>\n </p>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12}>\n <Alert title={\"Something went wrong\"} type={\"danger\"}>\n {error}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {!codeSent ? (\n <>\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required\")}\n beforeChange={(\n val: string,\n cb: (value: string) => void\n ) => cb(val.toLowerCase())}\n >\n <Input\n label={\"Email\"}\n description={\n \"A reset code will be sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n data-testid=\"send-code\"\n >\n {\"Send me the code\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n ) : (\n <>\n <Grid>\n <Cell span={12}>\n <Typography use=\"body1\">\n We have sent you a code to reset your password!\n <br />\n <br />\n Click the "Resend code" button below\n to resend the code in case you haven't\n received it the first time.\n </Typography>\n </Cell>\n </Grid>\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonDefault\n onClick={() => {\n requestCode({ username: data.username });\n }}\n >\n {\"Resend code\"}\n </ButtonDefault>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n >\n I got the code!\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n )}\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default ForgotPassword;\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;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EAAE,iBAAAU,EAAE,EAAI;QACXR,MAAM,CAACQ,EAAE,CAAC;MACd;IAAE,GACL,iBAED,CAAgB,CACb,CACJ,CAEd,CACU,CACP,eACZ,oBAAC,UAAI,qBACD,oBAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjB;MAAG,IAAI,EAAE,GAAI;MAAC,OAAO,EAAE;QAAA,OAAMnB,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEpD,CAAI,CACD,CACJ,CACR;EAAA,CACN,CACE,CACM;AAEzB,CAAC;AAAC,eAEaH,cAAc;AAAA"}
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Alert","_Elevation","_StateContainer","_interopRequireDefault","_StyledComponents","_Progress","_useAuthenticator2","_useForgotPassword2","ForgotPassword","_useAuthenticator","useAuthenticator","authData","changeState","_useForgotPassword","useForgotPassword","loading","codeSent","shouldRender","setPassword","requestCode","error","_ref","_ref$username","username","createElement","default","Form","data","onSubmit","_ref2","submitOnEnter","_ref3","Bind","submit","Fragment","Elevation","z","InnerContent","CircularProgress","Title","Typography","use","Grid","Cell","span","Alert","title","type","name","validators","validation","create","beforeChange","val","cb","toLowerCase","Input","label","description","className","alignRight","ButtonPrimary","onClick","ev","ButtonDefault","style","textAlign","href","_default","exports"],"sources":["ForgotPassword.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary, ButtonDefault } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport { useForgotPassword } from \"@webiny/app-cognito-authenticator/hooks/useForgotPassword\";\n\nconst ForgotPassword = () => {\n const { authData, changeState } = useAuthenticator();\n const { loading, codeSent, shouldRender, setPassword, requestCode, error } =\n useForgotPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n const { username = \"\" } = authData || {};\n\n return (\n <StateContainer>\n <Form\n data={{ username }}\n onSubmit={({ username }) =>\n codeSent ? setPassword({ username }) : requestCode({ username })\n }\n submitOnEnter\n >\n {({ Bind, submit, data }) => (\n <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Password Recovery</Typography>\n </h1>\n <p>\n <Typography use=\"body2\">\n request a password reset code\n </Typography>\n </p>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12}>\n <Alert title={\"Something went wrong\"} type={\"danger\"}>\n {error}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {!codeSent ? (\n <>\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required\")}\n beforeChange={(\n val: string,\n cb: (value: string) => void\n ) => cb(val.toLowerCase())}\n >\n <Input\n label={\"Email\"}\n description={\n \"A reset code will be sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n data-testid=\"send-code\"\n >\n {\"Send me the code\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n ) : (\n <>\n <Grid>\n <Cell span={12}>\n <Typography use=\"body1\">\n We have sent you a code to reset your password!\n <br />\n <br />\n Click the "Resend code" button below\n to resend the code in case you haven't\n received it the first time.\n </Typography>\n </Cell>\n </Grid>\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonDefault\n onClick={() => {\n requestCode({ username: data.username });\n }}\n >\n {\"Resend code\"}\n </ButtonDefault>\n <ButtonPrimary\n onClick={ev => {\n submit(ev);\n }}\n >\n I got the code!\n </ButtonPrimary>\n </Cell>\n </Grid>\n </>\n )}\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default ForgotPassword;\n"],"mappings":";;;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,iBAAA,GAAAX,OAAA;AACA,IAAAY,SAAA,GAAAZ,OAAA;AACA,IAAAa,kBAAA,GAAAb,OAAA;AACA,IAAAc,mBAAA,GAAAd,OAAA;AAEA,IAAMe,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EACzB,IAAAC,iBAAA,GAAkC,IAAAC,mCAAgB,EAAC,CAAC;IAA5CC,QAAQ,GAAAF,iBAAA,CAARE,QAAQ;IAAEC,WAAW,GAAAH,iBAAA,CAAXG,WAAW;EAC7B,IAAAC,kBAAA,GACI,IAAAC,qCAAiB,EAAC,CAAC;IADfC,OAAO,GAAAF,kBAAA,CAAPE,OAAO;IAAEC,QAAQ,GAAAH,kBAAA,CAARG,QAAQ;IAAEC,YAAY,GAAAJ,kBAAA,CAAZI,YAAY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ACb,CACJ,CACR,CAEI,CACP,CAAC,eACZxE,KAAA,CAAAiC,aAAA,CAAC1B,KAAA,CAAA4C,IAAI,qBACDnD,KAAA,CAAAiC,aAAA,CAAC1B,KAAA,CAAA6C,IAAI;MAACC,IAAI,EAAE,EAAG;MAACqB,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjB3E,KAAA,CAAAiC,aAAA;MAAG2C,IAAI,EAAE,GAAI;MAACL,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAMlD,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEjD,CACD,CACJ,CACR,CAAC;EAAA,CAEL,CACM,CAAC;AAEzB,CAAC;AAAC,IAAAwD,QAAA,GAEa5D,cAAc;AAAA6D,OAAA,CAAA5C,OAAA,GAAA2C,QAAA"}
|
package/views/LoggingIn.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const LoggingIn:
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const LoggingIn: () => JSX.Element;
|
|
3
3
|
export default LoggingIn;
|
package/views/LoggingIn.js
CHANGED
package/views/LoggingIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["LoggingIn"],"sources":["LoggingIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nconst LoggingIn
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_Progress","LoggingIn","default","createElement","CircularProgress","label","_default","exports"],"sources":["LoggingIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\n\nconst LoggingIn = () => {\n return <CircularProgress label={\"Loading identity...\"} />;\n};\n\nexport default LoggingIn;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAEA,IAAME,SAAS,GAAG,SAAZA,SAASA,CAAA,EAAS;EACpB,oBAAOJ,MAAA,CAAAK,OAAA,CAAAC,aAAA,CAACH,SAAA,CAAAI,gBAAgB;IAACC,KAAK,EAAE;EAAsB,CAAE,CAAC;AAC7D,CAAC;AAAC,IAAAC,QAAA,GAEaL,SAAS;AAAAM,OAAA,CAAAL,OAAA,GAAAI,QAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const RequireNewPassword:
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const RequireNewPassword: () => JSX.Element | null;
|
|
3
3
|
export default RequireNewPassword;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","useRequireNewPassword","shouldRender","requiredAttributes","confirm","password","Bind","submit","validation","create","length","map","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Elevation","_useRequireNewPassword","_StateContainer","_StyledComponents","sentenceCase","str","lower","toLowerCase","toUpperCase","substring","RequireNewPassword","_useRequireNewPasswor","useRequireNewPassword","shouldRender","requiredAttributes","confirm","default","createElement","Form","onSubmit","_ref","password","submitOnEnter","_ref2","Bind","submit","Elevation","z","InnerContent","Title","Typography","use","Grid","Cell","span","name","validators","validation","create","Input","type","label","outlined","length","map","key","className","alignRight","ButtonPrimary","onClick","ev","_default","exports"],"sources":["RequireNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { useRequireNewPassword } from \"@webiny/app-cognito-authenticator/hooks/useRequireNewPassword\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title } from \"./StyledComponents\";\n\nconst sentenceCase = (str: string) => {\n const lower = str.toLowerCase();\n return lower[0].toUpperCase() + lower.substring(1);\n};\n\nconst RequireNewPassword = () => {\n const { shouldRender, requiredAttributes, confirm } = useRequireNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={({ password, requiredAttributes }) =>\n confirm({ password, requiredAttributes })\n }\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n <Title>\n <Typography use=\"headline4\">Set New Password</Typography>\n </Title>\n\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n />\n </Bind>\n </Cell>\n </Grid>\n {requiredAttributes.length > 0 && (\n <Title>\n <Typography use=\"headline6\">\n Please enter additional information\n </Typography>\n </Title>\n )}\n <Grid>\n {requiredAttributes.map(name => (\n <Cell key={name} span={12}>\n <Bind\n name={name}\n validators={validation.create(\"required\")}\n >\n <Input label={sentenceCase(name)} outlined={true} />\n </Bind>\n </Cell>\n ))}\n </Grid>\n\n <Grid>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default RequireNewPassword;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GA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AAG,gBACtB3C,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACO,IAAI;QACDW,IAAI,EAAEA,IAAK;QACXC,UAAU,EAAEC,sBAAU,CAACC,MAAM,CAAC,UAAU;MAAE,gBAE1C/C,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACpB,MAAA,CAAA0C,KAAK;QAACE,KAAK,EAAErC,YAAY,CAAC+B,IAAI,CAAE;QAACO,QAAQ,EAAE;MAAK,CAAE,CACjD,CACJ,CAAC;IAAA,CACV,CACC,CAAC,eAEPnD,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACnB,KAAA,CAAAkC,IAAI,qBACDzC,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACnB,KAAA,CAAAmC,IAAI;MAACC,IAAI,EAAE,EAAG;MAACY,SAAS,EAAEC;IAAW,gBAClCxD,MAAA,CAAAyB,OAAA,CAAAC,aAAA,CAACrB,OAAA,CAAAoD,aAAa;MACV,eAAY,4BAA4B;MACxCC,OAAO,EAAE,SAAAA,QAAAC,EAAE,EAAI;QACXzB,MAAM,CAACyB,EAAE,CAAC;MACd;IAAE,GAED,cACU,CACb,CACJ,CACI,CACP,CAAC;EAAA,CAEd,CACM,CAAC;AAEzB,CAAC;AAAC,IAAAC,QAAA,GAEazC,kBAAkB;AAAA0C,OAAA,CAAApC,OAAA,GAAAmC,QAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare const SetNewPassword:
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const SetNewPassword: () => JSX.Element | null;
|
|
3
3
|
export default SetNewPassword;
|
package/views/SetNewPassword.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SetNewPassword","useAuthenticator","changeState","useSetNewPassword","shouldRender","setPassword","error","loading","data","Bind","submit","retypePasswordValidator","value","password","Error","errorMessage","validation","create","alignRight","ev","textAlign"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title, errorMessage } from \"./StyledComponents\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSetNewPassword,\n UseSetNewPasswordCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\n\nconst SetNewPassword: React.FC = () => {\n const { changeState } = useAuthenticator();\n const { shouldRender, setPassword, error, loading } = useSetNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSetNewPasswordCallableParams\n */\n return setPassword(data as unknown as UseSetNewPasswordCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit, data }) => {\n const retypePasswordValidator = (value: string) => {\n if (value !== data.password) {\n throw Error(\"Passwords do not match!\");\n }\n };\n\n return (\n <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">\n Set New Password\n </Typography>\n </h1>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n {error}\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12} data-testid=\"password-reset-code\">\n <Bind\n name=\"code\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete=\"off\"\n label={\"Password reset code\"}\n outlined={true}\n description={\n \"Enter the code we sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"new-password-input\">\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete={\"off\"}\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n description={\"Enter your new password.\"}\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"retype-password-input\">\n <Bind\n name=\"retypePassword\"\n validators={[\n validation.create(\"required\"),\n retypePasswordValidator\n ]}\n >\n <Input\n type={\"password\"}\n label={\"Retype password\"}\n outlined={true}\n description={\n \"Enter your new password once more.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-btn-new-psw\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set new password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n );\n }}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SetNewPassword;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA,IAAMA,cAAwB,GAAG,SAA3BA,cAAwB,GAAS;EACnC,wBAAwB,IAAAC,mCAAgB,GAAE;IAAlCC,WAAW,qBAAXA,WAAW;EACnB,yBAAsD,IAAAC,qCAAiB,GAAE;IAAjEC,YAAY,sBAAZA,YAAY;IAAEC,WAAW,sBAAXA,WAAW;IAAEC,KAAK,sBAALA,KAAK;IAAEC,OAAO,sBAAPA,OAAO;EAEjD,IAAI,CAACH,YAAY,EAAE;IACf,OAAO,IAAI;EACf;EAEA,oBACI,6BAAC,uBAAc,qBACX,6BAAC,UAAI;IACD,QAAQ,EAAE,kBAAAI,IAAI,EAAI;MACd;AACpB;AACA;MACoB,OAAOH,WAAW,CAACG,IAAI,CAA+C;IAC1E,CAAE;IACF,aAAa;EAAA,GAEZ,gBAA4B;IAAA,IAAzBC,IAAI,QAAJA,IAAI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IAAI,EAAE,EAAG;MAAC,eAAY;IAAuB,gBAC/C,6BAAC,IAAI;MACD,IAAI,EAAC,gBAAgB;MACrB,UAAU,EAAE,CACRD,sBAAU,CAACC,MAAM,CAAC,UAAU,CAAC,EAC7BN,uBAAuB;IACzB,gBAEF,6BAAC,YAAK;MACF,IAAI,EAAE,UAAW;MACjB,KAAK,EAAE,iBAAkB;MACzB,QAAQ,EAAE,IAAK;MACf,WAAW,EACP;IACH,EACH,CACC,CACJ,eACP,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,SAAS,EAAEO;IAAW,gBAClC,6BAAC,qBAAa;MACV,eAAY,oBAAoB;MAChC,OAAO,EAAE,iBAAAC,EAAE,EAAI;QACXT,MAAM,CAACS,EAAE,CAAC;MACd;IAAE,GAED,kBAAkB,CACP,CACb,CACJ,CACI,CACP,eACZ,6BAAC,UAAI,qBACD,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjB;MAAG,IAAI,EAAE,GAAI;MAAC,OAAO,EAAE;QAAA,OAAMlB,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEpD,CAAI,CACD,CACJ,CACR;EAEX,CAAC,CACE,CACM;AAEzB,CAAC;AAAC,eAEaF,cAAc;AAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Elevation","_Progress","_StateContainer","_StyledComponents","_useAuthenticator2","_useSetNewPassword2","SetNewPassword","_useAuthenticator","useAuthenticator","changeState","_useSetNewPassword","useSetNewPassword","shouldRender","setPassword","error","loading","default","createElement","Form","onSubmit","data","submitOnEnter","_ref","Bind","submit","retypePasswordValidator","value","password","Error","Fragment","Elevation","z","InnerContent","CircularProgress","Title","Typography","use","Grid","Cell","span","className","errorMessage","name","validators","validation","create","Input","autoComplete","label","outlined","description","type","alignRight","ButtonPrimary","onClick","ev","style","textAlign","href","_default","exports"],"sources":["SetNewPassword.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, InnerContent, Title, errorMessage } from \"./StyledComponents\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSetNewPassword,\n UseSetNewPasswordCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSetNewPassword\";\n\nconst SetNewPassword = () => {\n const { changeState } = useAuthenticator();\n const { shouldRender, setPassword, error, loading } = useSetNewPassword();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSetNewPasswordCallableParams\n */\n return setPassword(data as unknown as UseSetNewPasswordCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit, data }) => {\n const retypePasswordValidator = (value: string) => {\n if (value !== data.password) {\n throw Error(\"Passwords do not match!\");\n }\n };\n\n return (\n <>\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress />}\n <Title>\n <h1>\n <Typography use=\"headline4\">\n Set New Password\n </Typography>\n </h1>\n </Title>\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n {error}\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12} data-testid=\"password-reset-code\">\n <Bind\n name=\"code\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete=\"off\"\n label={\"Password reset code\"}\n outlined={true}\n description={\n \"Enter the code we sent to your email.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"new-password-input\">\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input\n autoComplete={\"off\"}\n type={\"password\"}\n label={\"New password\"}\n outlined={true}\n description={\"Enter your new password.\"}\n />\n </Bind>\n </Cell>\n <Cell span={12} data-testid=\"retype-password-input\">\n <Bind\n name=\"retypePassword\"\n validators={[\n validation.create(\"required\"),\n retypePasswordValidator\n ]}\n >\n <Input\n type={\"password\"}\n label={\"Retype password\"}\n outlined={true}\n description={\n \"Enter your new password once more.\"\n }\n />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-btn-new-psw\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Set new password\"}\n </ButtonPrimary>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n Want to sign in? {/* eslint-disable-next-line */}\n <a href={\"#\"} onClick={() => changeState(\"signIn\")}>\n Sign in\n </a>\n </Cell>\n </Grid>\n </>\n );\n }}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SetNewPassword;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,SAAA,GAAAR,OAAA;AACA,IAAAS,eAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,iBAAA,GAAAV,OAAA;AACA,IAAAW,kBAAA,GAAAX,OAAA;AACA,IAAAY,mBAAA,GAAAZ,OAAA;AAKA,IAAMa,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EACzB,IAAAC,iBAAA,GAAwB,IAAA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I;MAACC,IAAI,EAAE,EAAG;MAACiB,KAAK,EAAE;QAAEC,SAAS,EAAE;MAAS;IAAE,GAAC,mBAC3B,eACjBlE,MAAA,CAAAyB,OAAA,CAAAC,aAAA;MAAGyC,IAAI,EAAE,GAAI;MAACJ,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAM7C,WAAW,CAAC,QAAQ,CAAC;MAAA;IAAC,GAAC,SAEjD,CACD,CACJ,CACR,CAAC;EAEX,CACE,CACM,CAAC;AAEzB,CAAC;AAAC,IAAAkD,QAAA,GAEarD,cAAc;AAAAsD,OAAA,CAAA5C,OAAA,GAAA2C,QAAA"}
|
package/views/SignIn.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CognitoFederatedProvider } from "../index";
|
|
3
|
+
interface SignInProps {
|
|
4
|
+
federatedProviders?: CognitoFederatedProvider[];
|
|
5
|
+
}
|
|
6
|
+
declare const SignIn: (props: SignInProps) => JSX.Element | null;
|
|
3
7
|
export default SignIn;
|
package/views/SignIn.js
CHANGED
|
@@ -19,7 +19,8 @@ var _useAuthenticator2 = require("@webiny/app-cognito-authenticator/hooks/useAut
|
|
|
19
19
|
var _useSignIn2 = require("@webiny/app-cognito-authenticator/hooks/useSignIn");
|
|
20
20
|
var _StateContainer = _interopRequireDefault(require("./StateContainer"));
|
|
21
21
|
var _StyledComponents = require("./StyledComponents");
|
|
22
|
-
var
|
|
22
|
+
var _FederatedLogin = require("./FederatedLogin");
|
|
23
|
+
var SignIn = function SignIn(props) {
|
|
23
24
|
var _useAuthenticator = (0, _useAuthenticator2.useAuthenticator)(),
|
|
24
25
|
message = _useAuthenticator.message,
|
|
25
26
|
changeState = _useAuthenticator.changeState;
|
|
@@ -28,6 +29,8 @@ var SignIn = function SignIn() {
|
|
|
28
29
|
loading = _useSignIn.loading,
|
|
29
30
|
error = _useSignIn.error,
|
|
30
31
|
shouldRender = _useSignIn.shouldRender;
|
|
32
|
+
var _props$federatedProvi = props.federatedProviders,
|
|
33
|
+
federatedProviders = _props$federatedProvi === void 0 ? [] : _props$federatedProvi;
|
|
31
34
|
if (!shouldRender) {
|
|
32
35
|
return null;
|
|
33
36
|
}
|
|
@@ -93,8 +96,12 @@ var SignIn = function SignIn() {
|
|
|
93
96
|
onClick: function onClick() {
|
|
94
97
|
return changeState("forgotPassword");
|
|
95
98
|
}
|
|
96
|
-
}, "Forgot password?")))
|
|
99
|
+
}, "Forgot password?"))), federatedProviders.length ? /*#__PURE__*/_react.default.createElement(_FederatedLogin.FederatedLogin, {
|
|
100
|
+
providers: federatedProviders
|
|
101
|
+
}) : null));
|
|
97
102
|
}));
|
|
98
103
|
};
|
|
99
104
|
var _default = SignIn;
|
|
100
|
-
exports.default = _default;
|
|
105
|
+
exports.default = _default;
|
|
106
|
+
|
|
107
|
+
//# sourceMappingURL=SignIn.js.map
|
package/views/SignIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SignIn","useAuthenticator","message","changeState","useSignIn","signIn","loading","error","shouldRender","data","Bind","submit","title","type","text","errorMessage","validation","create","val","cb","toLowerCase","alignRight","ev","alignCenter"],"sources":["SignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSignIn,\n UseSignInCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSignIn\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, alignCenter, InnerContent, Title, errorMessage } from \"./StyledComponents\";\n\nconst SignIn: React.FC = () => {\n const { message, changeState } = useAuthenticator();\n const { signIn, loading, error, shouldRender } = useSignIn();\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSignInCallableParams\n */\n return signIn(data as unknown as UseSignInCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress label={\"Signing in...\"} />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Sign In</Typography>\n </h1>\n </Title>\n\n {message && !error && (\n <Grid>\n <Cell span={12}>\n <Alert title={message.title} type={message.type}>\n {message.text}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n <Alert title=\"Authentication error\" type={\"danger\"}>\n {error.message}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n beforeChange={(val: string, cb: (value: string) => void) =>\n cb(val.toLowerCase())\n }\n >\n <Input label={\"Your e-mail\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input type={\"password\"} label={\"Your password\"} />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Submit\"}\n </ButtonPrimary>\n </Cell>\n <Cell span={12} className={alignCenter}>\n <a href=\"#\" onClick={() => changeState(\"forgotPassword\")}>\n Forgot password?\n </a>\n </Cell>\n </Grid>\n </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SignIn;\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AAE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AAO,CACV,CACL,CAEd,eAED,6BAAC,UAAI,qBACD,6BAAC,UAAI;MAAC,IAAI,EAAE;IAAG,gBACX,6BAAC,IAAI;MACD,IAAI,EAAC,UAAU;MACf,UAAU,EAAEc,sBAAU,CAACC,MAAM,CAAC,gBAAgB,CAAE;MAChD,YAAY,EAAE,sBAACC,GAAW,EAAEC,EAA2B;QAAA,OACnDA,EAAE,CAACD,GAAG,CAACE,WAAW,EAAE,CAAC;MAAA;IACxB,gBAED,6BAAC,YAAK;MAAC,KAAK,EAAE;IAAc,EAAG,CAC5B,CACJ,eACP,6BAAC,UAAI;MAAC,IAAI,EAAE;IAAG,gBACX,6BAAC,IAAI;MACD,IAAI,EAAC,UAAU;MACf,UAAU,EAAEJ,sBAAU,CAACC,MAAM,CAAC,UAAU;IAAE,gBAE1C,6BAAC,YAAK;MAAC,IAAI,EAAE,UAAW;MAAC,KAAK,EAAE;IAAgB,EAAG,CAChD,CACJ,eACP,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,SAAS,EAAEI;IAAW,gBAClC,6BAAC,qBAAa;MACV,eAAY,4BAA4B;MACxC,OAAO,EAAE,iBAAAC,EAAE,EAAI;QACXX,MAAM,CAACW,EAAE,CAAC;MACd;IAAE,GAED,QAAQ,CACG,CACb,eACP,6BAAC,UAAI;MAAC,IAAI,EAAE,EAAG;MAAC,SAAS,EAAEC;IAAY,gBACnC;MAAG,IAAI,EAAC,GAAG;MAAC,OAAO,EAAE;QAAA,OAAMpB,WAAW,CAAC,gBAAgB,CAAC;MAAA;IAAC,GAAC,kBAE1D,CAAI,CACD,CACJ,CACI,CACP;EAAA,CACf,CACE,CACM;AAEzB,CAAC;AAAC,eAEaH,MAAM;AAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_form","_validation","_Button","_Input","_Grid","_Typography","_Elevation","_Alert","_Progress","_useAuthenticator2","_useSignIn2","_StateContainer","_StyledComponents","_FederatedLogin","SignIn","props","_useAuthenticator","useAuthenticator","message","changeState","_useSignIn","useSignIn","signIn","loading","error","shouldRender","_props$federatedProvi","federatedProviders","default","createElement","Form","onSubmit","data","submitOnEnter","_ref","Bind","submit","Elevation","z","InnerContent","CircularProgress","label","Title","Typography","use","Grid","Cell","span","Alert","title","type","text","className","errorMessage","name","validators","validation","create","beforeChange","val","cb","toLowerCase","Input","alignRight","ButtonPrimary","onClick","ev","alignCenter","href","length","FederatedLogin","providers","_default","exports"],"sources":["SignIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { Form } from \"@webiny/form\";\nimport { validation } from \"@webiny/validation\";\nimport { ButtonPrimary } from \"@webiny/ui/Button\";\nimport { Input } from \"@webiny/ui/Input\";\nimport { Grid, Cell } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { Alert } from \"@webiny/ui/Alert\";\nimport { CircularProgress } from \"@webiny/ui/Progress\";\nimport { useAuthenticator } from \"@webiny/app-cognito-authenticator/hooks/useAuthenticator\";\nimport {\n useSignIn,\n UseSignInCallableParams\n} from \"@webiny/app-cognito-authenticator/hooks/useSignIn\";\nimport StateContainer from \"./StateContainer\";\nimport { alignRight, alignCenter, InnerContent, Title, errorMessage } from \"./StyledComponents\";\nimport { CognitoFederatedProvider } from \"~/index\";\nimport { FederatedLogin } from \"./FederatedLogin\";\n\ninterface SignInProps {\n federatedProviders?: CognitoFederatedProvider[];\n}\n\nconst SignIn = (props: SignInProps) => {\n const { message, changeState } = useAuthenticator();\n const { signIn, loading, error, shouldRender } = useSignIn();\n const { federatedProviders = [] } = props;\n\n if (!shouldRender) {\n return null;\n }\n\n return (\n <StateContainer>\n <Form\n onSubmit={data => {\n /**\n * We are positive that data is UseSignInCallableParams\n */\n return signIn(data as unknown as UseSignInCallableParams);\n }}\n submitOnEnter\n >\n {({ Bind, submit }) => (\n <Elevation z={2}>\n <InnerContent>\n {loading && <CircularProgress label={\"Signing in...\"} />}\n <Title>\n <h1>\n <Typography use=\"headline4\">Sign In</Typography>\n </h1>\n </Title>\n\n {message && !error && (\n <Grid>\n <Cell span={12}>\n <Alert title={message.title} type={message.type}>\n {message.text}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n {error && (\n <Grid>\n <Cell span={12} className={errorMessage}>\n <Alert title=\"Authentication error\" type={\"danger\"}>\n {error.message}\n </Alert>\n </Cell>\n </Grid>\n )}\n\n <Grid>\n <Cell span={12}>\n <Bind\n name=\"username\"\n validators={validation.create(\"required,email\")}\n beforeChange={(val: string, cb: (value: string) => void) =>\n cb(val.toLowerCase())\n }\n >\n <Input label={\"Your e-mail\"} />\n </Bind>\n </Cell>\n <Cell span={12}>\n <Bind\n name=\"password\"\n validators={validation.create(\"required\")}\n >\n <Input type={\"password\"} label={\"Your password\"} />\n </Bind>\n </Cell>\n <Cell span={12} className={alignRight}>\n <ButtonPrimary\n data-testid=\"submit-sign-in-form-button\"\n onClick={ev => {\n submit(ev);\n }}\n >\n {\"Submit\"}\n </ButtonPrimary>\n </Cell>\n <Cell span={12} className={alignCenter}>\n <a href=\"#\" onClick={() => changeState(\"forgotPassword\")}>\n Forgot password?\n </a>\n </Cell>\n </Grid>\n {federatedProviders.length ? (\n <FederatedLogin providers={federatedProviders} />\n ) : null}\n </InnerContent>\n </Elevation>\n )}\n </Form>\n </StateContainer>\n );\n};\n\nexport default SignIn;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;A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,IAAI;MAACC,IAAI,EAAE,EAAG;MAACK,SAAS,EAAEe;IAAY,gBACnCtE,MAAA,CAAA+B,OAAA,CAAAC,aAAA;MAAGuC,IAAI,EAAC,GAAG;MAACH,OAAO,EAAE,SAAAA,QAAA;QAAA,OAAM9C,WAAW,CAAC,gBAAgB,CAAC;MAAA;IAAC,GAAC,kBAEvD,CACD,CACJ,CAAC,EACNQ,kBAAkB,CAAC0C,MAAM,gBACtBxE,MAAA,CAAA+B,OAAA,CAAAC,aAAA,CAAChB,eAAA,CAAAyD,cAAc;MAACC,SAAS,EAAE5C;IAAmB,CAAE,CAAC,GACjD,IACM,CACP,CAAC;EAAA,CAEd,CACM,CAAC;AAEzB,CAAC;AAAC,IAAA6C,QAAA,GAEa1D,MAAM;AAAA2D,OAAA,CAAA7C,OAAA,GAAA4C,QAAA"}
|
package/views/SignedIn.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
2
|
+
interface SignedInProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
declare const SignedIn: ({ children }: SignedInProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null;
|
|
3
6
|
export default SignedIn;
|
package/views/SignedIn.js
CHANGED
package/views/SignedIn.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["SignedIn","children","useSignedIn","shouldRender"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { useSignedIn } from \"@webiny/app-cognito-authenticator/hooks/useSignedIn\";\n\
|
|
1
|
+
{"version":3,"names":["_useSignedIn2","require","SignedIn","_ref","children","_useSignedIn","useSignedIn","shouldRender","_default","exports","default"],"sources":["SignedIn.tsx"],"sourcesContent":["import React from \"react\";\nimport { useSignedIn } from \"@webiny/app-cognito-authenticator/hooks/useSignedIn\";\n\ninterface SignedInProps {\n children: React.ReactNode;\n}\n\nconst SignedIn = ({ children }: SignedInProps) => {\n const { shouldRender } = useSignedIn();\n\n return shouldRender ? (children as unknown as React.ReactElement) : null;\n};\n\nexport default SignedIn;\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAAoC;EAAA,IAA9BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACxB,IAAAC,YAAA,GAAyB,IAAAC,yBAAW,EAAC,CAAC;IAA9BC,YAAY,GAAAF,YAAA,CAAZE,YAAY;EAEpB,OAAOA,YAAY,GAAIH,QAAQ,GAAqC,IAAI;AAC5E,CAAC;AAAC,IAAAI,QAAA,GAEaN,QAAQ;AAAAO,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
package/views/StateContainer.js
CHANGED
|
@@ -13,4 +13,6 @@ var StateContainer = function StateContainer(_ref) {
|
|
|
13
13
|
return /*#__PURE__*/React.createElement(_StyledComponents.Wrapper, null, /*#__PURE__*/React.createElement(_StyledComponents.LogoWrapper, null, /*#__PURE__*/React.createElement(_appAdmin.Logo, null)), /*#__PURE__*/React.createElement(_StyledComponents.LoginContent, null, children));
|
|
14
14
|
};
|
|
15
15
|
var _default = StateContainer;
|
|
16
|
-
exports.default = _default;
|
|
16
|
+
exports.default = _default;
|
|
17
|
+
|
|
18
|
+
//# sourceMappingURL=StateContainer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["StateContainer","children"],"sources":["StateContainer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Logo } from \"@webiny/app-admin\";\nimport { LoginContent, LogoWrapper, Wrapper } from \"./StyledComponents\";\n\
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_appAdmin","_StyledComponents","StateContainer","_ref","children","createElement","Wrapper","LogoWrapper","Logo","LoginContent","_default","exports","default"],"sources":["StateContainer.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Logo } from \"@webiny/app-admin\";\nimport { LoginContent, LogoWrapper, Wrapper } from \"./StyledComponents\";\n\ninterface StateContainerProps {\n children: React.ReactNode;\n}\n\nconst StateContainer = ({ children }: StateContainerProps) => (\n <Wrapper>\n <LogoWrapper>\n <Logo />\n </LogoWrapper>\n <LoginContent>{children}</LoginContent>\n </Wrapper>\n);\n\nexport default StateContainer;\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,iBAAA,GAAAF,OAAA;AAMA,IAAMG,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA;EAAA,IAAMC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EAAA,oBAC9BP,KAAA,CAAAQ,aAAA,CAACJ,iBAAA,CAAAK,OAAO,qBACJT,KAAA,CAAAQ,aAAA,CAACJ,iBAAA,CAAAM,WAAW,qBACRV,KAAA,CAAAQ,aAAA,CAACL,SAAA,CAAAQ,IAAI,MAAE,CACE,CAAC,eACdX,KAAA,CAAAQ,aAAA,CAACJ,iBAAA,CAAAQ,YAAY,QAAEL,QAAuB,CACjC,CAAC;AAAA,CACb;AAAC,IAAAM,QAAA,GAEaR,cAAc;AAAAS,OAAA,CAAAC,OAAA,GAAAF,QAAA"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
/// <reference types="web" />
|
|
4
2
|
export declare const Wrapper: import("@emotion/styled").StyledComponent<{
|
|
5
3
|
theme?: import("@emotion/react").Theme | undefined;
|
|
6
4
|
as?: import("react").ElementType<any> | undefined;
|
|
@@ -86,4 +86,6 @@ exports.alignCenter = alignCenter;
|
|
|
86
86
|
var errorMessage = /*#__PURE__*/(0, _emotion.css)({
|
|
87
87
|
color: "red"
|
|
88
88
|
}, "label:errorMessage;");
|
|
89
|
-
exports.errorMessage = errorMessage;
|
|
89
|
+
exports.errorMessage = errorMessage;
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=StyledComponents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Wrapper","styled","display","flexDirection","justifyContent","minHeight","color","LogoWrapper","margin","marginBottom","LoginContent","width","maxWidth","borderRadius","boxShadow","a","textDecoration","fontWeight","InnerContent","position","padding","Footer","textAlign","Title","alignRight","css","alignCenter","errorMessage"],"sources":["StyledComponents.ts"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport { css } from \"emotion\";\n\nexport const Wrapper = styled(\"section\")({\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n minHeight: \"100vh\",\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const LogoWrapper = styled(\"div\")({\n margin: \"0 auto\",\n marginBottom: 30\n});\n\nexport const LoginContent = styled(\"div\")({\n width: \"100%\",\n maxWidth: 500,\n margin: \"0 auto 25px auto\",\n \".mdc-elevation--z2\": {\n borderRadius: 4,\n boxShadow: \"0 1px 3px 0 rgba(0,0,0,0.15)\"\n },\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\",\n fontWeight: 600,\n \"&:hover\": {\n textDecoration: \"underline\"\n }\n }\n});\n\nexport const InnerContent = styled(\"div\")({\n position: \"relative\",\n padding: 25\n});\n\nexport const Footer = styled(\"div\")({\n textAlign: \"center\",\n marginBottom: 75,\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\"\n }\n});\n\nexport const Title = styled(\"div\")({\n textAlign: \"center\",\n margin: \"10px 25px\"\n});\n\nexport const alignRight = css({\n textAlign: \"right\"\n});\n\nexport const alignCenter = css({\n textAlign: \"center\"\n});\n\nexport const errorMessage = css({\n color: \"red\"\n});\n"],"mappings":";;;;;;;AAAA;AACA;AAEO,
|
|
1
|
+
{"version":3,"names":["_styled","_interopRequireDefault","require","_emotion","Wrapper","styled","target","label","display","flexDirection","justifyContent","minHeight","color","exports","LogoWrapper","margin","marginBottom","LoginContent","width","maxWidth","borderRadius","boxShadow","a","textDecoration","fontWeight","InnerContent","position","padding","Footer","textAlign","Title","alignRight","css","alignCenter","errorMessage"],"sources":["StyledComponents.ts"],"sourcesContent":["import styled from \"@emotion/styled\";\nimport { css } from \"emotion\";\n\nexport const Wrapper = styled(\"section\")({\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n minHeight: \"100vh\",\n color: \"var(--mdc-theme-on-surface)\"\n});\n\nexport const LogoWrapper = styled(\"div\")({\n margin: \"0 auto\",\n marginBottom: 30\n});\n\nexport const LoginContent = styled(\"div\")({\n width: \"100%\",\n maxWidth: 500,\n margin: \"0 auto 25px auto\",\n \".mdc-elevation--z2\": {\n borderRadius: 4,\n boxShadow: \"0 1px 3px 0 rgba(0,0,0,0.15)\"\n },\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\",\n fontWeight: 600,\n \"&:hover\": {\n textDecoration: \"underline\"\n }\n }\n});\n\nexport const InnerContent = styled(\"div\")({\n position: \"relative\",\n padding: 25\n});\n\nexport const Footer = styled(\"div\")({\n textAlign: \"center\",\n marginBottom: 75,\n a: {\n textDecoration: \"none\",\n color: \"var(--mdc-theme-primary)\"\n }\n});\n\nexport const Title = styled(\"div\")({\n textAlign: \"center\",\n margin: \"10px 25px\"\n});\n\nexport const alignRight = css({\n textAlign: \"right\"\n});\n\nexport const alignCenter = css({\n textAlign: \"center\"\n});\n\nexport const errorMessage = css({\n color: \"red\"\n});\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AAEO,IAAME,OAAO,oBAAGC,eAAM,EAAC,SAAS;EAAAC,MAAA;EAAAC,KAAA;AAAA,GAAE;EACrCC,OAAO,EAAE,MAAM;EACfC,aAAa,EAAE,QAAQ;EACvBC,cAAc,EAAE,QAAQ;EACxBC,SAAS,EAAE,OAAO;EAClBC,KAAK,EAAE;AACX,CAAC,CAAC;AAACC,OAAA,CAAAT,OAAA,GAAAA,OAAA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