@tern-secure/nextjs 5.1.10 → 5.1.11

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.
Files changed (119) hide show
  1. package/dist/types/app-router/admin/actions.d.ts +19 -0
  2. package/dist/types/app-router/admin/actions.d.ts.map +1 -0
  3. package/dist/types/app-router/admin/constants.d.ts +2 -0
  4. package/dist/types/app-router/admin/constants.d.ts.map +1 -0
  5. package/dist/types/app-router/admin/fnValidators.d.ts +35 -0
  6. package/dist/types/app-router/admin/fnValidators.d.ts.map +1 -0
  7. package/dist/types/app-router/admin/index.d.ts +4 -0
  8. package/dist/types/app-router/admin/index.d.ts.map +1 -0
  9. package/dist/types/app-router/admin/responses.d.ts +28 -0
  10. package/dist/types/app-router/admin/responses.d.ts.map +1 -0
  11. package/dist/types/app-router/admin/sessionHandlers.d.ts +26 -0
  12. package/dist/types/app-router/admin/sessionHandlers.d.ts.map +1 -0
  13. package/dist/types/app-router/admin/ternsecureNextjsHandler.d.ts +7 -0
  14. package/dist/types/app-router/admin/ternsecureNextjsHandler.d.ts.map +1 -0
  15. package/dist/types/app-router/admin/types.d.ts +105 -0
  16. package/dist/types/app-router/admin/types.d.ts.map +1 -0
  17. package/dist/types/app-router/admin/utils.d.ts +53 -0
  18. package/dist/types/app-router/admin/utils.d.ts.map +1 -0
  19. package/dist/types/app-router/admin/validators.d.ts +46 -0
  20. package/dist/types/app-router/admin/validators.d.ts.map +1 -0
  21. package/dist/types/app-router/client/TernSecureProvider.d.ts +25 -0
  22. package/dist/types/app-router/client/TernSecureProvider.d.ts.map +1 -0
  23. package/dist/types/app-router/route-handler/internal-route.d.ts +2 -0
  24. package/dist/types/app-router/route-handler/internal-route.d.ts.map +1 -0
  25. package/dist/types/app-router/server/auth.d.ts +26 -0
  26. package/dist/types/app-router/server/auth.d.ts.map +1 -0
  27. package/dist/types/app-router/server/utils.d.ts +5 -0
  28. package/dist/types/app-router/server/utils.d.ts.map +1 -0
  29. package/dist/types/boundary/components.d.ts +2 -0
  30. package/dist/types/boundary/components.d.ts.map +1 -0
  31. package/dist/types/boundary/hooks.d.ts +2 -0
  32. package/dist/types/boundary/hooks.d.ts.map +1 -0
  33. package/dist/types/constants.d.ts +11 -0
  34. package/dist/types/constants.d.ts.map +1 -0
  35. package/dist/types/errors.d.ts +44 -0
  36. package/dist/types/errors.d.ts.map +1 -0
  37. package/dist/types/index.d.ts +5 -0
  38. package/dist/types/index.d.ts.map +1 -0
  39. package/dist/types/server/constant.d.ts +5 -0
  40. package/dist/types/server/constant.d.ts.map +1 -0
  41. package/dist/types/server/crypto.d.ts +3 -0
  42. package/dist/types/server/crypto.d.ts.map +1 -0
  43. package/dist/types/server/ctx-store.d.ts +24 -0
  44. package/dist/types/server/ctx-store.d.ts.map +1 -0
  45. package/dist/types/server/edge-session.d.ts +16 -0
  46. package/dist/types/server/edge-session.d.ts.map +1 -0
  47. package/dist/types/server/headers-utils.d.ts +10 -0
  48. package/dist/types/server/headers-utils.d.ts.map +1 -0
  49. package/dist/types/server/index.d.ts +7 -0
  50. package/dist/types/server/index.d.ts.map +1 -0
  51. package/dist/types/server/jwt-edge.d.ts +14 -0
  52. package/dist/types/server/jwt-edge.d.ts.map +1 -0
  53. package/dist/types/server/jwt.d.ts +14 -0
  54. package/dist/types/server/jwt.d.ts.map +1 -0
  55. package/dist/types/server/nextErrors.d.ts +54 -0
  56. package/dist/types/server/nextErrors.d.ts.map +1 -0
  57. package/dist/types/server/nextFetcher.d.ts +26 -0
  58. package/dist/types/server/nextFetcher.d.ts.map +1 -0
  59. package/dist/types/server/node/SessionTernSecure.d.ts +3 -0
  60. package/dist/types/server/node/SessionTernSecure.d.ts.map +1 -0
  61. package/dist/types/server/node/auth.d.ts +23 -0
  62. package/dist/types/server/node/auth.d.ts.map +1 -0
  63. package/dist/types/server/node/index.d.ts +3 -0
  64. package/dist/types/server/node/index.d.ts.map +1 -0
  65. package/dist/types/server/node/node-session.d.ts +4 -0
  66. package/dist/types/server/node/node-session.d.ts.map +1 -0
  67. package/dist/types/server/node/ternSecureNodeMiddleware.d.ts +54 -0
  68. package/dist/types/server/node/ternSecureNodeMiddleware.d.ts.map +1 -0
  69. package/dist/types/server/protect.d.ts +26 -0
  70. package/dist/types/server/protect.d.ts.map +1 -0
  71. package/dist/types/server/redirect.d.ts +20 -0
  72. package/dist/types/server/redirect.d.ts.map +1 -0
  73. package/dist/types/server/routeMatcher.d.ts +13 -0
  74. package/dist/types/server/routeMatcher.d.ts.map +1 -0
  75. package/dist/types/server/sdk-versions.d.ts +8 -0
  76. package/dist/types/server/sdk-versions.d.ts.map +1 -0
  77. package/dist/types/server/session-store.d.ts +30 -0
  78. package/dist/types/server/session-store.d.ts.map +1 -0
  79. package/dist/types/server/ternSecureEdgeMiddleware.d.ts +47 -0
  80. package/dist/types/server/ternSecureEdgeMiddleware.d.ts.map +1 -0
  81. package/dist/types/server/ternSecureFireMiddleware.d.ts +47 -0
  82. package/dist/types/server/ternSecureFireMiddleware.d.ts.map +1 -0
  83. package/dist/types/server/types.d.ts +40 -0
  84. package/dist/types/server/types.d.ts.map +1 -0
  85. package/dist/types/server/utils.d.ts +29 -0
  86. package/dist/types/server/utils.d.ts.map +1 -0
  87. package/dist/types/types.d.ts +144 -0
  88. package/dist/types/types.d.ts.map +1 -0
  89. package/dist/types/utils/NextCookieAdapter.d.ts +9 -0
  90. package/dist/types/utils/NextCookieAdapter.d.ts.map +1 -0
  91. package/dist/types/utils/admin-init.d.ts +2 -0
  92. package/dist/types/utils/admin-init.d.ts.map +1 -0
  93. package/dist/types/utils/allNextProviderProps.d.ts +6 -0
  94. package/dist/types/utils/allNextProviderProps.d.ts.map +1 -0
  95. package/dist/types/utils/client-init.d.ts +2 -0
  96. package/dist/types/utils/client-init.d.ts.map +1 -0
  97. package/dist/types/utils/config.d.ts +51 -0
  98. package/dist/types/utils/config.d.ts.map +1 -0
  99. package/dist/types/utils/construct.d.ts +38 -0
  100. package/dist/types/utils/construct.d.ts.map +1 -0
  101. package/dist/types/utils/create-styles.d.ts +99 -0
  102. package/dist/types/utils/create-styles.d.ts.map +1 -0
  103. package/dist/types/utils/fireconfig.d.ts +4 -0
  104. package/dist/types/utils/fireconfig.d.ts.map +1 -0
  105. package/dist/types/utils/logger.d.ts +27 -0
  106. package/dist/types/utils/logger.d.ts.map +1 -0
  107. package/dist/types/utils/redirect.d.ts +9 -0
  108. package/dist/types/utils/redirect.d.ts.map +1 -0
  109. package/dist/types/utils/redis.d.ts +8 -0
  110. package/dist/types/utils/redis.d.ts.map +1 -0
  111. package/dist/types/utils/response.d.ts +3 -0
  112. package/dist/types/utils/response.d.ts.map +1 -0
  113. package/dist/types/utils/serverRedirectAuth.d.ts +6 -0
  114. package/dist/types/utils/serverRedirectAuth.d.ts.map +1 -0
  115. package/dist/types/utils/ternsecure-sw.d.ts +8 -0
  116. package/dist/types/utils/ternsecure-sw.d.ts.map +1 -0
  117. package/dist/types/utils/withLogger.d.ts +17 -0
  118. package/dist/types/utils/withLogger.d.ts.map +1 -0
  119. package/package.json +5 -5
