@webiny/app-admin-cognito 5.39.4-beta.0 → 5.39.4-beta.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/components/Divider.d.ts +5 -0
- package/components/Divider.js +15 -0
- package/components/Divider.js.map +1 -0
- package/components/FederatedProviders.d.ts +18 -0
- package/components/FederatedProviders.js +25 -0
- package/components/FederatedProviders.js.map +1 -0
- package/{views → components}/StyledComponents.js +6 -6
- package/components/View.d.ts +46 -0
- package/components/View.js +51 -0
- package/components/View.js.map +1 -0
- package/federatedIdentityProviders.d.ts +9 -0
- package/federatedIdentityProviders.js +16 -0
- package/federatedIdentityProviders.js.map +1 -0
- package/index.d.ts +55 -6
- package/index.js +23 -12
- package/index.js.map +1 -1
- package/package.json +17 -14
- package/views/FederatedLogin.d.ts +2 -2
- package/views/FederatedLogin.js +19 -22
- package/views/FederatedLogin.js.map +1 -1
- package/views/ForgotPassword.d.ts +1 -2
- package/views/ForgotPassword.js +11 -22
- package/views/ForgotPassword.js.map +1 -1
- package/views/LoggingIn.d.ts +1 -2
- package/views/LoggingIn.js +2 -3
- package/views/LoggingIn.js.map +1 -1
- package/views/RequireNewPassword.d.ts +1 -2
- package/views/RequireNewPassword.js +9 -13
- package/views/RequireNewPassword.js.map +1 -1
- package/views/SetNewPassword.d.ts +1 -2
- package/views/SetNewPassword.js +11 -24
- package/views/SetNewPassword.js.map +1 -1
- package/views/SignIn.d.ts +19 -6
- package/views/SignIn.js +86 -77
- package/views/SignIn.js.map +1 -1
- package/views/SignedIn.d.ts +2 -2
- package/views/SignedIn.js +2 -3
- package/views/SignedIn.js.map +1 -1
- package/views/StateContainer.d.ts +0 -6
- package/views/StateContainer.js +0 -18
- package/views/StateContainer.js.map +0 -1
- package/views/webiny-orange-logo.svg +0 -23
- /package/{views → components}/StyledComponents.d.ts +0 -0
- /package/{views → components}/StyledComponents.js.map +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const Divider: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
theme?: import("@emotion/react").Theme | undefined;
|
|
4
|
+
as?: import("react").ElementType<any> | undefined;
|
|
5
|
+
}, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Divider = void 0;
|
|
8
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
|
+
var Divider = /*#__PURE__*/(0, _styled.default)("div", {
|
|
10
|
+
label: "Divider",
|
|
11
|
+
target: "e1v7qj260"
|
|
12
|
+
})("border-top:1px solid #ececec;");
|
|
13
|
+
exports.Divider = Divider;
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=Divider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_styled","_interopRequireDefault","require","Divider","styled","label","target","exports"],"sources":["Divider.tsx"],"sourcesContent":["import styled from \"@emotion/styled\";\n\nexport const Divider = styled.div`\n border-top: 1px solid #ececec;\n`;\n"],"mappings":";;;;;;;AAAA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,IAAMC,OAAO,oBAAGC,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,mCAE5B;AAACC,OAAA,CAAAJ,OAAA,GAAAA,OAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export declare const Container: import("@webiny/app-admin").GenericComponent<ContainerProps> & {
|
|
6
|
+
original: import("@webiny/app-admin").GenericComponent<ContainerProps>;
|
|
7
|
+
originalName: string;
|
|
8
|
+
} & {
|
|
9
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: ContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
10
|
+
};
|
|
11
|
+
export declare const FederatedProviders: {
|
|
12
|
+
Container: import("@webiny/app-admin").GenericComponent<ContainerProps> & {
|
|
13
|
+
original: import("@webiny/app-admin").GenericComponent<ContainerProps>;
|
|
14
|
+
originalName: string;
|
|
15
|
+
} & {
|
|
16
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: ContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.FederatedProviders = exports.Container = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
|
+
var _appAdmin = require("@webiny/app-admin");
|
|
11
|
+
var FlexContainer = /*#__PURE__*/(0, _styled.default)("div", {
|
|
12
|
+
label: "FlexContainer",
|
|
13
|
+
target: "e14conl60"
|
|
14
|
+
})("display:flex;column-gap:10px;padding-top:20px;justify-content:center;");
|
|
15
|
+
var Container = (0, _appAdmin.makeDecoratable)("FederatedProvidersContainer", function (_ref) {
|
|
16
|
+
var children = _ref.children;
|
|
17
|
+
return /*#__PURE__*/_react.default.createElement(FlexContainer, null, children);
|
|
18
|
+
});
|
|
19
|
+
exports.Container = Container;
|
|
20
|
+
var FederatedProviders = {
|
|
21
|
+
Container: Container
|
|
22
|
+
};
|
|
23
|
+
exports.FederatedProviders = FederatedProviders;
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=FederatedProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_styled","_appAdmin","FlexContainer","styled","label","target","Container","makeDecoratable","_ref","children","default","createElement","exports","FederatedProviders"],"sources":["FederatedProviders.tsx"],"sourcesContent":["import React from \"react\";\nimport styled from \"@emotion/styled\";\nimport { makeDecoratable } from \"@webiny/app-admin\";\n\nconst FlexContainer = styled.div`\n display: flex;\n column-gap: 10px;\n padding-top: 20px;\n justify-content: center;\n`;\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nexport const Container = makeDecoratable(\n \"FederatedProvidersContainer\",\n ({ children }: ContainerProps) => {\n return <FlexContainer>{children}</FlexContainer>;\n }\n);\n\nexport const FederatedProviders = {\n Container\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAEA,IAAMG,aAAa,oBAAGC,eAAM;EAAAC,KAAA;EAAAC,MAAA;AAAA,2EAK3B;AAMM,IAAMC,SAAS,GAAG,IAAAC,yBAAe,EACpC,6BAA6B,EAC7B,UAAAC,IAAA,EAAkC;EAAA,IAA/BC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;EACP,oBAAOZ,MAAA,CAAAa,OAAA,CAAAC,aAAA,CAACT,aAAa,QAAEO,QAAwB,CAAC;AACpD,CACJ,CAAC;AAACG,OAAA,CAAAN,SAAA,GAAAA,SAAA;AAEK,IAAMO,kBAAkB,GAAG;EAC9BP,SAAS,EAATA;AACJ,CAAC;AAACM,OAAA,CAAAC,kBAAA,GAAAA,kBAAA"}
|
|
@@ -8,7 +8,7 @@ exports.errorMessage = exports.alignRight = exports.alignCenter = exports.Wrappe
|
|
|
8
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
9
9
|
var _emotion = require("emotion");
|
|
10
10
|
var Wrapper = /*#__PURE__*/(0, _styled.default)("section", {
|
|
11
|
-
target: "
|
|
11
|
+
target: "e1uiqc0x0",
|
|
12
12
|
label: "Wrapper"
|
|
13
13
|
})({
|
|
14
14
|
display: "flex",
|
|
@@ -19,7 +19,7 @@ var Wrapper = /*#__PURE__*/(0, _styled.default)("section", {
|
|
|
19
19
|
});
|
|
20
20
|
exports.Wrapper = Wrapper;
|
|
21
21
|
var LogoWrapper = /*#__PURE__*/(0, _styled.default)("div", {
|
|
22
|
-
target: "
|
|
22
|
+
target: "e1uiqc0x1",
|
|
23
23
|
label: "LogoWrapper"
|
|
24
24
|
})({
|
|
25
25
|
margin: "0 auto",
|
|
@@ -27,7 +27,7 @@ var LogoWrapper = /*#__PURE__*/(0, _styled.default)("div", {
|
|
|
27
27
|
});
|
|
28
28
|
exports.LogoWrapper = LogoWrapper;
|
|
29
29
|
var LoginContent = /*#__PURE__*/(0, _styled.default)("div", {
|
|
30
|
-
target: "
|
|
30
|
+
target: "e1uiqc0x2",
|
|
31
31
|
label: "LoginContent"
|
|
32
32
|
})({
|
|
33
33
|
width: "100%",
|
|
@@ -48,7 +48,7 @@ var LoginContent = /*#__PURE__*/(0, _styled.default)("div", {
|
|
|
48
48
|
});
|
|
49
49
|
exports.LoginContent = LoginContent;
|
|
50
50
|
var InnerContent = /*#__PURE__*/(0, _styled.default)("div", {
|
|
51
|
-
target: "
|
|
51
|
+
target: "e1uiqc0x3",
|
|
52
52
|
label: "InnerContent"
|
|
53
53
|
})({
|
|
54
54
|
position: "relative",
|
|
@@ -56,7 +56,7 @@ var InnerContent = /*#__PURE__*/(0, _styled.default)("div", {
|
|
|
56
56
|
});
|
|
57
57
|
exports.InnerContent = InnerContent;
|
|
58
58
|
var Footer = /*#__PURE__*/(0, _styled.default)("div", {
|
|
59
|
-
target: "
|
|
59
|
+
target: "e1uiqc0x4",
|
|
60
60
|
label: "Footer"
|
|
61
61
|
})({
|
|
62
62
|
textAlign: "center",
|
|
@@ -68,7 +68,7 @@ var Footer = /*#__PURE__*/(0, _styled.default)("div", {
|
|
|
68
68
|
});
|
|
69
69
|
exports.Footer = Footer;
|
|
70
70
|
var Title = /*#__PURE__*/(0, _styled.default)("div", {
|
|
71
|
-
target: "
|
|
71
|
+
target: "e1uiqc0x5",
|
|
72
72
|
label: "Title"
|
|
73
73
|
})({
|
|
74
74
|
textAlign: "center",
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ContainerProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
export interface ContentProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export interface FooterProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export interface TitleProps {
|
|
12
|
+
title: string;
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare const View: {
|
|
16
|
+
Container: import("@webiny/app-admin").GenericComponent<ContainerProps> & {
|
|
17
|
+
original: import("@webiny/app-admin").GenericComponent<ContainerProps>;
|
|
18
|
+
originalName: string;
|
|
19
|
+
} & {
|
|
20
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: ContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
Logo: import("@webiny/app-admin").GenericComponent<any> & {
|
|
23
|
+
original: import("@webiny/app-admin").GenericComponent<any>;
|
|
24
|
+
originalName: string;
|
|
25
|
+
} & {
|
|
26
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: any) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
27
|
+
};
|
|
28
|
+
Content: import("@webiny/app-admin").GenericComponent<ContentProps> & {
|
|
29
|
+
original: import("@webiny/app-admin").GenericComponent<ContentProps>;
|
|
30
|
+
originalName: string;
|
|
31
|
+
} & {
|
|
32
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: ContentProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
33
|
+
};
|
|
34
|
+
Title: import("@webiny/app-admin").GenericComponent<TitleProps> & {
|
|
35
|
+
original: import("@webiny/app-admin").GenericComponent<TitleProps>;
|
|
36
|
+
originalName: string;
|
|
37
|
+
} & {
|
|
38
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: TitleProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
39
|
+
};
|
|
40
|
+
Footer: import("@webiny/app-admin").GenericComponent<FooterProps> & {
|
|
41
|
+
original: import("@webiny/app-admin").GenericComponent<FooterProps>;
|
|
42
|
+
originalName: string;
|
|
43
|
+
} & {
|
|
44
|
+
createDecorator: (decorator: import("@webiny/app-admin").Decorator<(props: FooterProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.View = void 0;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _appAdmin = require("@webiny/app-admin");
|
|
10
|
+
var Styled = _interopRequireWildcard(require("./StyledComponents"));
|
|
11
|
+
var _Elevation = require("@webiny/ui/Elevation");
|
|
12
|
+
var _Grid = require("@webiny/ui/Grid");
|
|
13
|
+
var _Typography = require("@webiny/ui/Typography");
|
|
14
|
+
var Container = (0, _appAdmin.makeDecoratable)("ViewContainer", function (_ref) {
|
|
15
|
+
var children = _ref.children;
|
|
16
|
+
return /*#__PURE__*/React.createElement(Styled.Wrapper, null, /*#__PURE__*/React.createElement(Styled.LogoWrapper, null, /*#__PURE__*/React.createElement(_appAdmin.Logo, null)), /*#__PURE__*/React.createElement(Styled.LoginContent, null, children));
|
|
17
|
+
});
|
|
18
|
+
var Content = (0, _appAdmin.makeDecoratable)("ViewContent", function (_ref2) {
|
|
19
|
+
var children = _ref2.children;
|
|
20
|
+
return /*#__PURE__*/React.createElement(_Elevation.Elevation, {
|
|
21
|
+
z: 2
|
|
22
|
+
}, /*#__PURE__*/React.createElement(Styled.InnerContent, null, children));
|
|
23
|
+
});
|
|
24
|
+
var Footer = (0, _appAdmin.makeDecoratable)("ViewFooter", function (_ref3) {
|
|
25
|
+
var children = _ref3.children;
|
|
26
|
+
return /*#__PURE__*/React.createElement(_Grid.Grid, null, /*#__PURE__*/React.createElement(_Grid.Cell, {
|
|
27
|
+
span: 12,
|
|
28
|
+
style: {
|
|
29
|
+
textAlign: "center"
|
|
30
|
+
}
|
|
31
|
+
}, children));
|
|
32
|
+
});
|
|
33
|
+
var Title = (0, _appAdmin.makeDecoratable)("ViewTitle", function (_ref4) {
|
|
34
|
+
var title = _ref4.title,
|
|
35
|
+
description = _ref4.description;
|
|
36
|
+
return /*#__PURE__*/React.createElement(Styled.Title, null, /*#__PURE__*/React.createElement("h1", null, /*#__PURE__*/React.createElement(_Typography.Typography, {
|
|
37
|
+
use: "headline4"
|
|
38
|
+
}, title)), description ? /*#__PURE__*/React.createElement("p", null, /*#__PURE__*/React.createElement(_Typography.Typography, {
|
|
39
|
+
use: "body1"
|
|
40
|
+
}, description)) : null);
|
|
41
|
+
});
|
|
42
|
+
var View = {
|
|
43
|
+
Container: Container,
|
|
44
|
+
Logo: _appAdmin.Logo,
|
|
45
|
+
Content: Content,
|
|
46
|
+
Title: Title,
|
|
47
|
+
Footer: Footer
|
|
48
|
+
};
|
|
49
|
+
exports.View = View;
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=View.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_appAdmin","Styled","_Elevation","_Grid","_Typography","Container","makeDecoratable","_ref","children","createElement","Wrapper","LogoWrapper","Logo","LoginContent","Content","_ref2","Elevation","z","InnerContent","Footer","_ref3","Grid","Cell","span","style","textAlign","Title","_ref4","title","description","Typography","use","View","exports"],"sources":["View.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { Logo, makeDecoratable } from \"@webiny/app-admin\";\nimport * as Styled from \"./StyledComponents\";\nimport { Elevation } from \"@webiny/ui/Elevation\";\nimport { Cell, Grid } from \"@webiny/ui/Grid\";\nimport { Typography } from \"@webiny/ui/Typography\";\n\nexport interface ContainerProps {\n children: React.ReactNode;\n}\n\nconst Container = makeDecoratable(\"ViewContainer\", ({ children }: ContainerProps) => (\n <Styled.Wrapper>\n <Styled.LogoWrapper>\n <Logo />\n </Styled.LogoWrapper>\n <Styled.LoginContent>{children}</Styled.LoginContent>\n </Styled.Wrapper>\n));\n\nexport interface ContentProps {\n children: React.ReactNode;\n}\n\nconst Content = makeDecoratable(\"ViewContent\", ({ children }: ContentProps) => (\n <Elevation z={2}>\n <Styled.InnerContent>{children}</Styled.InnerContent>\n </Elevation>\n));\n\nexport interface FooterProps {\n children: React.ReactNode;\n}\n\nconst Footer = makeDecoratable(\"ViewFooter\", ({ children }: FooterProps) => {\n return (\n <Grid>\n <Cell span={12} style={{ textAlign: \"center\" }}>\n {children}\n </Cell>\n </Grid>\n );\n});\n\nexport interface TitleProps {\n title: string;\n description?: React.ReactNode;\n}\n\nconst Title = makeDecoratable(\"ViewTitle\", ({ title, description }: TitleProps) => {\n return (\n <Styled.Title>\n <h1>\n <Typography use=\"headline4\">{title}</Typography>\n </h1>\n {description ? (\n <p>\n <Typography use=\"body1\">{description}</Typography>\n </p>\n ) : null}\n </Styled.Title>\n );\n});\n\nexport const View = {\n Container,\n Logo,\n Content,\n Title,\n Footer\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAH,uBAAA,CAAAC,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,KAA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AW,GAAAF,KAAA,CAAXE,WAAW;EAC5D,oBACIhC,KAAA,CAAAY,aAAA,CAACR,MAAM,CAACyB,KAAK,qBACT7B,KAAA,CAAAY,aAAA,0BACIZ,KAAA,CAAAY,aAAA,CAACL,WAAA,CAAA0B,UAAU;IAACC,GAAG,EAAC;EAAW,GAAEH,KAAkB,CAC/C,CAAC,EACJC,WAAW,gBACRhC,KAAA,CAAAY,aAAA,yBACIZ,KAAA,CAAAY,aAAA,CAACL,WAAA,CAAA0B,UAAU;IAACC,GAAG,EAAC;EAAO,GAAEF,WAAwB,CAClD,CAAC,GACJ,IACM,CAAC;AAEvB,CAAC,CAAC;AAEK,IAAMG,IAAI,GAAG;EAChB3B,SAAS,EAATA,SAAS;EACTO,IAAI,EAAJA,cAAI;EACJE,OAAO,EAAPA,OAAO;EACPY,KAAK,EAALA,KAAK;EACLP,MAAM,EAANA;AACJ,CAAC;AAACc,OAAA,CAAAD,IAAA,GAAAA,IAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare const federatedIdentityProviders: Record<string, string>;
|
|
3
|
+
export interface SignInProps {
|
|
4
|
+
signIn: () => void;
|
|
5
|
+
}
|
|
6
|
+
export declare type FederatedIdentityProvider = {
|
|
7
|
+
name: string;
|
|
8
|
+
component: React.FunctionComponent<SignInProps>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.federatedIdentityProviders = void 0;
|
|
7
|
+
var federatedIdentityProviders = {
|
|
8
|
+
cognito: "COGNITO",
|
|
9
|
+
google: "Google",
|
|
10
|
+
facebook: "Facebook",
|
|
11
|
+
amazon: "LoginWithAmazon",
|
|
12
|
+
apple: "SignInWithApple"
|
|
13
|
+
};
|
|
14
|
+
exports.federatedIdentityProviders = federatedIdentityProviders;
|
|
15
|
+
|
|
16
|
+
//# sourceMappingURL=federatedIdentityProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["federatedIdentityProviders","cognito","google","facebook","amazon","apple","exports"],"sources":["federatedIdentityProviders.ts"],"sourcesContent":["import React from \"react\";\n\nexport const federatedIdentityProviders: Record<string, string> = {\n cognito: \"COGNITO\",\n google: \"Google\",\n facebook: \"Facebook\",\n amazon: \"LoginWithAmazon\",\n apple: \"SignInWithApple\"\n};\n\nexport interface SignInProps {\n signIn: () => void;\n}\n\nexport type FederatedIdentityProvider = {\n name: string;\n component: React.FunctionComponent<SignInProps>;\n};\n"],"mappings":";;;;;;AAEO,IAAMA,0BAAkD,GAAG;EAC9DC,OAAO,EAAE,SAAS;EAClBC,MAAM,EAAE,QAAQ;EAChBC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE,iBAAiB;EACzBC,KAAK,EAAE;AACX,CAAC;AAACC,OAAA,CAAAN,0BAAA,GAAAA,0BAAA"}
|
package/index.d.ts
CHANGED
|
@@ -1,19 +1,68 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { AuthOptions
|
|
2
|
+
import { AuthOptions } from "@aws-amplify/auth/lib-esm/types";
|
|
3
3
|
import ApolloClient from "apollo-client";
|
|
4
|
+
import { FederatedIdentityProvider } from "./federatedIdentityProviders";
|
|
5
|
+
export declare const Components: {
|
|
6
|
+
View: {
|
|
7
|
+
Container: import("@webiny/react-composition").GenericComponent<import("./components/View").ContainerProps> & {
|
|
8
|
+
original: import("@webiny/react-composition").GenericComponent<import("./components/View").ContainerProps>;
|
|
9
|
+
originalName: string;
|
|
10
|
+
} & {
|
|
11
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./components/View").ContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
12
|
+
};
|
|
13
|
+
Logo: import("@webiny/react-composition").GenericComponent<any> & {
|
|
14
|
+
original: import("@webiny/react-composition").GenericComponent<any>;
|
|
15
|
+
originalName: string;
|
|
16
|
+
} & {
|
|
17
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: any) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
18
|
+
};
|
|
19
|
+
Content: import("@webiny/react-composition").GenericComponent<import("./components/View").ContentProps> & {
|
|
20
|
+
original: import("@webiny/react-composition").GenericComponent<import("./components/View").ContentProps>;
|
|
21
|
+
originalName: string;
|
|
22
|
+
} & {
|
|
23
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./components/View").ContentProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
24
|
+
};
|
|
25
|
+
Title: import("@webiny/react-composition").GenericComponent<import("./components/View").TitleProps> & {
|
|
26
|
+
original: import("@webiny/react-composition").GenericComponent<import("./components/View").TitleProps>;
|
|
27
|
+
originalName: string;
|
|
28
|
+
} & {
|
|
29
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./components/View").TitleProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
Footer: import("@webiny/react-composition").GenericComponent<import("./components/View").FooterProps> & {
|
|
32
|
+
original: import("@webiny/react-composition").GenericComponent<import("./components/View").FooterProps>;
|
|
33
|
+
originalName: string;
|
|
34
|
+
} & {
|
|
35
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./components/View").FooterProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
FederatedProviders: {
|
|
39
|
+
Container: import("@webiny/react-composition").GenericComponent<import("./components/FederatedProviders").ContainerProps> & {
|
|
40
|
+
original: import("@webiny/react-composition").GenericComponent<import("./components/FederatedProviders").ContainerProps>;
|
|
41
|
+
originalName: string;
|
|
42
|
+
} & {
|
|
43
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./components/FederatedProviders").ContainerProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
SignIn: import("@webiny/react-composition").GenericComponent<import("./views/SignIn").SignInProps> & {
|
|
47
|
+
original: import("@webiny/react-composition").GenericComponent<import("./views/SignIn").SignInProps>;
|
|
48
|
+
originalName: string;
|
|
49
|
+
} & {
|
|
50
|
+
createDecorator: (decorator: import("@webiny/react-composition").Decorator<(props: import("./views/SignIn").SignInProps) => JSX.Element | null>) => (props: unknown) => JSX.Element;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
4
53
|
export interface AuthenticationProps {
|
|
5
54
|
children: React.ReactNode;
|
|
6
55
|
}
|
|
7
|
-
export declare type CognitoFederatedProvider = keyof typeof CognitoHostedUIIdentityProvider;
|
|
8
56
|
export interface AuthenticationFactoryConfig extends AuthOptions {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
57
|
+
allowSignInWithCredentials?: boolean;
|
|
58
|
+
federatedProviders?: FederatedIdentityProvider[];
|
|
59
|
+
onError?: (error: Error) => void;
|
|
60
|
+
getIdentityData: (params: {
|
|
12
61
|
client: ApolloClient<any>;
|
|
13
62
|
payload: {
|
|
14
63
|
[key: string]: any;
|
|
15
64
|
};
|
|
16
|
-
})
|
|
65
|
+
}) => Promise<{
|
|
17
66
|
[key: string]: any;
|
|
18
67
|
}>;
|
|
19
68
|
}
|
package/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.createAuthentication = void 0;
|
|
8
|
+
exports.createAuthentication = exports.Components = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
@@ -18,14 +18,22 @@ var _ApolloLinkPlugin = require("@webiny/app/plugins/ApolloLinkPlugin");
|
|
|
18
18
|
var _Authenticator = require("@webiny/app-cognito-authenticator/Authenticator");
|
|
19
19
|
var _appSecurity = require("@webiny/app-security");
|
|
20
20
|
var _config = require("@webiny/app/config");
|
|
21
|
-
var _SignIn =
|
|
22
|
-
var _RequireNewPassword =
|
|
23
|
-
var _ForgotPassword =
|
|
24
|
-
var _SetNewPassword =
|
|
25
|
-
var _SignedIn =
|
|
26
|
-
var _LoggingIn =
|
|
27
|
-
var
|
|
21
|
+
var _SignIn = require("./views/SignIn");
|
|
22
|
+
var _RequireNewPassword = require("./views/RequireNewPassword");
|
|
23
|
+
var _ForgotPassword = require("./views/ForgotPassword");
|
|
24
|
+
var _SetNewPassword = require("./views/SetNewPassword");
|
|
25
|
+
var _SignedIn = require("./views/SignedIn");
|
|
26
|
+
var _LoggingIn = require("./views/LoggingIn");
|
|
27
|
+
var _FederatedProviders = require("./components/FederatedProviders");
|
|
28
|
+
var _View = require("./components/View");
|
|
29
|
+
var _excluded = ["allowSignInWithCredentials", "getIdentityData", "onError"],
|
|
28
30
|
_excluded2 = ["id", "displayName", "type", "permissions"];
|
|
31
|
+
var Components = {
|
|
32
|
+
View: _View.View,
|
|
33
|
+
FederatedProviders: _FederatedProviders.FederatedProviders,
|
|
34
|
+
SignIn: _SignIn.SignIn
|
|
35
|
+
};
|
|
36
|
+
exports.Components = Components;
|
|
29
37
|
var createApolloLinkPlugin = function createApolloLinkPlugin() {
|
|
30
38
|
return new _ApolloLinkPlugin.ApolloLinkPlugin(function () {
|
|
31
39
|
return (0, _apolloLinkContext.setContext)(async function (_, _ref) {
|
|
@@ -66,7 +74,9 @@ var defaultOptions = {
|
|
|
66
74
|
userPoolWebClientId: _config.config.getKey("USER_POOL_WEB_CLIENT_ID", process.env.REACT_APP_USER_POOL_WEB_CLIENT_ID)
|
|
67
75
|
};
|
|
68
76
|
var createAuthentication = function createAuthentication(_ref2) {
|
|
69
|
-
var
|
|
77
|
+
var _ref2$allowSignInWith = _ref2.allowSignInWithCredentials,
|
|
78
|
+
allowSignInWithCredentials = _ref2$allowSignInWith === void 0 ? true : _ref2$allowSignInWith,
|
|
79
|
+
getIdentityData = _ref2.getIdentityData,
|
|
70
80
|
onError = _ref2.onError,
|
|
71
81
|
config = (0, _objectWithoutProperties2.default)(_ref2, _excluded);
|
|
72
82
|
/**
|
|
@@ -127,9 +137,10 @@ var createAuthentication = function createAuthentication(_ref2) {
|
|
|
127
137
|
}, []);
|
|
128
138
|
return /*#__PURE__*/_react.default.createElement(_Authenticator.Authenticator, {
|
|
129
139
|
onToken: onToken
|
|
130
|
-
}, loadingIdentity ? /*#__PURE__*/_react.default.createElement(_LoggingIn.
|
|
131
|
-
federatedProviders: config.federatedProviders
|
|
132
|
-
|
|
140
|
+
}, loadingIdentity ? /*#__PURE__*/_react.default.createElement(_LoggingIn.LoggingIn, null) : /*#__PURE__*/_react.default.createElement(_SignIn.SignIn, {
|
|
141
|
+
federatedProviders: config.federatedProviders,
|
|
142
|
+
allowSignInWithCredentials: allowSignInWithCredentials
|
|
143
|
+
}), /*#__PURE__*/_react.default.createElement(_RequireNewPassword.RequireNewPassword, null), /*#__PURE__*/_react.default.createElement(_ForgotPassword.ForgotPassword, null), /*#__PURE__*/_react.default.createElement(_SetNewPassword.SetNewPassword, null), /*#__PURE__*/_react.default.createElement(_SignedIn.SignedIn, null, children));
|
|
133
144
|
};
|
|
134
145
|
return Authentication;
|
|
135
146
|
};
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireWildcard","require","_auth","_reactHooks","_apolloLinkContext","_plugins","_ApolloLinkPlugin","_Authenticator","_appSecurity","_config","_SignIn","_interopRequireDefault","_RequireNewPassword","_ForgotPassword","_SetNewPassword","_SignedIn","_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 { useSecurity } from \"@webiny/app-security\";\nimport { config as appConfig } from \"@webiny/app/config\";\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 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 setIdentity({\n id,\n displayName,\n type,\n permissions,\n ...data,\n logout:\n logout ||\n (() => {\n return void 0;\n })\n });\n\n validatePermissions(permissions);\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,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAC,sBAAA,CAAAV,OAAA;AACA,IAAAW,mBAAA,GAAAD,sBAAA,CAAAV,OAAA;AACA,IAAAY,eAAA,GAAAF,sBAAA,CAAAV,OAAA;AACA,IAAAa,eAAA,GAAAH,sBAAA,CAAAV,OAAA;AACA,IAAAc,SAAA,GAAAJ,sBAAA,CAAAV,OAAA;AACA,IAAAe,UAAA,GAAAL,sBAAA,CAAAV,OAAA;AAA0C,IAAAgB,SAAA;EAAAC,UAAA;AAE1C,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA,EAA2B;EACnD,OAAO,IAAIC,kCAAgB,CAA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OAAA,CAAAiE,aAAA,CAACjF,UAAA,CAAAgB,OAAS,MAAE,CAAC,gBAEbjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACvF,OAAA,CAAAsB,OAAM;MAACmE,kBAAkB,EAAEzC,MAAM,CAACyC;IAAmB,CAAE,CAC3D,eACDpG,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACrF,mBAAA,CAAAoB,OAAkB,MAAE,CAAC,eACtBjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACpF,eAAA,CAAAmB,OAAc,MAAE,CAAC,eAClBjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAACnF,eAAA,CAAAkB,OAAc,MAAE,CAAC,eAClBjC,MAAA,CAAAiC,OAAA,CAAAiE,aAAA,CAAClF,SAAA,CAAAiB,OAAQ,QAAEoC,QAAmB,CACnB,CAAC;EAExB,CAAC;EAED,OAAOF,cAAc;AACzB,CAAC;AAACkC,OAAA,CAAA9C,oBAAA,GAAAA,oBAAA"}
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_auth","_reactHooks","_apolloLinkContext","_plugins","_ApolloLinkPlugin","_Authenticator","_appSecurity","_config","_SignIn","_RequireNewPassword","_ForgotPassword","_SetNewPassword","_SignedIn","_LoggingIn","_FederatedProviders","_View","_excluded","_excluded2","Components","View","FederatedProviders","SignIn","exports","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","_ref2$allowSignInWith","allowSignInWithCredentials","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","LoggingIn","federatedProviders","RequireNewPassword","ForgotPassword","SetNewPassword","SignedIn"],"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 { SecurityPermission } from \"@webiny/app-security/types\";\nimport { CognitoIdToken } from \"@webiny/app-cognito-authenticator/types\";\nimport { Authenticator } from \"@webiny/app-cognito-authenticator/Authenticator\";\nimport { useSecurity } from \"@webiny/app-security\";\nimport { config as appConfig } from \"@webiny/app/config\";\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 { LoggingIn } from \"~/views/LoggingIn\";\nimport { FederatedIdentityProvider } from \"~/federatedIdentityProviders\";\nimport { FederatedProviders } from \"~/components/FederatedProviders\";\nimport { View } from \"~/components/View\";\n\nexport const Components = {\n View,\n FederatedProviders,\n SignIn\n};\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 interface AuthenticationFactoryConfig extends AuthOptions {\n allowSignInWithCredentials?: boolean;\n federatedProviders?: FederatedIdentityProvider[];\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 allowSignInWithCredentials = true,\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 setIdentity({\n id,\n displayName,\n type,\n permissions,\n ...data,\n logout:\n logout ||\n (() => {\n return void 0;\n })\n });\n\n validatePermissions(permissions);\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\n federatedProviders={config.federatedProviders}\n allowSignInWithCredentials={allowSignInWithCredentials}\n />\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,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,OAAA,GAAAT,OAAA;AACA,IAAAU,mBAAA,GAAAV,OAAA;AACA,IAAAW,eAAA,GAAAX,OAAA;AACA,IAAAY,eAAA,GAAAZ,OAAA;AACA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,UAAA,GAAAd,OAAA;AAEA,IAAAe,mBAAA,GAAAf,OAAA;AACA,IAAAgB,KAAA,GAAAhB,OAAA;AAAyC,IAAAiB,SAAA;EAAAC,UAAA;AAElC,IAAMC,UAAU,GAAG;EACtBC,IAAI,EAAJA,UAAI;EACJC,kBAAkB,EAAlBA,sCAAkB;EAClBC,MAAM,EAANA;AACJ,CAAC;AAACC,OAAA,CAAAJ,UAAA,GAAAA,UAAA;AAEF,IAAMK,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA,EAA2B;EACnD,OAAO,IAAIC,kCA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,CAAAmE,aAAA,CAAClG,cAAA,CAAAmG,aAAa;MAAClB,OAAO,EAAEA;IAAQ,GAC3BP,eAAe,gBACZlF,MAAA,CAAAuC,OAAA,CAAAmE,aAAA,CAAC1F,UAAA,CAAA4F,SAAS,MAAE,CAAC,gBAEb5G,MAAA,CAAAuC,OAAA,CAAAmE,aAAA,CAAC/F,OAAA,CAAAa,MAAM;MACHqF,kBAAkB,EAAE1C,MAAM,CAAC0C,kBAAmB;MAC9C7C,0BAA0B,EAAEA;IAA2B,CAC1D,CACJ,eACDhE,MAAA,CAAAuC,OAAA,CAAAmE,aAAA,CAAC9F,mBAAA,CAAAkG,kBAAkB,MAAE,CAAC,eACtB9G,MAAA,CAAAuC,OAAA,CAAAmE,aAAA,CAAC7F,eAAA,CAAAkG,cAAc,MAAE,CAAC,eAClB/G,MAAA,CAAAuC,OAAA,CAAAmE,aAAA,CAAC5F,eAAA,CAAAkG,cAAc,MAAE,CAAC,eAClBhH,MAAA,CAAAuC,OAAA,CAAAmE,aAAA,CAAC3F,SAAA,CAAAkG,QAAQ,QAAEpC,QAAmB,CACnB,CAAC;EAExB,CAAC;EAED,OAAOF,cAAc;AACzB,CAAC;AAAClD,OAAA,CAAAoC,oBAAA,GAAAA,oBAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/app-admin-cognito",
|
|
3
|
-
"version": "5.39.4-beta.
|
|
3
|
+
"version": "5.39.4-beta.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,20 +15,20 @@
|
|
|
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": "5.39.4-beta.
|
|
19
|
-
"@webiny/app-admin": "5.39.4-beta.
|
|
20
|
-
"@webiny/app-cognito-authenticator": "5.39.4-beta.
|
|
21
|
-
"@webiny/app-security": "5.39.4-beta.
|
|
22
|
-
"@webiny/form": "5.39.4-beta.
|
|
23
|
-
"@webiny/plugins": "5.39.4-beta.
|
|
24
|
-
"@webiny/
|
|
25
|
-
"@webiny/
|
|
18
|
+
"@webiny/app": "5.39.4-beta.1",
|
|
19
|
+
"@webiny/app-admin": "5.39.4-beta.1",
|
|
20
|
+
"@webiny/app-cognito-authenticator": "5.39.4-beta.1",
|
|
21
|
+
"@webiny/app-security": "5.39.4-beta.1",
|
|
22
|
+
"@webiny/form": "5.39.4-beta.1",
|
|
23
|
+
"@webiny/plugins": "5.39.4-beta.1",
|
|
24
|
+
"@webiny/react-composition": "5.39.4-beta.1",
|
|
25
|
+
"@webiny/ui": "5.39.4-beta.1",
|
|
26
|
+
"@webiny/validation": "5.39.4-beta.1",
|
|
26
27
|
"apollo-client": "2.6.10",
|
|
27
28
|
"apollo-link-context": "1.0.20",
|
|
28
29
|
"emotion": "10.0.27",
|
|
29
30
|
"react": "17.0.2",
|
|
30
|
-
"react-dom": "17.0.2"
|
|
31
|
-
"react-social-login-buttons": "3.9.1"
|
|
31
|
+
"react-dom": "17.0.2"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@babel/cli": "7.22.6",
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"@babel/preset-env": "7.22.7",
|
|
39
39
|
"@babel/preset-react": "7.22.5",
|
|
40
40
|
"@babel/preset-typescript": "7.22.5",
|
|
41
|
-
"@webiny/cli": "5.39.4-beta.
|
|
42
|
-
"@webiny/project-utils": "5.39.4-beta.
|
|
41
|
+
"@webiny/cli": "5.39.4-beta.1",
|
|
42
|
+
"@webiny/project-utils": "5.39.4-beta.1",
|
|
43
43
|
"rimraf": "3.0.2",
|
|
44
44
|
"ttypescript": "1.5.15",
|
|
45
45
|
"typescript": "4.7.4"
|
|
@@ -54,10 +54,13 @@
|
|
|
54
54
|
},
|
|
55
55
|
"adio": {
|
|
56
56
|
"ignore": {
|
|
57
|
+
"dependencies": [
|
|
58
|
+
"@webiny/react-composition"
|
|
59
|
+
],
|
|
57
60
|
"peerDependencies": [
|
|
58
61
|
"react-dom"
|
|
59
62
|
]
|
|
60
63
|
}
|
|
61
64
|
},
|
|
62
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "e3eb846a11cecc35882c84879464dfa2706cfcd9"
|
|
63
66
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { FederatedIdentityProvider } from "../federatedIdentityProviders";
|
|
3
3
|
interface FederatedLoginProps {
|
|
4
|
-
providers:
|
|
4
|
+
providers: FederatedIdentityProvider[];
|
|
5
5
|
}
|
|
6
6
|
export declare const FederatedLogin: ({ providers }: FederatedLoginProps) => JSX.Element;
|
|
7
7
|
export {};
|
package/views/FederatedLogin.js
CHANGED
|
@@ -6,33 +6,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.FederatedLogin = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
|
10
9
|
var _auth = require("@aws-amplify/auth");
|
|
11
|
-
var
|
|
12
|
-
var
|
|
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;");
|
|
10
|
+
var _federatedIdentityProviders = require("../federatedIdentityProviders");
|
|
11
|
+
var _FederatedProviders = require("../components/FederatedProviders");
|
|
25
12
|
var FederatedLogin = function FederatedLogin(_ref) {
|
|
26
13
|
var providers = _ref.providers;
|
|
27
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
28
|
-
var
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_FederatedProviders.FederatedProviders.Container, null, providers.map(function (_ref2) {
|
|
15
|
+
var name = _ref2.name,
|
|
16
|
+
Component = _ref2.component;
|
|
17
|
+
var cognitoProviderName = _federatedIdentityProviders.federatedIdentityProviders[name] ?? name;
|
|
18
|
+
var isCustomProvider = !(name in _federatedIdentityProviders.federatedIdentityProviders);
|
|
19
|
+
var signIn = function signIn() {
|
|
20
|
+
if (isCustomProvider) {
|
|
21
|
+
_auth.Auth.federatedSignIn({
|
|
22
|
+
customProvider: cognitoProviderName
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
_auth.Auth.federatedSignIn({
|
|
26
|
+
provider: cognitoProviderName
|
|
34
27
|
});
|
|
35
28
|
}
|
|
29
|
+
};
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(Component, {
|
|
31
|
+
key: name,
|
|
32
|
+
signIn: signIn
|
|
36
33
|
});
|
|
37
34
|
}));
|
|
38
35
|
};
|