@tern-secure/nextjs 3.2.0 → 3.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
  var TernSecureServerProvider_exports = {};
20
30
  __export(TernSecureServerProvider_exports, {
@@ -22,9 +32,13 @@ __export(TernSecureServerProvider_exports, {
22
32
  });
23
33
  module.exports = __toCommonJS(TernSecureServerProvider_exports);
24
34
  var import_jsx_runtime = require("react/jsx-runtime");
25
- var import_TernSecureProvider = require("../client/TernSecureProvider");
35
+ var import_dynamic = __toESM(require("next/dynamic"));
36
+ const TernSecureClientProvider = (0, import_dynamic.default)(
37
+ () => import("../client/TernSecureProvider").then((mod) => mod.TernSecureClientProvider),
38
+ { loading: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "Loading..." }) }
39
+ );
26
40
  function TernSecureProvider({ children }) {
27
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_TernSecureProvider.TernSecureClientProvider, { children });
41
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TernSecureClientProvider, { children });
28
42
  }
29
43
  // Annotate the CommonJS export names for ESM import in node:
30
44
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"sourcesContent":["import React from \"react\"\r\nimport { TernSecureClientProvider } from \"../client/TernSecureProvider\"\r\n\r\n\r\n\r\n// Loading fallback component\r\n/*function TernSecureLoadingFallback() {\r\n return (\r\n <div>\r\n <span className=\"sr-only\">Loading authentication...</span>\r\n </div>\r\n )\r\n}*/\r\n/**\r\n * Root Provider for TernSecure\r\n * Use this in your Next.js App Router root layout\r\n * Automatically handles client/server boundary and authentication state\r\n * \r\n * @example\r\n * // app/layout.tsx\r\n * import { TernSecureProvider } from '@tern/secure'\r\n * \r\n * export default function RootLayout({ children }) {\r\n * return (\r\n * <html>\r\n * <body>\r\n * <TernSecureProvider>\r\n * {children}\r\n * </TernSecureProvider>\r\n * </body>\r\n * </html>\r\n * )\r\n * }\r\n */\r\nexport function TernSecureProvider({ children }: { children: React.ReactNode }) {\r\n return (\r\n <TernSecureClientProvider>\r\n {children}\r\n </TernSecureClientProvider>\r\n )\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCM;AAnCN,gCAAyC;AAiClC,SAAS,mBAAmB,EAAE,SAAS,GAAkC;AAC9E,SACI,4CAAC,sDACI,UACL;AAEN;","names":[]}
1
+ {"version":3,"sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"sourcesContent":["import React from \"react\"\r\nimport dynamic from \"next/dynamic\"\r\n\r\nconst TernSecureClientProvider = dynamic(\r\n () => import(\"../client/TernSecureProvider\").then(mod => mod.TernSecureClientProvider),\r\n { loading: () => <div>Loading...</div> }\r\n)\r\n\r\n// Loading fallback component\r\n/*function TernSecureLoadingFallback() {\r\n return (\r\n <div>\r\n <span className=\"sr-only\">Loading authentication...</span>\r\n </div>\r\n )\r\n}*/\r\n/**\r\n * Root Provider for TernSecure\r\n * Use this in your Next.js App Router root layout\r\n * Automatically handles client/server boundary and authentication state\r\n * \r\n * @example\r\n * // app/layout.tsx\r\n * import { TernSecureProvider } from '@tern/secure'\r\n * \r\n * export default function RootLayout({ children }) {\r\n * return (\r\n * <html>\r\n * <body>\r\n * <TernSecureProvider>\r\n * {children}\r\n * </TernSecureProvider>\r\n * </body>\r\n * </html>\r\n * )\r\n * }\r\n */\r\nexport function TernSecureProvider({ children }: { children: React.ReactNode }) {\r\n return (\r\n <TernSecureClientProvider>\r\n {children}\r\n </TernSecureClientProvider>\r\n )\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKmB;AAJnB,qBAAoB;AAEpB,MAAM,+BAA2B,eAAAA;AAAA,EAC/B,MAAM,OAAO,8BAA8B,EAAE,KAAK,SAAO,IAAI,wBAAwB;AAAA,EACrF,EAAE,SAAS,MAAM,4CAAC,SAAI,wBAAU,EAAO;AACzC;AA+BO,SAAS,mBAAmB,EAAE,SAAS,GAAkC;AAC9E,SACI,4CAAC,4BACI,UACL;AAEN;","names":["dynamic"]}
@@ -33,7 +33,7 @@ function useAuth() {
33
33
  }