@@ -0,0 +1,144 @@
1
+ import type { TernSecureProviderProps } from '@tern-secure/react';
2
+ import type { ERRORS } from './errors';
3
+ /**
4
+ * TernSecure User
5
+ */
6
+ export type TernSecureUserData = {
7
+ uid: string;
8
+ email: string | null;
9
+ emailVerified?: boolean;
10
+ displayName?: string | null;
11
+ };
12
+ /**
13
+ * TernSecure Firebase configuration interface
14
+ * Extends Firebase's base configuration options
15
+ */
16
+ /**
17
+ * TernSecure initialization options
18
+ */
19
+ export interface TernSecureOptions {
20
+ /** Environment setting for different configurations */
21
+ environment?: 'development' | 'production';
22
+ /** Geographic region for data storage */
23
+ region?: string;
24
+ /** Custom error handler */
25
+ onError?: (error: Error) => void;
26
+ /** Debug mode flag */
27
+ debug?: boolean;
28
+ }
29
+ /**
30
+ * Firebase initialization state
31
+ */
32
+ export interface FirebaseState {
33
+ /** Whether Firebase has been initialized */
34
+ initialized: boolean;
35
+ /** Any initialization errors */
36
+ error: Error | null;
37
+ /** Timestamp of last initialization attempt */
38
+ lastInitAttempt?: number;
39
+ }
40
+ /**
41
+ * Configuration validation result
42
+ */
43
+ export interface ConfigValidationResult {
44
+ isValid: boolean;
45
+ errors: string[];
46
+ }
47
+ /**
48
+ * Firebase Admin configuration interface
49
+ */
50
+ export interface TernSecureAdminConfig {
51
+ projectId: string;
52
+ clientEmail: string;
53
+ privateKey: string;
54
+ }
55
+ /**
56
+ * Firebase Admin configuration validation result
57
+ */
58
+ export interface AdminConfigValidationResult {
59
+ isValid: boolean;
60
+ errors: string[];
61
+ config: TernSecureAdminConfig;
62
+ }
63
+ export interface SignInResponse {
64
+ success: boolean;
65
+ message?: string;
66
+ error?: keyof typeof ERRORS | undefined;
67
+ user?: any;
68
+ }
69
+ export interface AuthError extends Error {
70
+ code?: string;
71
+ message: string;
72
+ response?: SignInResponse;
73
+ }
74
+ export declare function isSignInResponse(value: any): value is SignInResponse;
75
+ export interface TernSecureState {
76
+ userId: string | null;
77
+ isLoaded: boolean;
78
+ error: Error | null;
79
+ isValid: boolean;
80
+ isVerified: boolean;
81
+ isAuthenticated: boolean;
82
+ token: any | null;
83
+ email: string | null;
84
+ status: "loading" | "authenticated" | "unauthenticated" | "unverified";
85
+ requiresVerification: boolean;
86
+ }
87
+ export interface RedirectConfig {
88
+ redirectUrl?: string;
89
+ isReturn?: boolean;
90
+ priority?: number;
91
+ }
92
+ export interface SignInProps extends RedirectConfig {
93
+ onError?: (error: Error) => void;
94
+ onSuccess?: () => void;
95
+ className?: string;
96
+ customStyles?: {
97
+ card?: string;
98
+ input?: string;
99
+ button?: string;
100
+ label?: string;
101
+ separator?: string;
102
+ title?: string;
103
+ description?: string;
104
+ socialButton?: string;
105
+ };
106
+ }
107
+ export type TernSecureNextProps = TernSecureProviderProps & {
108
+ apiKey?: string;
109
+ requiresVerification?: boolean;
110
+ loadingComponent?: React.ReactNode;
111
+ };
112
+ export interface User {
113
+ uid: string;
114
+ email: string | null;
115
+ emailVerified?: boolean;
116
+ authTime?: number;
117
+ disabled?: boolean;
118
+ }
119
+ export interface BaseUser {
120
+ uid: string;
121
+ email: string | null;
122
+ emailVerified?: boolean;
123
+ tenantId: string | null;
124
+ authTime?: number;
125
+ }
126
+ export interface UserInfo {
127
+ uid: string;
128
+ email: string | null;
129
+ emailVerified?: boolean;
130
+ authTime?: number;
131
+ disabled?: boolean;
132
+ }
133
+ export interface SessionUser {
134
+ uid: string;
135
+ email: string | null;
136
+ emailVerified: boolean;
137
+ disabled?: boolean;
138
+ }
139
+ export interface SessionResult {
140
+ isAuthenticated: boolean;
141
+ user: UserInfo | null;
142
+ error?: string;
143
+ }
144
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAGtC;;GAEG;AAGH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAGD;;;GAGG;AAWH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uDAAuD;IACvD,WAAW,CAAC,EAAE,aAAa,GAAG,YAAY,CAAA;IAC1C,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2BAA2B;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;IAChC,sBAAsB;IACtB,KAAK,CAAC,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,4CAA4C;IAC5C,WAAW,EAAE,OAAO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AM,GAAG,IAAI,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAIC,MAAM,WAAW,QAAQ;IACvB,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,aAAa,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,OAAO,CAAA;IACxB,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf"}
@@ -0,0 +1,9 @@
1
+ import type { CookieOptions, CookieStore } from '@tern-secure/types';
2
+ export declare class NextCookieStore implements CookieStore {
3
+ get(name: string): Promise<{
4
+ value: string | undefined;
5
+ }>;
6
+ set(name: string, value: string, options: CookieOptions): Promise<void>;
7
+ delete(name: string): Promise<void>;
8
+ }
9
+ //# sourceMappingURL=NextCookieAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NextCookieAdapter.d.ts","sourceRoot":"","sources":["../../../src/utils/NextCookieAdapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAC,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAGpE,qBAAa,eAAgB,YAAW,WAAW;IAC3C,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC;IAMzD,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAKvE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAI1C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=admin-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"admin-init.d.ts","sourceRoot":"","sources":["../../../src/utils/admin-init.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ import type { TernSecureProviderProps } from "@tern-secure/react";
2
+ import type { TernSecureNextProps } from "../types";
3
+ type NextProviderProcessedProps = Omit<TernSecureProviderProps, 'children'>;
4
+ export declare const allNextProviderPropsWithEnv: (nextProps: Omit<TernSecureNextProps, "children">) => NextProviderProcessedProps;
5
+ export {};
6
+ //# sourceMappingURL=allNextProviderProps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allNextProviderProps.d.ts","sourceRoot":"","sources":["../../../src/utils/allNextProviderProps.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAGpD,KAAK,0BAA0B,GAAG,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,CAAC;AAE5E,eAAO,MAAM,2BAA2B,GACtC,WAAW,IAAI,CAAC,mBAAmB,EAAE,UAAU,CAAC,KAC/C,0BAkFF,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client-init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-init.d.ts","sourceRoot":"","sources":["../../../src/utils/client-init.ts"],"names":[],"mappings":""}
@@ -0,0 +1,51 @@
1
+ import type { AdminConfigValidationResult, ConfigValidationResult, ServerConfigValidationResult, TernSecureAdminConfig, TernSecureConfig, TernSecureServerConfig } from '@tern-secure/types';
2
+ /**
3
+ * Loads Firebase configuration from environment variables
4
+ * @returns {TernSecureConfig} Firebase configuration object
5
+ */
6
+ export declare const loadFireConfig: () => TernSecureConfig;
7
+ /**
8
+ * Validates Firebase configuration
9
+ * @param {TernSecureConfig} config - Firebase configuration object
10
+ * @throws {Error} If required configuration values are missing
11
+ * @returns {TernSecureConfig} Validated configuration object
12
+ */
13
+ export declare const validateConfig: (config: TernSecureConfig) => ConfigValidationResult;
14
+ /**
15
+ * Initializes configuration with validation
16
+ * @throws {Error} If configuration is invalid
17
+ */
18
+ export declare const initializeConfig: () => TernSecureConfig;
19
+ /**
20
+ * Loads Firebase Admin configuration from environment variables
21
+ * @returns {AdminConfig} Firebase Admin configuration object
22
+ */
23
+ export declare const loadAdminConfig: () => TernSecureAdminConfig;
24
+ /**
25
+ * Validates Firebase Admin configuration
26
+ * @param {AdminConfig} config - Firebase Admin configuration object
27
+ * @returns {ConfigValidationResult} Validation result
28
+ */
29
+ export declare const validateAdminConfig: (config: TernSecureAdminConfig) => AdminConfigValidationResult;
30
+ /**
31
+ * Initializes admin configuration with validation
32
+ * @throws {Error} If configuration is invalid
33
+ */
34
+ export declare const initializeAdminConfig: () => TernSecureAdminConfig;
35
+ /**
36
+ * Loads Firebase Server configuration from environment variables
37
+ * @returns {ServerConfig} Firebase Server configuration object
38
+ */
39
+ export declare const loadServerConfig: () => TernSecureServerConfig;
40
+ /**
41
+ * Validates Firebase Admin configuration
42
+ * @param {AdminConfig} config - Firebase Admin configuration object
43
+ * @returns {ConfigValidationResult} Validation result
44
+ */
45
+ export declare const validateServerConfig: (config: TernSecureServerConfig) => ServerConfigValidationResult;
46
+ /**
47
+ * Initializes admin configuration with validation
48
+ * @throws {Error} If configuration is invalid
49
+ */
50
+ export declare const initializeServerConfig: () => TernSecureServerConfig;
51
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/utils/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EAAC,MAAM,oBAAoB,CAAA;AAEnD;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,gBAQhC,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,gBAAgB,KAAG,sBAuBzD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,gBAWnC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,qBAIjC,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,QAAQ,qBAAqB,KAAG,2BAoBnE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,QAAO,qBAWxC,CAAA;AAID;;;GAGG;AACH,eAAO,MAAM,gBAAgB,QAAO,sBAGlC,CAAA;AAGF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,QAAQ,sBAAsB,KAAG,4BAkBrE,CAAA;AAID;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAO,sBAWzC,CAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Constructs a full URL with the current origin
3
+ * @param path - The path to construct the URL for
4
+ * @returns The full URL with origin
5
+ */
6
+ export declare const constructFullUrl: (path: string) => string;
7
+ /**
8
+ * Checks if the current URL has a redirect loop
9
+ * @param currentPath - The current pathname
10
+ * @param redirectPath - The path we're trying to redirect to
11
+ * @returns boolean indicating if there's a redirect loop
12
+ */
13
+ export declare const hasRedirectLoop: (currentPath: string, redirectPath: string) => boolean;
14
+ /**
15
+ * Constructs a URL with redirect parameters while preventing loops
16
+ * @param path - The base path (usually login path)
17
+ * @param redirectUrl - The URL to redirect to after action completes
18
+ * @param loginPath - The login path to check against
19
+ * @param signUpPath - The sign up path to check against
20
+ * @returns The full URL with redirect parameters
21
+ */
22
+ export declare const constructUrlWithRedirect: (path: string, redirectUrl: string | undefined) => string;
23
+ /**
24
+ * Stores the current path before signing out
25
+ */
26
+ export declare const storePreviousPath: (path: string) => void;
27
+ /**
28
+ * Gets the stored previous path
29
+ */
30
+ export declare const getPreviousPath: () => string | null;
31
+ /**
32
+ * Gets a validated redirect URL ensuring it's from the same origin
33
+ * @param redirectUrl - The URL to validate
34
+ * @param searchParams - The search parameters to check for redirect
35
+ * @returns A validated redirect URL
36
+ */
37
+ export declare const getValidRedirectUrl: (searchParams: URLSearchParams, configuredRedirect?: string) => string;
38
+ //# sourceMappingURL=construct.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"construct.d.ts","sourceRoot":"","sources":["../../../src/utils/construct.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,WAO1C,CAAA;AAGH;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,aAAa,MAAM,EAAE,cAAc,MAAM,KAAG,OAQ3E,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,GACnC,MAAM,MAAM,EACZ,aAAa,MAAM,GAAG,SAAS,KAC9B,MAQF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAAI,MAAM,MAAM,KAAG,IAIhD,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,QAAO,MAAM,GAAG,IAK3C,CAAA;AAID;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,cAAc,eAAe,EAC7B,qBAAqB,MAAM,KAC1B,MAcF,CAAA"}
@@ -0,0 +1,99 @@
1
+ export declare const defaultClassNames: {
2
+ readonly container: "tern-container";
3
+ readonly header: "tern-header";
4
+ readonly title: "tern-title";
5
+ readonly formWrapper: "tern-formWrapper";
6
+ readonly formContainer: "tern-formContainer";
7
+ readonly form: "tern-form";
8
+ readonly label: "tern-label";
9
+ readonly input: "tern-input";
10
+ readonly button: "tern-button";
11
+ readonly error: "tern-error";
12
+ };
13
+ export declare const styleConfig: {
14
+ readonly container: {
15
+ readonly display: "flex";
16
+ readonly minHeight: "100%";
17
+ readonly flex: "1";
18
+ readonly flexDirection: "column";
19
+ readonly justifyContent: "center";
20
+ readonly padding: "3rem 1.5rem";
21
+ };
22
+ readonly header: {
23
+ readonly margin: "0 auto";
24
+ readonly width: "100%";
25
+ readonly maxWidth: "28rem";
26
+ };
27
+ readonly title: {
28
+ readonly marginTop: "1.5rem";
29
+ readonly textAlign: "center";
30
+ readonly fontSize: "1.875rem";
31
+ readonly fontWeight: "700";
32
+ readonly lineHeight: "2.25rem";
33
+ readonly letterSpacing: "-0.025em";
34
+ readonly color: "var(--tern-text-primary, #111827)";
35
+ };
36
+ readonly formWrapper: {
37
+ readonly marginTop: "2.5rem";
38
+ readonly margin: "0 auto";
39
+ readonly width: "100%";
40
+ readonly maxWidth: "30rem";
41
+ };
42
+ readonly formContainer: {
43
+ readonly padding: "3rem 1.5rem";
44
+ readonly boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1)";
45
+ readonly borderRadius: "0.5rem";
46
+ readonly backgroundColor: "var(--tern-background, white)";
47
+ };
48
+ readonly form: {
49
+ readonly display: "flex";
50
+ readonly flexDirection: "column";
51
+ readonly gap: "1rem";
52
+ };
53
+ readonly label: {
54
+ readonly display: "block";
55
+ readonly fontSize: "0.875rem";
56
+ readonly fontWeight: "500";
57
+ readonly color: "var(--tern-text-secondary, #374151)";
58
+ };
59
+ readonly input: {
60
+ readonly marginTop: "0.25rem";
61
+ readonly display: "block";
62
+ readonly width: "100%";
63
+ readonly padding: "0.5rem 0.75rem";
64
+ readonly borderRadius: "0.375rem";
65
+ readonly border: "1px solid var(--tern-border, #D1D5DB)";
66
+ readonly backgroundColor: "var(--tern-input-background, white)";
67
+ readonly color: "var(--tern-text-primary, #111827)";
68
+ };
69
+ readonly button: {
70
+ readonly display: "flex";
71
+ readonly width: "100%";
72
+ readonly justifyContent: "center";
73
+ readonly padding: "0.5rem 1rem";
74
+ readonly fontSize: "0.875rem";
75
+ readonly fontWeight: "500";
76
+ readonly color: "white";
77
+ readonly backgroundColor: "var(--tern-primary, #2563EB)";
78
+ readonly border: "none";
79
+ readonly borderRadius: "0.375rem";
80
+ readonly cursor: "pointer";
81
+ };
82
+ readonly error: {
83
+ readonly color: "var(--tern-error, #DC2626)";
84
+ readonly fontSize: "0.875rem";
85
+ };
86
+ };
87
+ export declare const styles: {
88
+ readonly container: "tern-container";
89
+ readonly header: "tern-header";
90
+ readonly title: "tern-title";
91
+ readonly formWrapper: "tern-formWrapper";
92
+ readonly formContainer: "tern-formContainer";
93
+ readonly form: "tern-form";
94
+ readonly label: "tern-label";
95
+ readonly input: "tern-input";
96
+ readonly button: "tern-button";
97
+ readonly error: "tern-error";
98
+ };
99
+ //# sourceMappingURL=create-styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-styles.d.ts","sourceRoot":"","sources":["../../../src/utils/create-styles.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB;;;;;;;;;;;CAWpB,CAAA;AAwCV,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyEd,CAAA;AAGV,eAAO,MAAM,MAAM;;;;;;;;;;;CAAgC,CAAA"}
@@ -0,0 +1,4 @@
1
+ export namespace firebaseConfig {
2
+ let apiKey: string | undefined;
3
+ }
4
+ //# sourceMappingURL=fireconfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fireconfig.d.ts","sourceRoot":"","sources":["../../../src/utils/fireconfig.js"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ export declare enum LogLevel {
2
+ ERROR = 0,
3
+ WARN = 1,
4
+ INFO = 2,
5
+ DEBUG = 3
6
+ }
7
+ export interface LoggerOptions {
8
+ enabled: boolean;
9
+ level: LogLevel;
10
+ prefix: string;
11
+ }
12
+ export declare class Logger {
13
+ private options;
14
+ constructor(options?: Partial<LoggerOptions>);
15
+ enable(): void;
16
+ disable(): void;
17
+ setLevel(level: LogLevel): void;
18
+ setPrefix(prefix: string): void;
19
+ private log;
20
+ error(message: string, ...args: any[]): void;
21
+ warn(message: string, ...args: any[]): void;
22
+ info(message: string, ...args: any[]): void;
23
+ debug(message: string, ...args: any[]): void;
24
+ }
25
+ export declare const createLogger: (options?: Partial<LoggerOptions>) => Logger;
26
+ export declare const middlewareLogger: Logger;
27
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;CACV;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED,qBAAa,MAAM;IACjB,OAAO,CAAC,OAAO,CAAe;gBAElB,OAAO,GAAE,OAAO,CAAC,aAAa,CAAM;IAShD,MAAM,IAAI,IAAI;IAId,OAAO,IAAI,IAAI;IAIf,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B,OAAO,CAAC,GAAG;IAwBX,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;IAI3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,IAAI;CAG7C;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,OAAO,CAAC,aAAa,CAAC,KAAG,MAE/D,CAAA;AAED,eAAO,MAAM,gBAAgB,QAAsD,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Validates and sanitizes redirect URLs
3
+ */
4
+ export declare function validateRedirectUrl(url: string | null): Promise<string>;
5
+ /**
6
+ * Gets the current path for redirect purposes
7
+ */
8
+ export declare function getCurrentPath(): Promise<string>;
9
+ //# sourceMappingURL=redirect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../../src/utils/redirect.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB7E;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC,CAQtD"}
@@ -0,0 +1,8 @@
1
+ import { Redis } from "@upstash/redis";
2
+ export declare const redis: Redis;
3
+ export interface DisabledUserRecord {
4
+ uid: string;
5
+ email: string;
6
+ disabledTime: string;
7
+ }
8
+ //# sourceMappingURL=redis.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../../src/utils/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAEtC,eAAO,MAAM,KAAK,OAGhB,CAAA;AAEF,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,YAAY,EAAE,MAAM,CAAA;CACrB"}
@@ -0,0 +1,3 @@
1
+ export declare const isRedirect: (res: Response) => string | null;
2
+ export declare const setHeader: <T extends Response>(res: T, name: string, val: string) => T;
3
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../../../src/utils/response.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,UAAU,GAAI,KAAK,QAAQ,kBAEvC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,QAAQ,EAAE,KAAK,CAAC,EAAE,MAAM,MAAM,EAAE,KAAK,MAAM,KAAG,CAGjF,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { TernSecureRequest } from "@tern-secure/backend";
2
+ /**
3
+ * Grabs the dev browser JWT from cookies and appends it to the redirect URL when redirecting to cross-origin.
4
+ */
5
+ export declare const serverRedirectWithAuth: (ternSecureRequest: TernSecureRequest, res: Response) => Response;
6
+ //# sourceMappingURL=serverRedirectAuth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serverRedirectAuth.d.ts","sourceRoot":"","sources":["../../../src/utils/serverRedirectAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAM9B;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,mBAAmB,iBAAiB,EAAE,KAAK,QAAQ,aAczF,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { TernSecureConfig } from '@tern-secure/types';
2
+ interface TernUIServiceWorkerProps {
3
+ ternSecureConfig?: TernSecureConfig;
4
+ baseUrl?: string;
5
+ }
6
+ export declare const TernUIServiceWorker: React.FC<TernUIServiceWorkerProps>;
7
+ export {};
8
+ //# sourceMappingURL=ternsecure-sw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ternsecure-sw.d.ts","sourceRoot":"","sources":["../../../src/utils/ternsecure-sw.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAG3D,UAAU,wBAAwB;IAC9B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAyBlE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { NextMiddleware } from "next/server";
2
+ import { LogLevel } from "./logger";
3
+ export interface WithLoggerOptions {
4
+ debug?: boolean;
5
+ logLevel?: LogLevel;
6
+ }
7
+ export declare function createEdgeCompatibleLogger(debug?: boolean): {
8
+ logStart: (requestId: string, method: string, url: string) => void;
9
+ logEnd: (requestId: string, duration: number) => void;
10
+ logError: (requestId: string, duration: number, error: unknown) => void;
11
+ debug: (message: string, ...args: any[]) => void;
12
+ info: (message: string, ...args: any[]) => void;
13
+ warn: (message: string, ...args: any[]) => void;
14
+ error: (message: string, ...args: any[]) => void;
15
+ };
16
+ export declare const withLogger: (middleware: NextMiddleware, options?: WithLoggerOptions) => NextMiddleware;
17
+ //# sourceMappingURL=withLogger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withLogger.d.ts","sourceRoot":"","sources":["../../../src/utils/withLogger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAmB,MAAM,UAAU,CAAA;AAEpD,MAAM,WAAW,iBAAiB;IAChC,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED,wBAAgB,0BAA0B,CAAC,KAAK,GAAE,OAAe;0BAOvC,MAAM,UAAU,MAAM,OAAO,MAAM;wBAGrC,MAAM,YAAY,MAAM;0BAGtB,MAAM,YAAY,MAAM,SAAS,OAAO;qBAM7C,MAAM,WAAW,GAAG,EAAE;oBACvB,MAAM,WAAW,GAAG,EAAE;oBACtB,MAAM,WAAW,GAAG,EAAE;qBACrB,MAAM,WAAW,GAAG,EAAE;EAE1C;AAED,eAAO,MAAM,UAAU,GACrB,YAAY,cAAc,EAC1B,UAAS,iBAAsB,KAC9B,cAkCF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tern-secure/nextjs",
3
- "version": "5.1.10",
3
+ "version": "5.1.11",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -63,10 +63,10 @@
63
63
  "jose": "^5.9.6",
64
64
  "server-only": "^0.0.1",
65
65
  "tslib": "2.4.1",
66
- "@tern-secure/backend": "1.1.8",
67
- "@tern-secure/react": "1.1.7",
68
- "@tern-secure/shared": "1.2.2",
69
- "@tern-secure/types": "1.0.6"
66
+ "@tern-secure/backend": "1.1.9",
67
+ "@tern-secure/react": "1.1.8",
68
+ "@tern-secure/shared": "1.2.3",
69
+ "@tern-secure/types": "1.0.7"
70
70
  },
71
71
  "peerDependencies": {
72
72
  "next": "^13.0.0 || ^14.0.0 || ^15.0.0",