@civic/auth 0.4.1-beta.0 → 0.4.2-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/shared/components/BlockDisplay.d.ts +2 -2
- package/dist/shared/components/BlockDisplay.d.ts.map +1 -1
- package/dist/shared/components/BlockDisplay.js +10 -8
- package/dist/shared/components/BlockDisplay.js.map +1 -1
- package/dist/shared/components/CivicAuthIframe.d.ts.map +1 -1
- package/dist/shared/components/CivicAuthIframe.js +12 -3
- package/dist/shared/components/CivicAuthIframe.js.map +1 -1
- package/dist/shared/components/CivicAuthIframeContainer.d.ts.map +1 -1
- package/dist/shared/components/CivicAuthIframeContainer.js +9 -4
- package/dist/shared/components/CivicAuthIframeContainer.js.map +1 -1
- package/dist/shared/components/CivicAuthLogoutIframeContainer.d.ts +1 -1
- package/dist/shared/components/CivicAuthLogoutIframeContainer.d.ts.map +1 -1
- package/dist/shared/components/CivicAuthLogoutIframeContainer.js +8 -2
- package/dist/shared/components/CivicAuthLogoutIframeContainer.js.map +1 -1
- package/dist/shared/lib/iframeUtils.d.ts +1 -1
- package/dist/shared/lib/iframeUtils.d.ts.map +1 -1
- package/dist/shared/lib/iframeUtils.js +1 -1
- package/dist/shared/lib/iframeUtils.js.map +1 -1
- package/dist/shared/version.d.ts +1 -1
- package/dist/shared/version.js +1 -1
- package/dist/shared/version.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
2
|
declare const BlockDisplay: ({ children }: {
|
|
3
3
|
children: ReactNode;
|
|
4
|
-
}) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
}) => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
5
5
|
export { BlockDisplay };
|
|
6
6
|
//# sourceMappingURL=BlockDisplay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockDisplay.d.ts","sourceRoot":"","sources":["../../../src/shared/components/BlockDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"BlockDisplay.d.ts","sourceRoot":"","sources":["../../../src/shared/components/BlockDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5D,QAAA,MAAM,YAAY,GAAI,cAAc;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,4DAsC1D,CAAC;AACF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { useIsInIframe } from "../hooks/useIsInIframe.js";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
4
3
|
const BlockDisplay = ({ children }) => {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const [isClient, setIsClient] = useState(false);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
// only runs on client
|
|
7
|
+
setIsClient(true);
|
|
8
|
+
}, []);
|
|
9
|
+
// don't render in server-mode as the appearance changes after load
|
|
10
|
+
return !isClient ? null : (_jsx("div", { id: "iframe-block-display-wrapper", style: {
|
|
9
11
|
position: "relative",
|
|
10
12
|
left: 0,
|
|
11
13
|
top: 0,
|
|
@@ -15,14 +17,14 @@ const BlockDisplay = ({ children }) => {
|
|
|
15
17
|
width: "100vw",
|
|
16
18
|
alignItems: "center",
|
|
17
19
|
justifyContent: "center",
|
|
18
|
-
backgroundColor:
|
|
20
|
+
backgroundColor: "transparent",
|
|
19
21
|
}, children: _jsx("div", { id: "iframe-block-display", style: {
|
|
20
22
|
position: "absolute",
|
|
21
23
|
inset: 0,
|
|
22
24
|
display: "flex",
|
|
23
25
|
alignItems: "center",
|
|
24
26
|
justifyContent: "center",
|
|
25
|
-
backgroundColor:
|
|
27
|
+
backgroundColor: "transparent",
|
|
26
28
|
}, children: children }) }));
|
|
27
29
|
};
|
|
28
30
|
export { BlockDisplay };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BlockDisplay.js","sourceRoot":"","sources":["../../../src/shared/components/BlockDisplay.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BlockDisplay.js","sourceRoot":"","sources":["../../../src/shared/components/BlockDisplay.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAE5D,MAAM,YAAY,GAAG,CAAC,EAAE,QAAQ,EAA2B,EAAE,EAAE;IAC7D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB;QACtB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,mEAAmE;IACnE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxB,cACE,EAAE,EAAC,8BAA8B,EACjC,KAAK,EAAE;YACL,QAAQ,EAAE,UAAU;YACpB,IAAI,EAAE,CAAC;YACP,GAAG,EAAE,CAAC;YACN,MAAM,EAAE,EAAE;YACV,OAAO,EAAE,MAAM;YACf,MAAM,EAAE,OAAO;YACf,KAAK,EAAE,OAAO;YACd,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,eAAe,EAAE,aAAa;SAC/B,YAED,cACE,EAAE,EAAC,sBAAsB,EACzB,KAAK,EAAE;gBACL,QAAQ,EAAE,UAAU;gBACpB,KAAK,EAAE,CAAC;gBACR,OAAO,EAAE,MAAM;gBACf,UAAU,EAAE,QAAQ;gBACpB,cAAc,EAAE,QAAQ;gBACxB,eAAe,EAAE,aAAa;aAC/B,YAEA,QAAQ,GACL,GACF,CACP,CAAC;AACJ,CAAC,CAAC;AACF,OAAO,EAAE,YAAY,EAAE,CAAC","sourcesContent":["import { useEffect, useState, type ReactNode } from \"react\";\n\nconst BlockDisplay = ({ children }: { children: ReactNode }) => {\n const [isClient, setIsClient] = useState(false);\n useEffect(() => {\n // only runs on client\n setIsClient(true);\n }, []);\n // don't render in server-mode as the appearance changes after load\n return !isClient ? null : (\n <div\n id=\"iframe-block-display-wrapper\"\n style={{\n position: \"relative\",\n left: 0,\n top: 0,\n zIndex: 50,\n display: \"flex\",\n height: \"100vh\",\n width: \"100vw\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"transparent\",\n }}\n >\n <div\n id=\"iframe-block-display\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"transparent\",\n }}\n >\n {children}\n </div>\n </div>\n );\n};\nexport { BlockDisplay };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CivicAuthIframe.d.ts","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframe.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0C,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CivicAuthIframe.d.ts","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframe.tsx"],"names":[],"mappings":"AACA,OAAO,KAA0C,MAAM,OAAO,CAAC;AAM/D,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,QAAA,MAAM,eAAe,gGAqDpB,CAAC;AAIF,YAAY,EAAE,oBAAoB,EAAE,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
3
3
|
import React, { forwardRef, useEffect, useState } from "react";
|
|
4
|
-
import IframeResizer from "@iframe-resizer/react";
|
|
4
|
+
// import IframeResizer from "@iframe-resizer/react";
|
|
5
|
+
import IframeResizer from "iframe-resizer-react";
|
|
5
6
|
import SVGLoading from "./SVGLoading.js";
|
|
6
7
|
import { useIframe } from "../hooks/useIframe.js";
|
|
7
8
|
const CivicAuthIframe = forwardRef(({ onLoad, id }, ref) => {
|
|
@@ -13,7 +14,11 @@ const CivicAuthIframe = forwardRef(({ onLoad, id }, ref) => {
|
|
|
13
14
|
setIsClient(true);
|
|
14
15
|
}, []);
|
|
15
16
|
// don't render on the server as the appearance changes when the iframe is loaded from login-app post-messages
|
|
16
|
-
return !isClient ? null : (_jsxs("div", { children: [isLoaded ? null : (_jsx("span", { "data-testid": "iframe-shimmer-loader", children: iframeMode !== "embedded" && (_jsx(SVGLoading, { backgroundColor: backgroundColor })) })), _jsx(IframeResizer, { inPageLinks: true,
|
|
17
|
+
return !isClient ? null : (_jsxs("div", { children: [isLoaded ? null : (_jsx("span", { "data-testid": "iframe-shimmer-loader", children: iframeMode !== "embedded" && (_jsx(SVGLoading, { backgroundColor: backgroundColor })) })), _jsx(IframeResizer, { inPageLinks: true,
|
|
18
|
+
// iframe-resizer-react was downgraded due to a bug in the latest version
|
|
19
|
+
// the license field is not valid for the downgraded version
|
|
20
|
+
// license="1jy4dww5qzv-s54r73oxcn-v59f4kfgfz"
|
|
21
|
+
id: id, forwardRef: ref, "data-testid": "civic-auth-iframe-with-resizer", style: {
|
|
17
22
|
// we don't want the letterbox effect in embedded mode
|
|
18
23
|
height: iframeMode !== "embedded" ? "26px" : "24rem",
|
|
19
24
|
width: "100%",
|
|
@@ -26,7 +31,11 @@ const CivicAuthIframe = forwardRef(({ onLoad, id }, ref) => {
|
|
|
26
31
|
}, checkOrigin: false, onLoad: () => {
|
|
27
32
|
setIsLoaded(true);
|
|
28
33
|
onLoad?.();
|
|
29
|
-
}, allow: "camera; screen-wake-lock", allowFullScreen: true,
|
|
34
|
+
}, allow: "camera; screen-wake-lock", allowFullScreen: true,
|
|
35
|
+
// iframe-resizer-react was downgraded due to a bug in the latest version
|
|
36
|
+
// direction="vertical"
|
|
37
|
+
// the 'direction' field is not valid for the downgraded version
|
|
38
|
+
warningTimeout: 0 })] }));
|
|
30
39
|
});
|
|
31
40
|
CivicAuthIframe.displayName = "CivicAuthIframe";
|
|
32
41
|
export { CivicAuthIframe };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CivicAuthIframe.js","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframe.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"CivicAuthIframe.js","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframe.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC/D,qDAAqD;AACrD,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAOlD,MAAM,eAAe,GAAG,UAAU,CAChC,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE;IACtB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,CAAC;IACpD,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB;QACtB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,8GAA8G;IAC9G,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxB,0BACG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACjB,8BAAkB,uBAAuB,YACtC,UAAU,KAAK,UAAU,IAAI,CAC5B,KAAC,UAAU,IAAC,eAAe,EAAE,eAAe,GAAI,CACjD,GACI,CACR,EACD,KAAC,aAAa,IACZ,WAAW;gBACX,yEAAyE;gBACzE,4DAA4D;gBAC5D,8CAA8C;gBAC9C,EAAE,EAAE,EAAE,EACN,UAAU,EAAE,GAAG,iBACF,gCAAgC,EAC7C,KAAK,EAAE;oBACL,sDAAsD;oBACtD,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO;oBACpD,KAAK,EAAE,MAAM;oBACb,MAAM,EAAE,MAAM;oBACd,QAAQ,EAAE,MAAM;oBAChB,eAAe;oBACf,UAAU,EAAE,mBAAmB;oBAC/B,aAAa,EAAE,MAAM;oBACrB,YAAY,EAAE,MAAM;iBACrB,EACD,WAAW,EAAE,KAAK,EAClB,MAAM,EAAE,GAAG,EAAE;oBACX,WAAW,CAAC,IAAI,CAAC,CAAC;oBAClB,MAAM,EAAE,EAAE,CAAC;gBACb,CAAC,EACD,KAAK,EAAC,0BAA0B,EAChC,eAAe;gBACf,yEAAyE;gBACzE,uBAAuB;gBACvB,gEAAgE;gBAChE,cAAc,EAAE,CAAC,GACjB,IACE,CACP,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAIhD,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["\"use client\";\nimport React, { forwardRef, useEffect, useState } from \"react\";\n// import IframeResizer from \"@iframe-resizer/react\";\nimport IframeResizer from \"iframe-resizer-react\";\nimport SVGLoading from \"./SVGLoading.js\";\nimport { useIframe } from \"../hooks/useIframe.js\";\n\ntype CivicAuthIframeProps = {\n onLoad?: () => void;\n id: string;\n};\n\nconst CivicAuthIframe = forwardRef<HTMLIFrameElement, CivicAuthIframeProps>(\n ({ onLoad, id }, ref) => {\n const [isLoaded, setIsLoaded] = React.useState(false);\n const { iframeMode, backgroundColor } = useIframe();\n const [isClient, setIsClient] = useState(false);\n useEffect(() => {\n // only runs on client\n setIsClient(true);\n }, []);\n // don't render on the server as the appearance changes when the iframe is loaded from login-app post-messages\n return !isClient ? null : (\n <div>\n {isLoaded ? null : (\n <span data-testid=\"iframe-shimmer-loader\">\n {iframeMode !== \"embedded\" && (\n <SVGLoading backgroundColor={backgroundColor} />\n )}\n </span>\n )}\n <IframeResizer\n inPageLinks\n // iframe-resizer-react was downgraded due to a bug in the latest version\n // the license field is not valid for the downgraded version\n // license=\"1jy4dww5qzv-s54r73oxcn-v59f4kfgfz\"\n id={id}\n forwardRef={ref}\n data-testid={\"civic-auth-iframe-with-resizer\"}\n style={{\n // we don't want the letterbox effect in embedded mode\n height: iframeMode !== \"embedded\" ? \"26px\" : \"24rem\",\n width: \"100%\",\n border: \"none\",\n minWidth: \"100%\",\n backgroundColor,\n transition: \"height 0.25s ease\",\n pointerEvents: \"auto\",\n borderRadius: \"24px\",\n }}\n checkOrigin={false}\n onLoad={() => {\n setIsLoaded(true);\n onLoad?.();\n }}\n allow=\"camera; screen-wake-lock\"\n allowFullScreen\n // iframe-resizer-react was downgraded due to a bug in the latest version\n // direction=\"vertical\"\n // the 'direction' field is not valid for the downgraded version\n warningTimeout={0}\n />\n </div>\n );\n },\n);\n\nCivicAuthIframe.displayName = \"CivicAuthIframe\";\n\nexport type { CivicAuthIframeProps };\n\nexport { CivicAuthIframe };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CivicAuthIframeContainer.d.ts","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframeContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAUxE,KAAK,6BAA6B,GAAG;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAeF,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,aAAa,GACd,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;CACxB,
|
|
1
|
+
{"version":3,"file":"CivicAuthIframeContainer.d.ts","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframeContainer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAUxE,KAAK,6BAA6B,GAAG;IACnC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAeF,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,aAAa,GACd,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;CACxB,oDAiFA;AAED,QAAA,MAAM,wBAAwB,GAAI,+BAG/B,6BAA6B,qDAuH/B,CAAC;AAEF,YAAY,EAAE,6BAA6B,EAAE,CAAC;AAE9C,OAAO,EAAE,wBAAwB,EAAE,CAAC"}
|
|
@@ -13,7 +13,7 @@ function NoChrome({ children, }) {
|
|
|
13
13
|
return (_jsx("div", { "data-testid": "civic-iframe-no-chrome", style: { position: "relative" }, children: children }));
|
|
14
14
|
}
|
|
15
15
|
export function IframeChrome({ children, onClose, isFrameLoaded, }) {
|
|
16
|
-
const { setIframeAborted, iframeMode
|
|
16
|
+
const { setIframeAborted, iframeMode } = useIframe();
|
|
17
17
|
const iframeContainerStyleOverrides = iframeMode === "embedded"
|
|
18
18
|
? {
|
|
19
19
|
paddingTop: "1.5rem",
|
|
@@ -45,7 +45,6 @@ export function IframeChrome({ children, onClose, isFrameLoaded, }) {
|
|
|
45
45
|
}, children: _jsxs("div", { "data-testid": "iframe-chrome", style: {
|
|
46
46
|
position: "relative",
|
|
47
47
|
overflow: "hidden",
|
|
48
|
-
backgroundColor,
|
|
49
48
|
paddingLeft: "0",
|
|
50
49
|
paddingRight: "0",
|
|
51
50
|
paddingBottom: "0",
|
|
@@ -56,7 +55,7 @@ export function IframeChrome({ children, onClose, isFrameLoaded, }) {
|
|
|
56
55
|
}, onClick: (e) => e.stopPropagation(), children: [isFrameLoaded && (_jsx("button", { style: {
|
|
57
56
|
position: "absolute",
|
|
58
57
|
right: "1rem",
|
|
59
|
-
top: "
|
|
58
|
+
top: "2rem",
|
|
60
59
|
display: "flex",
|
|
61
60
|
cursor: "pointer",
|
|
62
61
|
alignItems: "center",
|
|
@@ -143,7 +142,13 @@ const CivicAuthIframeContainer = ({ onClose, closeOnRedirect = true, }) => {
|
|
|
143
142
|
}, [processIframeUrl, intervalId]);
|
|
144
143
|
const WrapperComponent = iframeMode === "embedded" ? NoChrome : IframeChrome;
|
|
145
144
|
const showLoadingIcon = !isIframeContentLoaded && iframeMode === "embedded";
|
|
146
|
-
|
|
145
|
+
const [isClient, setIsClient] = useState(false);
|
|
146
|
+
useEffect(() => {
|
|
147
|
+
// only runs on client
|
|
148
|
+
setIsClient(true);
|
|
149
|
+
}, []);
|
|
150
|
+
// don't render the loading icon wrapper in server-mode as the appearance changes after load
|
|
151
|
+
return (_jsxs(WrapperComponent, { onClose: onClose, isFrameLoaded: isIframeContentLoaded, children: [showLoadingIcon && isClient ? (_jsx("div", { id: "civic-auth-loading-icon-wrapper", style: {
|
|
147
152
|
position: "absolute",
|
|
148
153
|
inset: 0,
|
|
149
154
|
display: "flex",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AAIF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { LoadingIcon } from \"@/shared/components/LoadingIcon.js\";\nimport { CloseIcon } from \"@/shared/components/CloseIcon.js\";\nimport { CivicAuthIframe } from \"@/shared/components/CivicAuthIframe.js\";\nimport { useIframe } from \"@/shared/hooks/index.js\";\nimport { TOKEN_EXCHANGE_TRIGGER_TEXT } from \"@/constants.js\";\nimport { useCivicAuthConfig } from \"@/shared/hooks/index.js\";\nimport { useClientTokenExchangeSession } from \"@/shared/hooks/index.js\";\nimport { getIframeRef } from \"../lib/iframeUtils.js\";\n\ntype CivicAuthIframeContainerProps = {\n onClose?: () => void;\n closeOnRedirect?: boolean;\n};\n\nfunction NoChrome({\n children,\n}: {\n children: React.ReactNode;\n onClose?: () => void;\n}) {\n return (\n <div data-testid=\"civic-iframe-no-chrome\" style={{ position: \"relative\" }}>\n {children}\n </div>\n );\n}\n\nexport function IframeChrome({\n children,\n onClose,\n isFrameLoaded,\n}: {\n children: React.ReactNode;\n onClose?: () => void;\n isFrameLoaded: boolean;\n}) {\n const { setIframeAborted, iframeMode, backgroundColor } = useIframe();\n\n const iframeContainerStyleOverrides =\n iframeMode === \"embedded\"\n ? {\n paddingTop: \"1.5rem\",\n borderRadius: \"1.5rem\",\n }\n : {\n ...(isFrameLoaded\n ? {\n paddingTop: \"1.5rem\",\n borderRadius: \"1.5rem\",\n }\n : { borderRadius: \"0.5rem\", paddingTop: \"0\" }),\n };\n return (\n <div\n style={{\n position: \"fixed\", // Change to fixed to stay in viewport\n left: 0,\n top: 0,\n zIndex: 50,\n display: \"flex\",\n height: \"100vh\",\n width: \"100vw\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"rgba(17, 24, 39, 0.5)\", // Semi-transparent dark background\n backdropFilter: \"blur(4px)\", // Optional: adds slight blur to background\n }}\n onClick={() => {\n setIframeAborted(true);\n onClose?.();\n }}\n >\n <div\n data-testid=\"iframe-chrome\"\n style={{\n position: \"relative\",\n overflow: \"hidden\",\n backgroundColor,\n paddingLeft: \"0\",\n paddingRight: \"0\",\n paddingBottom: \"0\",\n // paddingTop gets added in style overrides\n ...iframeContainerStyleOverrides,\n boxShadow:\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n minWidth: \"20rem\",\n }}\n onClick={(e) => e.stopPropagation()}\n >\n {isFrameLoaded && (\n <button\n style={{\n position: \"absolute\",\n right: \"1rem\",\n top: \"1rem\",\n display: \"flex\",\n cursor: \"pointer\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"none\",\n backgroundColor: \"transparent\",\n padding: \"0.25rem\",\n color: \"#9ca3af\",\n }}\n onClick={() => {\n setIframeAborted(true);\n onClose?.();\n }}\n >\n <CloseIcon />\n </button>\n )}\n\n {children}\n </div>\n </div>\n );\n}\n\nconst CivicAuthIframeContainer = ({\n onClose,\n closeOnRedirect = true,\n}: CivicAuthIframeContainerProps) => {\n const config = useCivicAuthConfig();\n const [tokenExchangeUrl, setTokenExchangeUrl] = useState<string | null>(null);\n const { doTokenExchange } = useClientTokenExchangeSession();\n const { iframeRef, iframeMode, backgroundColor, setIframeMounted } =\n useIframe();\n\n useEffect(() => {\n setIframeMounted(true);\n }, [setIframeMounted]);\n\n useEffect(() => {\n if (tokenExchangeUrl) {\n doTokenExchange?.(tokenExchangeUrl);\n }\n }, [doTokenExchange, tokenExchangeUrl]);\n\n const processIframeUrl = useCallback(() => {\n if (!config) return;\n if (iframeRef && iframeRef.current) {\n const ref = getIframeRef(iframeRef.current)!;\n if (ref.contentWindow) {\n try {\n const iframeUrl = ref.contentWindow.location.href;\n // we know that oauth has finished when the iframe redirects to our redirectUrl\n if (iframeUrl.startsWith(config.redirectUrl)) {\n const iframeBody = ref.contentWindow.document.body.innerHTML;\n\n // If we're doing a server token exchange, we need to call the server a second time\n // using a fetch so that we're on the same domain and cookies can be sent and read\n // The server will use the presence of the code_verifier cookie to determine whether to do a token exchange or not.\n // On the initial (3rd party) redirect from the auth server, the cookie won't be sent, so the server-side callback route will just render a blank page,\n // and we'll do the exchange request from here, which will include the cookies.\n if (iframeBody.includes(TOKEN_EXCHANGE_TRIGGER_TEXT)) {\n const params = new URL(iframeUrl).searchParams;\n const appUrl = globalThis.window?.location?.origin;\n fetch(\n `${config.redirectUrl}?${params.toString()}&appUrl=${appUrl}`,\n );\n } else {\n // if we're doing token-exchange in the client, we can just set the authResponseUrl\n // to be handled by the auth provider\n // iframeRef.current.setAttribute(\"src\", \"\");\n setTokenExchangeUrl(iframeUrl);\n }\n\n if (closeOnRedirect) onClose?.();\n return true; // Successfully processed the URL\n }\n } catch {\n // ignore errors while waiting for redirect\n }\n }\n }\n return false; // Haven't processed the URL yet\n }, [closeOnRedirect, config, iframeRef, onClose]);\n\n const intervalId = useRef<NodeJS.Timeout>();\n\n const handleEscape = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onClose?.();\n }\n },\n [onClose],\n );\n\n // handle Escape\n useEffect(() => {\n window.addEventListener(\"keydown\", handleEscape);\n\n return () => window.removeEventListener(\"keydown\", handleEscape);\n });\n\n const [isIframeContentLoaded, setIsIframeContentLoaded] = useState(false);\n const handleIframeLoad = useCallback(() => {\n setIsIframeContentLoaded(true);\n\n const iframeHasUrl = processIframeUrl();\n if (iframeHasUrl && intervalId.current) {\n clearInterval(intervalId.current);\n }\n }, [processIframeUrl, intervalId]);\n\n const WrapperComponent = iframeMode === \"embedded\" ? NoChrome : IframeChrome;\n\n const showLoadingIcon = !isIframeContentLoaded && iframeMode === \"embedded\";\n return (\n <WrapperComponent onClose={onClose} isFrameLoaded={isIframeContentLoaded}>\n {showLoadingIcon ? (\n <div\n id=\"civic-auth-loading-icon-wrapper\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor,\n borderRadius: \"24px\",\n }}\n >\n <LoadingIcon />\n </div>\n ) : null}\n <CivicAuthIframe\n ref={iframeRef}\n id={\"civic-auth-iframe\"}\n onLoad={handleIframeLoad}\n />\n </WrapperComponent>\n );\n};\n\nexport type { CivicAuthIframeContainerProps };\n\nexport { CivicAuthIframeContainer };\n"]}
|
|
1
|
+
{"version":3,"file":"CivicAuthIframeContainer.js","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthIframeContainer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAOrD,SAAS,QAAQ,CAAC,EAChB,QAAQ,GAIT;IACC,OAAO,CACL,6BAAiB,wBAAwB,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,YACtE,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,EACP,aAAa,GAKd;IACC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,SAAS,EAAE,CAAC;IAErD,MAAM,6BAA6B,GACjC,UAAU,KAAK,UAAU;QACvB,CAAC,CAAC;YACE,UAAU,EAAE,QAAQ;YACpB,YAAY,E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ACE,EAAE,EAAC,iCAAiC,EACpC,KAAK,EAAE;oBACL,QAAQ,EAAE,UAAU;oBACpB,KAAK,EAAE,CAAC;oBACR,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,QAAQ;oBACpB,cAAc,EAAE,QAAQ;oBACxB,eAAe;oBACf,YAAY,EAAE,MAAM;iBACrB,YAED,KAAC,WAAW,KAAG,GACX,CACP,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,eAAe,IACd,GAAG,EAAE,SAAS,EACd,EAAE,EAAE,mBAAmB,EACvB,MAAM,EAAE,gBAAgB,GACxB,IACe,CACpB,CAAC;AACJ,CAAC,CAAC;AAIF,OAAO,EAAE,wBAAwB,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { LoadingIcon } from \"@/shared/components/LoadingIcon.js\";\nimport { CloseIcon } from \"@/shared/components/CloseIcon.js\";\nimport { CivicAuthIframe } from \"@/shared/components/CivicAuthIframe.js\";\nimport { useIframe } from \"@/shared/hooks/index.js\";\nimport { TOKEN_EXCHANGE_TRIGGER_TEXT } from \"@/constants.js\";\nimport { useCivicAuthConfig } from \"@/shared/hooks/index.js\";\nimport { useClientTokenExchangeSession } from \"@/shared/hooks/index.js\";\nimport { getIframeRef } from \"../lib/iframeUtils.js\";\n\ntype CivicAuthIframeContainerProps = {\n onClose?: () => void;\n closeOnRedirect?: boolean;\n};\n\nfunction NoChrome({\n children,\n}: {\n children: React.ReactNode;\n onClose?: () => void;\n}) {\n return (\n <div data-testid=\"civic-iframe-no-chrome\" style={{ position: \"relative\" }}>\n {children}\n </div>\n );\n}\n\nexport function IframeChrome({\n children,\n onClose,\n isFrameLoaded,\n}: {\n children: React.ReactNode;\n onClose?: () => void;\n isFrameLoaded: boolean;\n}) {\n const { setIframeAborted, iframeMode } = useIframe();\n\n const iframeContainerStyleOverrides =\n iframeMode === \"embedded\"\n ? {\n paddingTop: \"1.5rem\",\n borderRadius: \"1.5rem\",\n }\n : {\n ...(isFrameLoaded\n ? {\n paddingTop: \"1.5rem\",\n borderRadius: \"1.5rem\",\n }\n : { borderRadius: \"0.5rem\", paddingTop: \"0\" }),\n };\n return (\n <div\n style={{\n position: \"fixed\", // Change to fixed to stay in viewport\n left: 0,\n top: 0,\n zIndex: 50,\n display: \"flex\",\n height: \"100vh\",\n width: \"100vw\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor: \"rgba(17, 24, 39, 0.5)\", // Semi-transparent dark background\n backdropFilter: \"blur(4px)\", // Optional: adds slight blur to background\n }}\n onClick={() => {\n setIframeAborted(true);\n onClose?.();\n }}\n >\n <div\n data-testid=\"iframe-chrome\"\n style={{\n position: \"relative\",\n overflow: \"hidden\",\n paddingLeft: \"0\",\n paddingRight: \"0\",\n paddingBottom: \"0\",\n // paddingTop gets added in style overrides\n ...iframeContainerStyleOverrides,\n boxShadow:\n \"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)\",\n minWidth: \"20rem\",\n }}\n onClick={(e) => e.stopPropagation()}\n >\n {isFrameLoaded && (\n <button\n style={{\n position: \"absolute\",\n right: \"1rem\",\n top: \"2rem\",\n display: \"flex\",\n cursor: \"pointer\",\n alignItems: \"center\",\n justifyContent: \"center\",\n border: \"none\",\n backgroundColor: \"transparent\",\n padding: \"0.25rem\",\n color: \"#9ca3af\",\n }}\n onClick={() => {\n setIframeAborted(true);\n onClose?.();\n }}\n >\n <CloseIcon />\n </button>\n )}\n\n {children}\n </div>\n </div>\n );\n}\n\nconst CivicAuthIframeContainer = ({\n onClose,\n closeOnRedirect = true,\n}: CivicAuthIframeContainerProps) => {\n const config = useCivicAuthConfig();\n const [tokenExchangeUrl, setTokenExchangeUrl] = useState<string | null>(null);\n const { doTokenExchange } = useClientTokenExchangeSession();\n const { iframeRef, iframeMode, backgroundColor, setIframeMounted } =\n useIframe();\n\n useEffect(() => {\n setIframeMounted(true);\n }, [setIframeMounted]);\n\n useEffect(() => {\n if (tokenExchangeUrl) {\n doTokenExchange?.(tokenExchangeUrl);\n }\n }, [doTokenExchange, tokenExchangeUrl]);\n\n const processIframeUrl = useCallback(() => {\n if (!config) return;\n if (iframeRef && iframeRef.current) {\n const ref = getIframeRef(iframeRef.current)!;\n if (ref.contentWindow) {\n try {\n const iframeUrl = ref.contentWindow.location.href;\n // we know that oauth has finished when the iframe redirects to our redirectUrl\n if (iframeUrl.startsWith(config.redirectUrl)) {\n const iframeBody = ref.contentWindow.document.body.innerHTML;\n\n // If we're doing a server token exchange, we need to call the server a second time\n // using a fetch so that we're on the same domain and cookies can be sent and read\n // The server will use the presence of the code_verifier cookie to determine whether to do a token exchange or not.\n // On the initial (3rd party) redirect from the auth server, the cookie won't be sent, so the server-side callback route will just render a blank page,\n // and we'll do the exchange request from here, which will include the cookies.\n if (iframeBody.includes(TOKEN_EXCHANGE_TRIGGER_TEXT)) {\n const params = new URL(iframeUrl).searchParams;\n const appUrl = globalThis.window?.location?.origin;\n fetch(\n `${config.redirectUrl}?${params.toString()}&appUrl=${appUrl}`,\n );\n } else {\n // if we're doing token-exchange in the client, we can just set the authResponseUrl\n // to be handled by the auth provider\n // iframeRef.current.setAttribute(\"src\", \"\");\n setTokenExchangeUrl(iframeUrl);\n }\n\n if (closeOnRedirect) onClose?.();\n return true; // Successfully processed the URL\n }\n } catch {\n // ignore errors while waiting for redirect\n }\n }\n }\n return false; // Haven't processed the URL yet\n }, [closeOnRedirect, config, iframeRef, onClose]);\n\n const intervalId = useRef<NodeJS.Timeout>();\n\n const handleEscape = useCallback(\n (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n onClose?.();\n }\n },\n [onClose],\n );\n\n // handle Escape\n useEffect(() => {\n window.addEventListener(\"keydown\", handleEscape);\n\n return () => window.removeEventListener(\"keydown\", handleEscape);\n });\n\n const [isIframeContentLoaded, setIsIframeContentLoaded] = useState(false);\n const handleIframeLoad = useCallback(() => {\n setIsIframeContentLoaded(true);\n\n const iframeHasUrl = processIframeUrl();\n if (iframeHasUrl && intervalId.current) {\n clearInterval(intervalId.current);\n }\n }, [processIframeUrl, intervalId]);\n\n const WrapperComponent = iframeMode === \"embedded\" ? NoChrome : IframeChrome;\n\n const showLoadingIcon = !isIframeContentLoaded && iframeMode === \"embedded\";\n const [isClient, setIsClient] = useState(false);\n useEffect(() => {\n // only runs on client\n setIsClient(true);\n }, []);\n // don't render the loading icon wrapper in server-mode as the appearance changes after load\n return (\n <WrapperComponent onClose={onClose} isFrameLoaded={isIframeContentLoaded}>\n {showLoadingIcon && isClient ? (\n <div\n id=\"civic-auth-loading-icon-wrapper\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n backgroundColor,\n borderRadius: \"24px\",\n }}\n >\n <LoadingIcon />\n </div>\n ) : null}\n <CivicAuthIframe\n ref={iframeRef}\n id={\"civic-auth-iframe\"}\n onLoad={handleIframeLoad}\n />\n </WrapperComponent>\n );\n};\n\nexport type { CivicAuthIframeContainerProps };\n\nexport { CivicAuthIframeContainer };\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
type CivicAuthLogoutIframeContainerProps = {
|
|
2
2
|
isLoading?: boolean;
|
|
3
3
|
};
|
|
4
|
-
declare const CivicAuthLogoutIframeContainer: ({ isLoading, }: CivicAuthLogoutIframeContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare const CivicAuthLogoutIframeContainer: ({ isLoading, }: CivicAuthLogoutIframeContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element | null;
|
|
5
5
|
export { CivicAuthLogoutIframeContainer };
|
|
6
6
|
//# sourceMappingURL=CivicAuthLogoutIframeContainer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CivicAuthLogoutIframeContainer.d.ts","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthLogoutIframeContainer.tsx"],"names":[],"mappings":"AAQA,KAAK,mCAAmC,GAAG;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,8BAA8B,GAAI,gBAErC,mCAAmC,
|
|
1
|
+
{"version":3,"file":"CivicAuthLogoutIframeContainer.d.ts","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthLogoutIframeContainer.tsx"],"names":[],"mappings":"AAQA,KAAK,mCAAmC,GAAG;IACzC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,QAAA,MAAM,8BAA8B,GAAI,gBAErC,mCAAmC,4DA+BrC,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
|
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
3
|
-
import React from "react";
|
|
3
|
+
import React, { useEffect, useState } from "react";
|
|
4
4
|
import { CivicAuthIframe } from "../../shared/components/CivicAuthIframe.js";
|
|
5
5
|
import { useIframe } from "../../shared/hooks/index.js";
|
|
6
6
|
import { LoadingIcon } from "./LoadingIcon.js";
|
|
7
7
|
import { IframeChrome } from "./CivicAuthIframeContainer.js";
|
|
8
8
|
const CivicAuthLogoutIframeContainer = ({ isLoading = false, }) => {
|
|
9
9
|
const { logoutIframeRef } = useIframe();
|
|
10
|
-
|
|
10
|
+
const [isClient, setIsClient] = useState(false);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
// only runs on client
|
|
13
|
+
setIsClient(true);
|
|
14
|
+
}, []);
|
|
15
|
+
// don't render the in server-mode as the appearance changes after load
|
|
16
|
+
return !isClient ? null : (_jsxs(IframeChrome, { isFrameLoaded: true, children: [isLoading ? (_jsx("div", { id: "civic-auth-loading-icon-wrapper", style: {
|
|
11
17
|
position: "absolute",
|
|
12
18
|
inset: 0,
|
|
13
19
|
display: "flex",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CivicAuthLogoutIframeContainer.js","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthLogoutIframeContainer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CivicAuthLogoutIframeContainer.js","sourceRoot":"","sources":["../../../src/shared/components/CivicAuthLogoutIframeContainer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wCAAwC,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAM7D,MAAM,8BAA8B,GAAG,CAAC,EACtC,SAAS,GAAG,KAAK,GACmB,EAAE,EAAE;IACxC,MAAM,EAAE,eAAe,EAAE,GAAG,SAAS,EAAE,CAAC;IACxC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,SAAS,CAAC,GAAG,EAAE;QACb,sBAAsB;QACtB,WAAW,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,uEAAuE;IACvE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACxB,MAAC,YAAY,IAAC,aAAa,EAAE,IAAI,aAC9B,SAAS,CAAC,CAAC,CAAC,CACX,cACE,EAAE,EAAC,iCAAiC,EACpC,KAAK,EAAE;oBACL,QAAQ,EAAE,UAAU;oBACpB,KAAK,EAAE,CAAC;oBACR,OAAO,EAAE,MAAM;oBACf,UAAU,EAAE,QAAQ;oBACpB,cAAc,EAAE,QAAQ;iBACzB,YAED,KAAC,WAAW,KAAG,GACX,CACP,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,eAAe,IACd,GAAG,EAAE,eAAe,EACpB,EAAE,EAAE,0BAA0B,EAC9B,MAAM,EAAE,GAAG,EAAE,GAAE,CAAC,GAChB,IACW,CAChB,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC","sourcesContent":["\"use client\";\n\nimport React, { useEffect, useState } from \"react\";\nimport { CivicAuthIframe } from \"@/shared/components/CivicAuthIframe.js\";\nimport { useIframe } from \"@/shared/hooks/index.js\";\nimport { LoadingIcon } from \"./LoadingIcon.js\";\nimport { IframeChrome } from \"./CivicAuthIframeContainer.js\";\n\ntype CivicAuthLogoutIframeContainerProps = {\n isLoading?: boolean;\n};\n\nconst CivicAuthLogoutIframeContainer = ({\n isLoading = false,\n}: CivicAuthLogoutIframeContainerProps) => {\n const { logoutIframeRef } = useIframe();\n const [isClient, setIsClient] = useState(false);\n useEffect(() => {\n // only runs on client\n setIsClient(true);\n }, []);\n // don't render the in server-mode as the appearance changes after load\n return !isClient ? null : (\n <IframeChrome isFrameLoaded={true}>\n {isLoading ? (\n <div\n id=\"civic-auth-loading-icon-wrapper\"\n style={{\n position: \"absolute\",\n inset: 0,\n display: \"flex\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <LoadingIcon />\n </div>\n ) : null}\n <CivicAuthIframe\n ref={logoutIframeRef}\n id={\"civic-auth-logout-iframe\"}\n onLoad={() => {}}\n />\n </IframeChrome>\n );\n};\n\nexport { CivicAuthLogoutIframeContainer };\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type ExtendedIframeElement = HTMLIFrameElement & {
|
|
2
|
-
|
|
2
|
+
getIframeElement: () => HTMLIFrameElement;
|
|
3
3
|
};
|
|
4
4
|
export declare const getIframeRef: (iframeRef: HTMLIFrameElement | ExtendedIframeElement | null | undefined, allowNull?: boolean) => HTMLIFrameElement;
|
|
5
5
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframeUtils.d.ts","sourceRoot":"","sources":["../../../src/shared/lib/iframeUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iframeUtils.d.ts","sourceRoot":"","sources":["../../../src/shared/lib/iframeUtils.ts"],"names":[],"mappings":"AAEA,KAAK,qBAAqB,GAAG,iBAAiB,GAAG;IAE/C,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;CAC3C,CAAC;AACF,eAAO,MAAM,YAAY,GACvB,WAAW,iBAAiB,GAAG,qBAAqB,GAAG,IAAI,GAAG,SAAS,EACvE,mBAAiB,KAChB,iBAOF,CAAC"}
|
|
@@ -2,6 +2,6 @@ export const getIframeRef = (iframeRef, allowNull = false) => {
|
|
|
2
2
|
if (!iframeRef && !allowNull) {
|
|
3
3
|
throw new Error("iframeRef is required for displayMode 'iframe'");
|
|
4
4
|
}
|
|
5
|
-
return iframeRef?.
|
|
5
|
+
return (iframeRef?.getIframeElement?.() ?? iframeRef);
|
|
6
6
|
};
|
|
7
7
|
//# sourceMappingURL=iframeUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframeUtils.js","sourceRoot":"","sources":["../../../src/shared/lib/iframeUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iframeUtils.js","sourceRoot":"","sources":["../../../src/shared/lib/iframeUtils.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,SAAuE,EACvE,SAAS,GAAG,KAAK,EACE,EAAE;IACrB,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,CACJ,SAAmC,EAAE,gBAAgB,EAAE,EAAE,IAAI,SAAS,CACxE,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// the latest version of iframe resizer uses 'getElement' but the old version uses 'getIframeElement'\n// the latest version is currently broken so we're temporarily using the old version\ntype ExtendedIframeElement = HTMLIFrameElement & {\n // getElement: () => HTMLIFrameElement;\n getIframeElement: () => HTMLIFrameElement;\n};\nexport const getIframeRef = (\n iframeRef: HTMLIFrameElement | ExtendedIframeElement | null | undefined,\n allowNull = false,\n): HTMLIFrameElement => {\n if (!iframeRef && !allowNull) {\n throw new Error(\"iframeRef is required for displayMode 'iframe'\");\n }\n return (\n (iframeRef as ExtendedIframeElement)?.getIframeElement?.() ?? iframeRef\n );\n};\n"]}
|
package/dist/shared/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "@civic/auth:0.4.
|
|
1
|
+
export declare const VERSION = "@civic/auth:0.4.2-beta.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/shared/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/shared/version.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC","sourcesContent":["// This is an auto-generated file. Do not edit.\n\nexport const VERSION = \"@civic/auth:0.4.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/shared/version.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAE/C,MAAM,CAAC,MAAM,OAAO,GAAG,0BAA0B,CAAC","sourcesContent":["// This is an auto-generated file. Do not edit.\n\nexport const VERSION = \"@civic/auth:0.4.2-beta.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@civic/auth",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@emotion/react": "^11.14.0",
|
|
42
|
-
"
|
|
42
|
+
"iframe-resizer-react": "1.1.1",
|
|
43
43
|
"debug": "^4.3.7",
|
|
44
44
|
"eventemitter3": "^5.0.1",
|
|
45
45
|
"jose": "^5.9.4",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"esbuild-plugin-css-modules": "^0.3.0",
|
|
65
65
|
"eslint": "^8.57.1",
|
|
66
66
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
67
|
-
"next": "14.2.15",
|
|
67
|
+
"next": "^14.2.15",
|
|
68
68
|
"prettier": "^3.3.3",
|
|
69
69
|
"react": "18.3.1",
|
|
70
70
|
"react-dom": "18.3.1",
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
"@repo/typescript-config": "0.0.0"
|
|
80
80
|
},
|
|
81
81
|
"peerDependencies": {
|
|
82
|
-
"next": ">=
|
|
82
|
+
"next": "^14.2.25 || >=15.2.3",
|
|
83
83
|
"react": ">=18"
|
|
84
84
|
},
|
|
85
85
|
"peerDependenciesMeta": {
|