34
34
  return {
35
35
  userId: authState.userId,
36
- loading: authState.isLoaded,
36
+ isLoaded: authState.isLoaded,
37
37
  error: authState.error,
38
38
  isSignedIn: authState.isSignedIn
39
39
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/boundary/hooks/useAuth.ts"],"sourcesContent":["'use client'\r\n\r\nimport { useContext } from 'react'\r\nimport { useInternalContext } from '../../boundary/TernSecureCtx'\r\nimport { AuthStateContext } from '../../app-router/client/TernSecureProvider'\r\n\r\nexport function useAuth(){\r\n // Verify we're within the provider boundary\r\n useInternalContext('useAuth')\r\n \r\n // Get the auth state from the AuthStateContext\r\n const authState = useContext(AuthStateContext)\r\n if (!authState) {\r\n throw new Error('Auth state not found')\r\n }\r\n\r\n\r\n return {\r\n userId: authState.userId,\r\n loading: authState.isLoaded,\r\n error: authState.error,\r\n isSignedIn: authState.isSignedIn\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2B;AAC3B,2BAAmC;AACnC,gCAAiC;AAE1B,SAAS,UAAS;AAEvB,+CAAmB,SAAS;AAG5B,QAAM,gBAAY,yBAAW,0CAAgB;AAC7C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAGE,SAAO;AAAA,IACP,QAAQ,UAAU;AAAA,IAClB,SAAS,UAAU;AAAA,IACnB,OAAO,UAAU;AAAA,IACjB,YAAY,UAAU;AAAA,EACxB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/boundary/hooks/useAuth.ts"],"sourcesContent":["'use client'\r\n\r\nimport { useContext } from 'react'\r\nimport { useInternalContext } from '../../boundary/TernSecureCtx'\r\nimport { AuthStateContext } from '../../app-router/client/TernSecureProvider'\r\n\r\nexport function useAuth(){\r\n // Verify we're within the provider boundary\r\n useInternalContext('useAuth')\r\n \r\n // Get the auth state from the AuthStateContext\r\n const authState = useContext(AuthStateContext)\r\n if (!authState) {\r\n throw new Error('Auth state not found')\r\n }\r\n\r\n\r\n return {\r\n userId: authState.userId,\r\n isLoaded: authState.isLoaded,\r\n error: authState.error,\r\n isSignedIn: authState.isSignedIn\r\n }\r\n}"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAA2B;AAC3B,2BAAmC;AACnC,gCAAiC;AAE1B,SAAS,UAAS;AAEvB,+CAAmB,SAAS;AAG5B,QAAM,gBAAY,yBAAW,0CAAgB;AAC7C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAGE,SAAO;AAAA,IACP,QAAQ,UAAU;AAAA,IAClB,UAAU,UAAU;AAAA,IACpB,OAAO,UAAU;AAAA,IACjB,YAAY,UAAU;AAAA,EACxB;AACF;","names":[]}
@@ -1,5 +1,9 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { TernSecureClientProvider } from "../client/TernSecureProvider";
2
+ import dynamic from "next/dynamic";
3
+ const TernSecureClientProvider = dynamic(
4
+ () => import("../client/TernSecureProvider").then((mod) => mod.TernSecureClientProvider),
5
+ { loading: () => /* @__PURE__ */ jsx("div", { children: "Loading..." }) }
6
+ );
3
7
  function TernSecureProvider({ children }) {
4
8
  return /* @__PURE__ */ jsx(TernSecureClientProvider, { children });
5
9
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"sourcesContent":["import React from \"react\"\r\nimport { TernSecureClientProvider } from \"../client/TernSecureProvider\"\r\n\r\n\r\n\r\n// Loading fallback component\r\n/*function TernSecureLoadingFallback() {\r\n return (\r\n <div>\r\n <span className=\"sr-only\">Loading authentication...</span>\r\n </div>\r\n )\r\n}*/\r\n/**\r\n * Root Provider for TernSecure\r\n * Use this in your Next.js App Router root layout\r\n * Automatically handles client/server boundary and authentication state\r\n * \r\n * @example\r\n * // app/layout.tsx\r\n * import { TernSecureProvider } from '@tern/secure'\r\n * \r\n * export default function RootLayout({ children }) {\r\n * return (\r\n * <html>\r\n * <body>\r\n * <TernSecureProvider>\r\n * {children}\r\n * </TernSecureProvider>\r\n * </body>\r\n * </html>\r\n * )\r\n * }\r\n */\r\nexport function TernSecureProvider({ children }: { children: React.ReactNode }) {\r\n return (\r\n <TernSecureClientProvider>\r\n {children}\r\n </TernSecureClientProvider>\r\n )\r\n}"],"mappings":"AAoCM;AAnCN,SAAS,gCAAgC;AAiClC,SAAS,mBAAmB,EAAE,SAAS,GAAkC;AAC9E,SACI,oBAAC,4BACI,UACL;AAEN;","names":[]}
1
+ {"version":3,"sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"sourcesContent":["import React from \"react\"\r\nimport dynamic from \"next/dynamic\"\r\n\r\nconst TernSecureClientProvider = dynamic(\r\n () => import(\"../client/TernSecureProvider\").then(mod => mod.TernSecureClientProvider),\r\n { loading: () => <div>Loading...</div> }\r\n)\r\n\r\n// Loading fallback component\r\n/*function TernSecureLoadingFallback() {\r\n return (\r\n <div>\r\n <span className=\"sr-only\">Loading authentication...</span>\r\n </div>\r\n )\r\n}*/\r\n/**\r\n * Root Provider for TernSecure\r\n * Use this in your Next.js App Router root layout\r\n * Automatically handles client/server boundary and authentication state\r\n * \r\n * @example\r\n * // app/layout.tsx\r\n * import { TernSecureProvider } from '@tern/secure'\r\n * \r\n * export default function RootLayout({ children }) {\r\n * return (\r\n * <html>\r\n * <body>\r\n * <TernSecureProvider>\r\n * {children}\r\n * </TernSecureProvider>\r\n * </body>\r\n * </html>\r\n * )\r\n * }\r\n */\r\nexport function TernSecureProvider({ children }: { children: React.ReactNode }) {\r\n return (\r\n <TernSecureClientProvider>\r\n {children}\r\n </TernSecureClientProvider>\r\n )\r\n}"],"mappings":"AAKmB;AAJnB,OAAO,aAAa;AAEpB,MAAM,2BAA2B;AAAA,EAC/B,MAAM,OAAO,8BAA8B,EAAE,KAAK,SAAO,IAAI,wBAAwB;AAAA,EACrF,EAAE,SAAS,MAAM,oBAAC,SAAI,wBAAU,EAAO;AACzC;AA+BO,SAAS,mBAAmB,EAAE,SAAS,GAAkC;AAC9E,SACI,oBAAC,4BACI,UACL;AAEN;","names":[]}
@@ -10,7 +10,7 @@ function useAuth() {
10
10
  }
11
11
  return {
12
12
  userId: authState.userId,
13
- loading: authState.isLoaded,
13
+ isLoaded: authState.isLoaded,
14
14
  error: authState.error,
15
15
  isSignedIn: authState.isSignedIn
16
16
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/boundary/hooks/useAuth.ts"],"sourcesContent":["'use client'\r\n\r\nimport { useContext } from 'react'\r\nimport { useInternalContext } from '../../boundary/TernSecureCtx'\r\nimport { AuthStateContext } from '../../app-router/client/TernSecureProvider'\r\n\r\nexport function useAuth(){\r\n // Verify we're within the provider boundary\r\n useInternalContext('useAuth')\r\n \r\n // Get the auth state from the AuthStateContext\r\n const authState = useContext(AuthStateContext)\r\n if (!authState) {\r\n throw new Error('Auth state not found')\r\n }\r\n\r\n\r\n return {\r\n userId: authState.userId,\r\n loading: authState.isLoaded,\r\n error: authState.error,\r\n isSignedIn: authState.isSignedIn\r\n }\r\n}"],"mappings":";AAEA,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AAE1B,SAAS,UAAS;AAEvB,qBAAmB,SAAS;AAG5B,QAAM,YAAY,WAAW,gBAAgB;AAC7C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAGE,SAAO;AAAA,IACP,QAAQ,UAAU;AAAA,IAClB,SAAS,UAAU;AAAA,IACnB,OAAO,UAAU;AAAA,IACjB,YAAY,UAAU;AAAA,EACxB;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../../src/boundary/hooks/useAuth.ts"],"sourcesContent":["'use client'\r\n\r\nimport { useContext } from 'react'\r\nimport { useInternalContext } from '../../boundary/TernSecureCtx'\r\nimport { AuthStateContext } from '../../app-router/client/TernSecureProvider'\r\n\r\nexport function useAuth(){\r\n // Verify we're within the provider boundary\r\n useInternalContext('useAuth')\r\n \r\n // Get the auth state from the AuthStateContext\r\n const authState = useContext(AuthStateContext)\r\n if (!authState) {\r\n throw new Error('Auth state not found')\r\n }\r\n\r\n\r\n return {\r\n userId: authState.userId,\r\n isLoaded: authState.isLoaded,\r\n error: authState.error,\r\n isSignedIn: authState.isSignedIn\r\n }\r\n}"],"mappings":";AAEA,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,wBAAwB;AAE1B,SAAS,UAAS;AAEvB,qBAAmB,SAAS;AAG5B,QAAM,YAAY,WAAW,gBAAgB;AAC7C,MAAI,CAAC,WAAW;AACd,UAAM,IAAI,MAAM,sBAAsB;AAAA,EACxC;AAGE,SAAO;AAAA,IACP,QAAQ,UAAU;AAAA,IAClB,UAAU,UAAU;AAAA,IACpB,OAAO,UAAU;AAAA,IACjB,YAAY,UAAU;AAAA,EACxB;AACF;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"TernSecureServerProvider.d.ts","sourceRoot":"","sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAazB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAM7E"}
1
+ {"version":3,"file":"TernSecureServerProvider.d.ts","sourceRoot":"","sources":["../../../../src/app-router/server/TernSecureServerProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAgBzB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,2CAM7E"}
@@ -1,6 +1,6 @@
1
1
  export declare function useAuth(): {
2
2
  userId: string | null;
3
- loading: boolean;
3
+ isLoaded: boolean;
4
4
  error: string | null;
5
5
  isSignedIn: boolean;
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tern-secure/nextjs",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "packageManager": "npm@10.9.0",
5
5
  "publishConfig": {
6
6
  "access": "public"