@cabin-id/nextjs 1.2.6 → 1.2.7
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/cjs/components/SignInButton.js +6 -3
- package/dist/cjs/components/SignInButton.js.map +1 -1
- package/dist/cjs/utils/initial.js +1 -1
- package/dist/cjs/utils/initial.js.map +1 -1
- package/dist/esm/components/SignInButton.js +6 -3
- package/dist/esm/components/SignInButton.js.map +1 -1
- package/dist/esm/utils/initial.js +1 -1
- package/dist/esm/utils/initial.js.map +1 -1
- package/dist/types/components/SignInButton.d.ts +15 -1
- package/dist/types/components/SignInButton.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -35,7 +35,10 @@ module.exports = __toCommonJS(SignInButton_exports);
|
|
|
35
35
|
var import_react = __toESM(require("react"));
|
|
36
36
|
var import_logo = require("../icons/logo");
|
|
37
37
|
var import_constants = require("../constants");
|
|
38
|
-
const SignInButton = (
|
|
38
|
+
const SignInButton = ({
|
|
39
|
+
children = "Continue to CabinID",
|
|
40
|
+
className = "max-w-48 pl-2 py-2 pr-4 bg-blue-600 rounded-full flex flex-row space-x-2 items-center hover:opacity-90 active:bg-blue-700"
|
|
41
|
+
}) => {
|
|
39
42
|
const [signInUrl, setSignInUrl] = (0, import_react.useState)("#");
|
|
40
43
|
(0, import_react.useEffect)(() => {
|
|
41
44
|
if (typeof window !== "undefined") {
|
|
@@ -54,10 +57,10 @@ const SignInButton = () => {
|
|
|
54
57
|
"a",
|
|
55
58
|
{
|
|
56
59
|
href: signInUrl,
|
|
57
|
-
className
|
|
60
|
+
className
|
|
58
61
|
},
|
|
59
62
|
/* @__PURE__ */ import_react.default.createElement(import_logo.CabinLogo, null),
|
|
60
|
-
/* @__PURE__ */ import_react.default.createElement("span", { className: "text-white text-sm" },
|
|
63
|
+
/* @__PURE__ */ import_react.default.createElement("span", { className: "text-white text-sm" }, children)
|
|
61
64
|
);
|
|
62
65
|
};
|
|
63
66
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/SignInButton.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { CabinLogo } from '../icons/logo';\nimport { AFTER_SIGN_IN_URL, frontendApi } from '../constants';\n\nexport const SignInButton = () => {\n const [signInUrl, setSignInUrl] = useState('#');\n\n useEffect(() => {\n if (typeof window !== 'undefined') {\n const origin = typeof window === 'undefined' ? null : window.origin;\n if (!origin) {\n return;\n }\n const params = new URLSearchParams({\n redirect_url: `${origin}${AFTER_SIGN_IN_URL}` || '/',\n });\n const signInUrlTemp = frontendApi\n ? `https://${frontendApi}/sign-in?${params.toString()}`\n : '#';\n setSignInUrl(signInUrlTemp);\n }\n }, []);\n\n return (\n <a\n href={signInUrl}\n className
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SignInButton.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { CabinLogo } from '../icons/logo';\nimport { AFTER_SIGN_IN_URL, frontendApi } from '../constants';\n\nexport interface SignInButtonProps {\n /**\n * Custom text to display on the button\n * @default \"Continue to CabinID\"\n */\n children?: React.ReactNode;\n /**\n * Custom CSS class name\n */\n className?: string;\n}\n\n/**\n * SignInButton component that handles user authentication redirect to CabinID\n */\nexport const SignInButton: React.FC<SignInButtonProps> = ({\n children = 'Continue to CabinID',\n className = 'max-w-48 pl-2 py-2 pr-4 bg-blue-600 rounded-full flex flex-row space-x-2 items-center hover:opacity-90 active:bg-blue-700',\n}) => {\n const [signInUrl, setSignInUrl] = useState('#');\n\n useEffect(() => {\n if (typeof window !== 'undefined') {\n const origin = typeof window === 'undefined' ? null : window.origin;\n if (!origin) {\n return;\n }\n const params = new URLSearchParams({\n redirect_url: `${origin}${AFTER_SIGN_IN_URL}` || '/',\n });\n const signInUrlTemp = frontendApi\n ? `https://${frontendApi}/sign-in?${params.toString()}`\n : '#';\n setSignInUrl(signInUrlTemp);\n }\n }, []);\n\n return (\n <a\n href={signInUrl}\n className={className}\n >\n <CabinLogo />\n <span className=\"text-white text-sm\">{children}</span>\n </a>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2C;AAC3C,kBAA0B;AAC1B,uBAA+C;AAiBxC,MAAM,eAA4C,CAAC;AAAA,EACxD,WAAW;AAAA,EACX,YAAY;AACd,MAAM;AACJ,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,GAAG;AAE9C,8BAAU,MAAM;AACd,QAAI,OAAO,WAAW,aAAa;AACjC,YAAM,SAAS,OAAO,WAAW,cAAc,OAAO,OAAO;AAC7D,UAAI,CAAC,QAAQ;AACX;AAAA,MACF;AACA,YAAM,SAAS,IAAI,gBAAgB;AAAA,QACjC,cAAc,GAAG,MAAM,GAAG,kCAAiB,MAAM;AAAA,MACnD,CAAC;AACD,YAAM,gBAAgB,+BAClB,WAAW,4BAAW,YAAY,OAAO,SAAS,CAAC,KACnD;AACJ,mBAAa,aAAa;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SACE,6BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA;AAAA,IAEA,6BAAAA,QAAA,cAAC,2BAAU;AAAA,IACX,6BAAAA,QAAA,cAAC,UAAK,WAAU,wBAAsB,QAAS;AAAA,EACjD;AAEJ;","names":["React"]}
|
|
@@ -27,7 +27,7 @@ var import_constants = require("../constants");
|
|
|
27
27
|
var import_http = require("./http");
|
|
28
28
|
const initialState = async () => {
|
|
29
29
|
var _a;
|
|
30
|
-
const cookiesStore = (0, import_headers.cookies)();
|
|
30
|
+
const cookiesStore = await (0, import_headers.cookies)();
|
|
31
31
|
const userId = ((_a = cookiesStore.get(import_constants.constants.Cookies.User)) == null ? void 0 : _a.value) || null;
|
|
32
32
|
let user = null;
|
|
33
33
|
if (userId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/initial.ts"],"sourcesContent":["'use server';\n\nimport { cookies } from 'next/headers';\nimport { constants } from '../constants';\nimport { client } from './http';\n\nexport const initialState = async () => {\n const cookiesStore = cookies();\n const userId = cookiesStore.get(constants.Cookies.User)?.value || null;\n let user = null;\n\n if (userId) {\n user = await client.users.getUser(userId);\n }\n\n return {\n userId,\n user,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAAwB;AACxB,uBAA0B;AAC1B,kBAAuB;AAEhB,MAAM,eAAe,YAAY;AANxC;AAOE,QAAM,
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/initial.ts"],"sourcesContent":["'use server';\n\nimport { cookies } from 'next/headers';\nimport { constants } from '../constants';\nimport { client } from './http';\n\nexport const initialState = async () => {\n const cookiesStore = await cookies();\n const userId = cookiesStore.get(constants.Cookies.User)?.value || null;\n let user = null;\n\n if (userId) {\n user = await client.users.getUser(userId);\n }\n\n return {\n userId,\n user,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,qBAAwB;AACxB,uBAA0B;AAC1B,kBAAuB;AAEhB,MAAM,eAAe,YAAY;AANxC;AAOE,QAAM,eAAe,UAAM,wBAAQ;AACnC,QAAM,WAAS,kBAAa,IAAI,2BAAU,QAAQ,IAAI,MAAvC,mBAA0C,UAAS;AAClE,MAAI,OAAO;AAEX,MAAI,QAAQ;AACV,WAAO,MAAM,mBAAO,MAAM,QAAQ,MAAM;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -2,7 +2,10 @@
|
|
|
2
2
|
import React, { useEffect, useState } from "react";
|
|
3
3
|
import { CabinLogo } from "../icons/logo";
|
|
4
4
|
import { AFTER_SIGN_IN_URL, frontendApi } from "../constants";
|
|
5
|
-
const SignInButton = (
|
|
5
|
+
const SignInButton = ({
|
|
6
|
+
children = "Continue to CabinID",
|
|
7
|
+
className = "max-w-48 pl-2 py-2 pr-4 bg-blue-600 rounded-full flex flex-row space-x-2 items-center hover:opacity-90 active:bg-blue-700"
|
|
8
|
+
}) => {
|
|
6
9
|
const [signInUrl, setSignInUrl] = useState("#");
|
|
7
10
|
useEffect(() => {
|
|
8
11
|
if (typeof window !== "undefined") {
|
|
@@ -21,10 +24,10 @@ const SignInButton = () => {
|
|
|
21
24
|
"a",
|
|
22
25
|
{
|
|
23
26
|
href: signInUrl,
|
|
24
|
-
className
|
|
27
|
+
className
|
|
25
28
|
},
|
|
26
29
|
/* @__PURE__ */ React.createElement(CabinLogo, null),
|
|
27
|
-
/* @__PURE__ */ React.createElement("span", { className: "text-white text-sm" },
|
|
30
|
+
/* @__PURE__ */ React.createElement("span", { className: "text-white text-sm" }, children)
|
|
28
31
|
);
|
|
29
32
|
};
|
|
30
33
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/SignInButton.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { CabinLogo } from '../icons/logo';\nimport { AFTER_SIGN_IN_URL, frontendApi } from '../constants';\n\nexport const SignInButton = () => {\n const [signInUrl, setSignInUrl] = useState('#');\n\n useEffect(() => {\n if (typeof window !== 'undefined') {\n const origin = typeof window === 'undefined' ? null : window.origin;\n if (!origin) {\n return;\n }\n const params = new URLSearchParams({\n redirect_url: `${origin}${AFTER_SIGN_IN_URL}` || '/',\n });\n const signInUrlTemp = frontendApi\n ? `https://${frontendApi}/sign-in?${params.toString()}`\n : '#';\n setSignInUrl(signInUrlTemp);\n }\n }, []);\n\n return (\n <a\n href={signInUrl}\n className
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SignInButton.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect, useState } from 'react';\nimport { CabinLogo } from '../icons/logo';\nimport { AFTER_SIGN_IN_URL, frontendApi } from '../constants';\n\nexport interface SignInButtonProps {\n /**\n * Custom text to display on the button\n * @default \"Continue to CabinID\"\n */\n children?: React.ReactNode;\n /**\n * Custom CSS class name\n */\n className?: string;\n}\n\n/**\n * SignInButton component that handles user authentication redirect to CabinID\n */\nexport const SignInButton: React.FC<SignInButtonProps> = ({\n children = 'Continue to CabinID',\n className = 'max-w-48 pl-2 py-2 pr-4 bg-blue-600 rounded-full flex flex-row space-x-2 items-center hover:opacity-90 active:bg-blue-700',\n}) => {\n const [signInUrl, setSignInUrl] = useState('#');\n\n useEffect(() => {\n if (typeof window !== 'undefined') {\n const origin = typeof window === 'undefined' ? null : window.origin;\n if (!origin) {\n return;\n }\n const params = new URLSearchParams({\n redirect_url: `${origin}${AFTER_SIGN_IN_URL}` || '/',\n });\n const signInUrlTemp = frontendApi\n ? `https://${frontendApi}/sign-in?${params.toString()}`\n : '#';\n setSignInUrl(signInUrlTemp);\n }\n }, []);\n\n return (\n <a\n href={signInUrl}\n className={className}\n >\n <CabinLogo />\n <span className=\"text-white text-sm\">{children}</span>\n </a>\n );\n};\n"],"mappings":";AAEA,OAAO,SAAS,WAAW,gBAAgB;AAC3C,SAAS,iBAAiB;AAC1B,SAAS,mBAAmB,mBAAmB;AAiBxC,MAAM,eAA4C,CAAC;AAAA,EACxD,WAAW;AAAA,EACX,YAAY;AACd,MAAM;AACJ,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,GAAG;AAE9C,YAAU,MAAM;AACd,QAAI,OAAO,WAAW,aAAa;AACjC,YAAM,SAAS,OAAO,WAAW,cAAc,OAAO,OAAO;AAC7D,UAAI,CAAC,QAAQ;AACX;AAAA,MACF;AACA,YAAM,SAAS,IAAI,gBAAgB;AAAA,QACjC,cAAc,GAAG,MAAM,GAAG,iBAAiB,MAAM;AAAA,MACnD,CAAC;AACD,YAAM,gBAAgB,cAClB,WAAW,WAAW,YAAY,OAAO,SAAS,CAAC,KACnD;AACJ,mBAAa,aAAa;AAAA,IAC5B;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN;AAAA;AAAA,IAEA,oCAAC,eAAU;AAAA,IACX,oCAAC,UAAK,WAAU,wBAAsB,QAAS;AAAA,EACjD;AAEJ;","names":[]}
|
|
@@ -4,7 +4,7 @@ import { constants } from "../constants";
|
|
|
4
4
|
import { client } from "./http";
|
|
5
5
|
const initialState = async () => {
|
|
6
6
|
var _a;
|
|
7
|
-
const cookiesStore = cookies();
|
|
7
|
+
const cookiesStore = await cookies();
|
|
8
8
|
const userId = ((_a = cookiesStore.get(constants.Cookies.User)) == null ? void 0 : _a.value) || null;
|
|
9
9
|
let user = null;
|
|
10
10
|
if (userId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/initial.ts"],"sourcesContent":["'use server';\n\nimport { cookies } from 'next/headers';\nimport { constants } from '../constants';\nimport { client } from './http';\n\nexport const initialState = async () => {\n const cookiesStore = cookies();\n const userId = cookiesStore.get(constants.Cookies.User)?.value || null;\n let user = null;\n\n if (userId) {\n user = await client.users.getUser(userId);\n }\n\n return {\n userId,\n user,\n };\n};\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEhB,MAAM,eAAe,YAAY;AANxC;AAOE,QAAM,eAAe,QAAQ;
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/initial.ts"],"sourcesContent":["'use server';\n\nimport { cookies } from 'next/headers';\nimport { constants } from '../constants';\nimport { client } from './http';\n\nexport const initialState = async () => {\n const cookiesStore = await cookies();\n const userId = cookiesStore.get(constants.Cookies.User)?.value || null;\n let user = null;\n\n if (userId) {\n user = await client.users.getUser(userId);\n }\n\n return {\n userId,\n user,\n };\n};\n"],"mappings":";AAEA,SAAS,eAAe;AACxB,SAAS,iBAAiB;AAC1B,SAAS,cAAc;AAEhB,MAAM,eAAe,YAAY;AANxC;AAOE,QAAM,eAAe,MAAM,QAAQ;AACnC,QAAM,WAAS,kBAAa,IAAI,UAAU,QAAQ,IAAI,MAAvC,mBAA0C,UAAS;AAClE,MAAI,OAAO;AAEX,MAAI,QAAQ;AACV,WAAO,MAAM,OAAO,MAAM,QAAQ,MAAM;AAAA,EAC1C;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export
|
|
2
|
+
export interface SignInButtonProps {
|
|
3
|
+
/**
|
|
4
|
+
* Custom text to display on the button
|
|
5
|
+
* @default "Continue to CabinID"
|
|
6
|
+
*/
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Custom CSS class name
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* SignInButton component that handles user authentication redirect to CabinID
|
|
15
|
+
*/
|
|
16
|
+
export declare const SignInButton: React.FC<SignInButtonProps>;
|
|
3
17
|
//# sourceMappingURL=SignInButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../../src/components/SignInButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,eAAO,MAAM,YAAY,
|
|
1
|
+
{"version":3,"file":"SignInButton.d.ts","sourceRoot":"","sources":["../../../src/components/SignInButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAInD,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+BpD,CAAC"}
|