@imtbl/auth-nextjs 2.12.4-alpha.4 → 2.12.4-alpha.5
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.
|
@@ -23,6 +23,7 @@ var client_exports = {};
|
|
|
23
23
|
__export(client_exports, {
|
|
24
24
|
CallbackPage: () => CallbackPage,
|
|
25
25
|
ImmutableAuthProvider: () => ImmutableAuthProvider,
|
|
26
|
+
MarketingConsentStatus: () => import_auth4.MarketingConsentStatus,
|
|
26
27
|
useAccessToken: () => useAccessToken,
|
|
27
28
|
useImmutableAuth: () => useImmutableAuth
|
|
28
29
|
});
|
|
@@ -176,11 +177,11 @@ function useImmutableAuth() {
|
|
|
176
177
|
email: session.user.email,
|
|
177
178
|
nickname: session.user.nickname
|
|
178
179
|
} : null;
|
|
179
|
-
const handleSignIn = (0, import_react.useCallback)(async () => {
|
|
180
|
+
const handleSignIn = (0, import_react.useCallback)(async (options) => {
|
|
180
181
|
if (!auth) {
|
|
181
182
|
throw new Error("Auth not initialized");
|
|
182
183
|
}
|
|
183
|
-
const authUser = await auth.login();
|
|
184
|
+
const authUser = await auth.login(options);
|
|
184
185
|
if (!authUser) {
|
|
185
186
|
throw new Error("Login failed");
|
|
186
187
|
}
|
|
@@ -366,10 +367,14 @@ function CallbackPage({
|
|
|
366
367
|
}
|
|
367
368
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { style: { padding: "2rem", textAlign: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { children: "Completing authentication..." }) });
|
|
368
369
|
}
|
|
370
|
+
|
|
371
|
+
// src/client/index.ts
|
|
372
|
+
var import_auth4 = require("@imtbl/auth");
|
|
369
373
|
// Annotate the CommonJS export names for ESM import in node:
|
|
370
374
|
0 && (module.exports = {
|
|
371
375
|
CallbackPage,
|
|
372
376
|
ImmutableAuthProvider,
|
|
377
|
+
MarketingConsentStatus,
|
|
373
378
|
useAccessToken,
|
|
374
379
|
useImmutableAuth
|
|
375
380
|
});
|
|
@@ -16,7 +16,9 @@ import {
|
|
|
16
16
|
signIn,
|
|
17
17
|
signOut
|
|
18
18
|
} from "next-auth/react";
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
Auth
|
|
21
|
+
} from "@imtbl/auth";
|
|
20
22
|
|
|
21
23
|
// src/utils/token.ts
|
|
22
24
|
import { decodeJwtPayload } from "@imtbl/auth";
|
|
@@ -161,11 +163,11 @@ function useImmutableAuth() {
|
|
|
161
163
|
email: session.user.email,
|
|
162
164
|
nickname: session.user.nickname
|
|
163
165
|
} : null;
|
|
164
|
-
const handleSignIn = useCallback(async () => {
|
|
166
|
+
const handleSignIn = useCallback(async (options) => {
|
|
165
167
|
if (!auth) {
|
|
166
168
|
throw new Error("Auth not initialized");
|
|
167
169
|
}
|
|
168
|
-
const authUser = await auth.login();
|
|
170
|
+
const authUser = await auth.login(options);
|
|
169
171
|
if (!authUser) {
|
|
170
172
|
throw new Error("Login failed");
|
|
171
173
|
}
|
|
@@ -351,9 +353,13 @@ function CallbackPage({
|
|
|
351
353
|
}
|
|
352
354
|
return /* @__PURE__ */ jsx2("div", { style: { padding: "2rem", textAlign: "center" }, children: /* @__PURE__ */ jsx2("p", { children: "Completing authentication..." }) });
|
|
353
355
|
}
|
|
356
|
+
|
|
357
|
+
// src/client/index.ts
|
|
358
|
+
import { MarketingConsentStatus } from "@imtbl/auth";
|
|
354
359
|
export {
|
|
355
360
|
CallbackPage,
|
|
356
361
|
ImmutableAuthProvider,
|
|
362
|
+
MarketingConsentStatus,
|
|
357
363
|
useAccessToken,
|
|
358
364
|
useImmutableAuth
|
|
359
365
|
};
|
package/dist/node/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
ImmutableAuth: () => ImmutableAuth,
|
|
34
|
+
MarketingConsentStatus: () => import_auth.MarketingConsentStatus,
|
|
34
35
|
isTokenExpired: () => isTokenExpired,
|
|
35
36
|
refreshAccessToken: () => refreshAccessToken
|
|
36
37
|
});
|
|
@@ -245,6 +246,7 @@ function createAuthOptions(config) {
|
|
|
245
246
|
}
|
|
246
247
|
|
|
247
248
|
// src/index.ts
|
|
249
|
+
var import_auth = require("@imtbl/auth");
|
|
248
250
|
var NextAuth = import_next_auth.default.default || import_next_auth.default;
|
|
249
251
|
function ImmutableAuth(config, overrides) {
|
|
250
252
|
const authOptions = createAuthOptions(config);
|
|
@@ -288,6 +290,7 @@ function ImmutableAuth(config, overrides) {
|
|
|
288
290
|
// Annotate the CommonJS export names for ESM import in node:
|
|
289
291
|
0 && (module.exports = {
|
|
290
292
|
ImmutableAuth,
|
|
293
|
+
MarketingConsentStatus,
|
|
291
294
|
isTokenExpired,
|
|
292
295
|
refreshAccessToken
|
|
293
296
|
});
|
package/dist/node/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
|
|
7
7
|
// src/index.ts
|
|
8
8
|
import NextAuthDefault from "next-auth";
|
|
9
|
+
import { MarketingConsentStatus } from "@imtbl/auth";
|
|
9
10
|
var NextAuth = NextAuthDefault.default || NextAuthDefault;
|
|
10
11
|
function ImmutableAuth(config, overrides) {
|
|
11
12
|
const authOptions = createAuthOptions(config);
|
|
@@ -48,6 +49,7 @@ function ImmutableAuth(config, overrides) {
|
|
|
48
49
|
}
|
|
49
50
|
export {
|
|
50
51
|
ImmutableAuth,
|
|
52
|
+
MarketingConsentStatus,
|
|
51
53
|
isTokenExpired,
|
|
52
54
|
refreshAccessToken
|
|
53
55
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
export { ImmutableAuthProvider, useImmutableAuth, useAccessToken, } from './provider';
|
|
2
2
|
export { CallbackPage, type CallbackPageProps } from './callback';
|
|
3
3
|
export type { ImmutableAuthProviderProps, UseImmutableAuthReturn, ImmutableAuthConfig, ImmutableUser, } from '../types';
|
|
4
|
+
export type { LoginOptions, DirectLoginOptions } from '@imtbl/auth';
|
|
5
|
+
export { MarketingConsentStatus } from '@imtbl/auth';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -58,4 +58,6 @@ export type ImmutableAuthOverrides = Omit<NextAuthOptions, 'providers'>;
|
|
|
58
58
|
*/
|
|
59
59
|
export declare function ImmutableAuth(config: ImmutableAuthConfig, overrides?: ImmutableAuthOverrides): any;
|
|
60
60
|
export type { ImmutableAuthConfig, ImmutableTokenData, ImmutableUser, ZkEvmInfo, WithPageAuthRequiredOptions, } from './types';
|
|
61
|
+
export type { LoginOptions, DirectLoginOptions } from '@imtbl/auth';
|
|
62
|
+
export { MarketingConsentStatus } from '@imtbl/auth';
|
|
61
63
|
export { refreshAccessToken, isTokenExpired } from './refresh';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -159,8 +159,9 @@ export interface UseImmutableAuthReturn {
|
|
|
159
159
|
isAuthenticated: boolean;
|
|
160
160
|
/**
|
|
161
161
|
* Sign in with Immutable (opens popup)
|
|
162
|
+
* @param options - Optional login options (cached session, silent login, redirect flow, direct login)
|
|
162
163
|
*/
|
|
163
|
-
signIn: () => Promise<void>;
|
|
164
|
+
signIn: (options?: import('@imtbl/auth').LoginOptions) => Promise<void>;
|
|
164
165
|
/**
|
|
165
166
|
* Sign out from both NextAuth and Immutable
|
|
166
167
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@imtbl/auth-nextjs",
|
|
3
|
-
"version": "2.12.4-alpha.
|
|
3
|
+
"version": "2.12.4-alpha.5",
|
|
4
4
|
"description": "Next.js authentication integration for Immutable SDK using NextAuth",
|
|
5
5
|
"author": "Immutable",
|
|
6
6
|
"bugs": "https://github.com/immutable/ts-immutable-sdk/issues",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dist"
|
|
52
52
|
],
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@imtbl/auth": "2.12.4-alpha.
|
|
54
|
+
"@imtbl/auth": "2.12.4-alpha.5"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"next": "14.2.25",
|