@sparkstudio/authentication-ui 1.0.24 → 1.0.26
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/index.cjs +121 -50
- package/dist/index.d.cts +68 -58
- package/dist/index.d.ts +68 -58
- package/dist/index.js +114 -50
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -20,18 +20,40 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
AppSettings: () => AppSettings,
|
|
24
|
+
Auth: () => Auth,
|
|
25
|
+
AuthResponse: () => AuthResponse,
|
|
23
26
|
AuthenticatorProvider: () => AuthenticatorProvider,
|
|
24
27
|
EMPTY_GUID: () => EMPTY_GUID,
|
|
28
|
+
Home: () => Home,
|
|
25
29
|
LoginButton: () => LoginButton,
|
|
26
30
|
SparkStudioAuthenticationSDK: () => SparkStudioAuthenticationSDK,
|
|
31
|
+
TokenRequest: () => TokenRequest,
|
|
32
|
+
UserDTO: () => UserDTO,
|
|
27
33
|
UserInfoCard: () => UserInfoCard,
|
|
28
34
|
UserProvider: () => UserProvider,
|
|
35
|
+
loadConfig: () => loadConfig,
|
|
29
36
|
useUser: () => useUser
|
|
30
37
|
});
|
|
31
38
|
module.exports = __toCommonJS(index_exports);
|
|
32
39
|
|
|
33
|
-
// src/
|
|
34
|
-
var
|
|
40
|
+
// src/AppSettings.ts
|
|
41
|
+
var AppSettings = {
|
|
42
|
+
AuthenticationUrl: "https://nqf2pnj4zh.execute-api.us-east-2.amazonaws.com/Prod",
|
|
43
|
+
AccountsUrl: "https://qm80qdl3rh.execute-api.us-east-2.amazonaws.com/Prod",
|
|
44
|
+
Version: "1.0.0",
|
|
45
|
+
GoogleClientId: "317399248822-u2seld36hjot7nf2p24oe3icm01aok51.apps.googleusercontent.com",
|
|
46
|
+
ApplicationName: "Spark Studio Authentication"
|
|
47
|
+
};
|
|
48
|
+
async function loadConfig() {
|
|
49
|
+
const response = await fetch("/appsettings.json");
|
|
50
|
+
const config = await response.json();
|
|
51
|
+
AppSettings.AuthenticationUrl = config.AuthenticationUrl;
|
|
52
|
+
AppSettings.AccountsUrl = config.AccountsUrl;
|
|
53
|
+
AppSettings.Version = config.Version;
|
|
54
|
+
AppSettings.GoogleClientId = config.GoogleClientId;
|
|
55
|
+
AppSettings.ApplicationName = config.ApplicationName;
|
|
56
|
+
}
|
|
35
57
|
|
|
36
58
|
// src/api/Controllers/Auth.ts
|
|
37
59
|
var Auth = class {
|
|
@@ -102,7 +124,45 @@ var SparkStudioAuthenticationSDK = class {
|
|
|
102
124
|
}
|
|
103
125
|
};
|
|
104
126
|
|
|
127
|
+
// src/api/DTOs/AuthResponse.ts
|
|
128
|
+
var AuthResponse = class {
|
|
129
|
+
Token;
|
|
130
|
+
User;
|
|
131
|
+
constructor(init) {
|
|
132
|
+
this.Token = init.Token;
|
|
133
|
+
this.User = init.User;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// src/api/DTOs/TokenRequest.ts
|
|
138
|
+
var TokenRequest = class {
|
|
139
|
+
Token;
|
|
140
|
+
constructor(init) {
|
|
141
|
+
this.Token = init.Token;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// src/api/DTOs/UserDTO.ts
|
|
146
|
+
var UserDTO = class {
|
|
147
|
+
Id;
|
|
148
|
+
Sub;
|
|
149
|
+
Name;
|
|
150
|
+
Email;
|
|
151
|
+
ProfilePicture;
|
|
152
|
+
constructor(init) {
|
|
153
|
+
this.Id = init.Id;
|
|
154
|
+
this.Sub = init.Sub;
|
|
155
|
+
this.Name = init.Name;
|
|
156
|
+
this.Email = init.Email;
|
|
157
|
+
this.ProfilePicture = init.ProfilePicture;
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// src/components/AuthenticatorProvider.tsx
|
|
162
|
+
var import_google = require("@react-oauth/google");
|
|
163
|
+
|
|
105
164
|
// src/context/UserProvider.tsx
|
|
165
|
+
var import_react = require("react");
|
|
106
166
|
var import_accounts_sdk = require("@sparkstudio/accounts-sdk");
|
|
107
167
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
108
168
|
var UserContext = (0, import_react.createContext)(void 0);
|
|
@@ -125,8 +185,11 @@ function UserProvider({
|
|
|
125
185
|
const me = await api.auth.GetCurrentUser();
|
|
126
186
|
if (me) {
|
|
127
187
|
const accountsApi = new import_accounts_sdk.SparkStudioAccountsSDK(accountsUrl);
|
|
128
|
-
const
|
|
129
|
-
|
|
188
|
+
const authResponseDTO = await accountsApi.users.SyncUser();
|
|
189
|
+
localStorage.setItem("auth_token", authResponseDTO?.Token ?? "");
|
|
190
|
+
const user2 = authResponseDTO?.User ?? null;
|
|
191
|
+
setUser(user2);
|
|
192
|
+
onLoginSuccess?.(user2);
|
|
130
193
|
} else {
|
|
131
194
|
throw new Error("Authenticated user in cache does not exist.");
|
|
132
195
|
}
|
|
@@ -183,28 +246,56 @@ function useUser() {
|
|
|
183
246
|
return context;
|
|
184
247
|
}
|
|
185
248
|
|
|
249
|
+
// src/components/AuthenticatorProvider.tsx
|
|
250
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
251
|
+
function AuthenticatorProvider({
|
|
252
|
+
googleClientId,
|
|
253
|
+
authenticationUrl,
|
|
254
|
+
accountsUrl,
|
|
255
|
+
children,
|
|
256
|
+
onLoginSuccess,
|
|
257
|
+
onLoginFailed,
|
|
258
|
+
onLogoutSuccess,
|
|
259
|
+
onLogoutFailed
|
|
260
|
+
}) {
|
|
261
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_google.GoogleOAuthProvider, { clientId: googleClientId, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
262
|
+
UserProvider,
|
|
263
|
+
{
|
|
264
|
+
authenticationUrl,
|
|
265
|
+
accountsUrl,
|
|
266
|
+
onLoginSuccess,
|
|
267
|
+
onLoginFailed,
|
|
268
|
+
onLogoutSuccess,
|
|
269
|
+
onLogoutFailed,
|
|
270
|
+
children
|
|
271
|
+
}
|
|
272
|
+
) });
|
|
273
|
+
}
|
|
274
|
+
|
|
186
275
|
// src/components/Buttons/LoginButton.tsx
|
|
187
276
|
var import_react2 = require("react");
|
|
188
|
-
var
|
|
277
|
+
var import_google2 = require("@react-oauth/google");
|
|
189
278
|
var import_common_ui = require("@sparkstudio/common-ui");
|
|
190
279
|
var import_accounts_sdk2 = require("@sparkstudio/accounts-sdk");
|
|
191
|
-
var
|
|
280
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
192
281
|
function LoginButton({ onLogin, onLoginFailed }) {
|
|
193
282
|
const { setUser, authenticationUrl, accountsUrl } = useUser();
|
|
194
283
|
const [loading, setLoading] = (0, import_react2.useState)(false);
|
|
195
|
-
const login = (0,
|
|
284
|
+
const login = (0, import_google2.useGoogleLogin)({
|
|
196
285
|
flow: "implicit",
|
|
286
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
287
|
onSuccess: async (tokenResponse) => {
|
|
198
288
|
try {
|
|
199
289
|
const api = new SparkStudioAuthenticationSDK(authenticationUrl);
|
|
200
290
|
const authentication = await api.auth.SignIn({
|
|
201
291
|
Token: tokenResponse.access_token
|
|
202
292
|
});
|
|
203
|
-
const user = authentication?.User ?? null;
|
|
204
293
|
localStorage.setItem("auth_token", authentication?.Token ?? "");
|
|
205
294
|
const accountsApi = new import_accounts_sdk2.SparkStudioAccountsSDK(accountsUrl);
|
|
206
|
-
const
|
|
207
|
-
|
|
295
|
+
const authResponseDTO = await accountsApi.users.SyncUser();
|
|
296
|
+
localStorage.setItem("auth_token", authResponseDTO?.Token ?? "");
|
|
297
|
+
const user = authResponseDTO?.User ?? null;
|
|
298
|
+
setUser(user);
|
|
208
299
|
onLogin?.(user);
|
|
209
300
|
} catch (error) {
|
|
210
301
|
console.error("\u{1F534} Login failed (Google or backend SignIn)", error);
|
|
@@ -235,8 +326,8 @@ function LoginButton({ onLogin, onLoginFailed }) {
|
|
|
235
326
|
setLoading(false);
|
|
236
327
|
}
|
|
237
328
|
};
|
|
238
|
-
return /* @__PURE__ */ (0,
|
|
239
|
-
/* @__PURE__ */ (0,
|
|
329
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_common_ui.Button, { onClick: handleClick, disabled: loading, children: loading ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
240
331
|
"span",
|
|
241
332
|
{
|
|
242
333
|
className: "spinner-border spinner-border-sm me-2 async-btn__spinner",
|
|
@@ -245,8 +336,8 @@ function LoginButton({ onLogin, onLoginFailed }) {
|
|
|
245
336
|
}
|
|
246
337
|
),
|
|
247
338
|
"Signing in..."
|
|
248
|
-
] }) : /* @__PURE__ */ (0,
|
|
249
|
-
/* @__PURE__ */ (0,
|
|
339
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
|
|
340
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
250
341
|
"img",
|
|
251
342
|
{
|
|
252
343
|
src: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3c/Google_Favicon_2025.svg/960px-Google_Favicon_2025.svg.png",
|
|
@@ -254,13 +345,13 @@ function LoginButton({ onLogin, onLoginFailed }) {
|
|
|
254
345
|
style: { width: "21px", height: "21px", margin: 0, padding: 0 }
|
|
255
346
|
}
|
|
256
347
|
),
|
|
257
|
-
/* @__PURE__ */ (0,
|
|
348
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "d-none d-sm-inline ms-2", children: "Login" })
|
|
258
349
|
] }) });
|
|
259
350
|
}
|
|
260
351
|
|
|
261
352
|
// src/components/UserInfoCard.tsx
|
|
262
353
|
var import_common_ui2 = require("@sparkstudio/common-ui");
|
|
263
|
-
var
|
|
354
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
264
355
|
function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
265
356
|
const { user, logout } = useUser();
|
|
266
357
|
const handleLogout = async () => {
|
|
@@ -271,14 +362,14 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
271
362
|
console.error("Logout failed", err);
|
|
272
363
|
}
|
|
273
364
|
};
|
|
274
|
-
return /* @__PURE__ */ (0,
|
|
365
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_jsx_runtime4.Fragment, { children: user ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
275
366
|
import_common_ui2.Button,
|
|
276
367
|
{
|
|
277
368
|
loadingText: "Logging out...",
|
|
278
369
|
showSpinner: true,
|
|
279
370
|
onAction: handleLogout,
|
|
280
|
-
renderContent: () => /* @__PURE__ */ (0,
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
371
|
+
renderContent: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
372
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
282
373
|
"img",
|
|
283
374
|
{
|
|
284
375
|
src: user.ProfilePicture,
|
|
@@ -286,10 +377,10 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
286
377
|
style: { width: "21px", height: "21px", margin: 0, padding: 0 }
|
|
287
378
|
}
|
|
288
379
|
),
|
|
289
|
-
/* @__PURE__ */ (0,
|
|
380
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "d-none d-sm-inline ms-2", children: "Logout" })
|
|
290
381
|
] }),
|
|
291
|
-
renderLoading: () => /* @__PURE__ */ (0,
|
|
292
|
-
/* @__PURE__ */ (0,
|
|
382
|
+
renderLoading: () => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
383
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
293
384
|
"span",
|
|
294
385
|
{
|
|
295
386
|
className: "spinner-border spinner-border-sm me-2 async-btn__spinner",
|
|
@@ -300,7 +391,7 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
300
391
|
"Logging out..."
|
|
301
392
|
] })
|
|
302
393
|
}
|
|
303
|
-
) : /* @__PURE__ */ (0,
|
|
394
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
304
395
|
LoginButton,
|
|
305
396
|
{
|
|
306
397
|
onLogin,
|
|
@@ -309,42 +400,22 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
309
400
|
) });
|
|
310
401
|
}
|
|
311
402
|
|
|
312
|
-
// src/components/AuthenticatorProvider.tsx
|
|
313
|
-
var import_google2 = require("@react-oauth/google");
|
|
314
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
315
|
-
function AuthenticatorProvider({
|
|
316
|
-
googleClientId,
|
|
317
|
-
authenticationUrl,
|
|
318
|
-
accountsUrl,
|
|
319
|
-
children,
|
|
320
|
-
onLoginSuccess,
|
|
321
|
-
onLoginFailed,
|
|
322
|
-
onLogoutSuccess,
|
|
323
|
-
onLogoutFailed
|
|
324
|
-
}) {
|
|
325
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_google2.GoogleOAuthProvider, { clientId: googleClientId, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
326
|
-
UserProvider,
|
|
327
|
-
{
|
|
328
|
-
authenticationUrl,
|
|
329
|
-
accountsUrl,
|
|
330
|
-
onLoginSuccess,
|
|
331
|
-
onLoginFailed,
|
|
332
|
-
onLogoutSuccess,
|
|
333
|
-
onLogoutFailed,
|
|
334
|
-
children
|
|
335
|
-
}
|
|
336
|
-
) });
|
|
337
|
-
}
|
|
338
|
-
|
|
339
403
|
// src/types/Guid.ts
|
|
340
404
|
var EMPTY_GUID = "00000000-0000-0000-0000-000000000000";
|
|
341
405
|
// Annotate the CommonJS export names for ESM import in node:
|
|
342
406
|
0 && (module.exports = {
|
|
407
|
+
AppSettings,
|
|
408
|
+
Auth,
|
|
409
|
+
AuthResponse,
|
|
343
410
|
AuthenticatorProvider,
|
|
344
411
|
EMPTY_GUID,
|
|
412
|
+
Home,
|
|
345
413
|
LoginButton,
|
|
346
414
|
SparkStudioAuthenticationSDK,
|
|
415
|
+
TokenRequest,
|
|
416
|
+
UserDTO,
|
|
347
417
|
UserInfoCard,
|
|
348
418
|
UserProvider,
|
|
419
|
+
loadConfig,
|
|
349
420
|
useUser
|
|
350
421
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
interface IAppSettings {
|
|
5
|
+
AuthenticationUrl: string;
|
|
6
|
+
AccountsUrl: string;
|
|
7
|
+
Version: string;
|
|
8
|
+
GoogleClientId: string;
|
|
9
|
+
ApplicationName: string;
|
|
10
|
+
}
|
|
11
|
+
declare const AppSettings: IAppSettings;
|
|
12
|
+
declare function loadConfig(): Promise<void>;
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Represents an Auto-generated model for UserDTO.
|
|
6
16
|
*/
|
|
@@ -21,12 +31,59 @@ declare class UserDTO implements IUserDTO {
|
|
|
21
31
|
constructor(init: UserDTOInit);
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Represents an Auto-generated model for TokenRequest.
|
|
36
|
+
*/
|
|
37
|
+
interface ITokenRequest {
|
|
38
|
+
Token?: string;
|
|
39
|
+
}
|
|
40
|
+
type TokenRequestInit = Partial<ITokenRequest>;
|
|
41
|
+
declare class TokenRequest implements ITokenRequest {
|
|
42
|
+
Token?: string;
|
|
43
|
+
constructor(init: TokenRequestInit);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Represents an Auto-generated model for AuthResponse.
|
|
48
|
+
*/
|
|
49
|
+
interface IAuthResponse {
|
|
50
|
+
Token?: string;
|
|
51
|
+
User: UserDTO;
|
|
52
|
+
}
|
|
53
|
+
type AuthResponseInit = Partial<IAuthResponse> & Pick<IAuthResponse, "User">;
|
|
54
|
+
declare class AuthResponse implements IAuthResponse {
|
|
55
|
+
Token?: string;
|
|
56
|
+
User: UserDTO;
|
|
57
|
+
constructor(init: AuthResponseInit);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Auto-generated client for the Auth controller.
|
|
62
|
+
*/
|
|
63
|
+
declare class Auth {
|
|
64
|
+
private baseUrl;
|
|
65
|
+
constructor(baseUrl: string);
|
|
66
|
+
Logout(): Promise<UserDTO>;
|
|
67
|
+
GetCurrentUser(): Promise<UserDTO>;
|
|
68
|
+
SignIn(tokenRequest: TokenRequest): Promise<AuthResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Auto-generated client for the Home controller.
|
|
73
|
+
*/
|
|
74
|
+
declare class Home {
|
|
75
|
+
private baseUrl;
|
|
76
|
+
constructor(baseUrl: string);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Auto-generated API client.
|
|
81
|
+
*/
|
|
82
|
+
declare class SparkStudioAuthenticationSDK {
|
|
83
|
+
auth: Auth;
|
|
84
|
+
home: Home;
|
|
85
|
+
constructor(baseUrl: string);
|
|
28
86
|
}
|
|
29
|
-
declare function UserInfoCard({ onLogin, onLogout, onLoginFailed }: UserInfoCardProps): react_jsx_runtime.JSX.Element;
|
|
30
87
|
|
|
31
88
|
interface AuthenticatorProviderProps {
|
|
32
89
|
googleClientId: string;
|
|
@@ -44,19 +101,12 @@ interface AuthenticatorProviderProps {
|
|
|
44
101
|
*/
|
|
45
102
|
declare function AuthenticatorProvider({ googleClientId, authenticationUrl, accountsUrl, children, onLoginSuccess, onLoginFailed, onLogoutSuccess, onLogoutFailed, }: AuthenticatorProviderProps): react_jsx_runtime.JSX.Element;
|
|
46
103
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Token?: string;
|
|
52
|
-
User: UserDTO;
|
|
53
|
-
}
|
|
54
|
-
type AuthResponseInit = Partial<IAuthResponse> & Pick<IAuthResponse, "User">;
|
|
55
|
-
declare class AuthResponse implements IAuthResponse {
|
|
56
|
-
Token?: string;
|
|
57
|
-
User: UserDTO;
|
|
58
|
-
constructor(init: AuthResponseInit);
|
|
104
|
+
interface UserInfoCardProps {
|
|
105
|
+
onLogin?: (user: UserDTO) => void;
|
|
106
|
+
onLoginFailed?: (error: unknown) => void;
|
|
107
|
+
onLogout?: () => void;
|
|
59
108
|
}
|
|
109
|
+
declare function UserInfoCard({ onLogin, onLogout, onLoginFailed }: UserInfoCardProps): react_jsx_runtime.JSX.Element;
|
|
60
110
|
|
|
61
111
|
interface LoginButtonProps {
|
|
62
112
|
onLogin?: (user: AuthResponse["User"]) => void;
|
|
@@ -88,44 +138,4 @@ declare function useUser(): UserContextType;
|
|
|
88
138
|
type Guid = string;
|
|
89
139
|
declare const EMPTY_GUID: Guid;
|
|
90
140
|
|
|
91
|
-
|
|
92
|
-
* Represents an Auto-generated model for TokenRequest.
|
|
93
|
-
*/
|
|
94
|
-
interface ITokenRequest {
|
|
95
|
-
Token?: string;
|
|
96
|
-
}
|
|
97
|
-
type TokenRequestInit = Partial<ITokenRequest>;
|
|
98
|
-
declare class TokenRequest implements ITokenRequest {
|
|
99
|
-
Token?: string;
|
|
100
|
-
constructor(init: TokenRequestInit);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Auto-generated client for the Auth controller.
|
|
105
|
-
*/
|
|
106
|
-
declare class Auth {
|
|
107
|
-
private baseUrl;
|
|
108
|
-
constructor(baseUrl: string);
|
|
109
|
-
Logout(): Promise<UserDTO>;
|
|
110
|
-
GetCurrentUser(): Promise<UserDTO>;
|
|
111
|
-
SignIn(tokenRequest: TokenRequest): Promise<AuthResponse>;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Auto-generated client for the Home controller.
|
|
116
|
-
*/
|
|
117
|
-
declare class Home {
|
|
118
|
-
private baseUrl;
|
|
119
|
-
constructor(baseUrl: string);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Auto-generated API client.
|
|
124
|
-
*/
|
|
125
|
-
declare class SparkStudioAuthenticationSDK {
|
|
126
|
-
auth: Auth;
|
|
127
|
-
home: Home;
|
|
128
|
-
constructor(baseUrl: string);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { AuthenticatorProvider, type AuthenticatorProviderProps, EMPTY_GUID, type Guid, LoginButton, SparkStudioAuthenticationSDK, UserInfoCard, UserProvider, useUser };
|
|
141
|
+
export { AppSettings, Auth, AuthResponse, AuthenticatorProvider, type AuthenticatorProviderProps, EMPTY_GUID, type Guid, Home, type IAppSettings, type IAuthResponse, type ITokenRequest, type IUserDTO, LoginButton, SparkStudioAuthenticationSDK, TokenRequest, UserDTO, UserInfoCard, UserProvider, loadConfig, useUser };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
|
|
4
|
+
interface IAppSettings {
|
|
5
|
+
AuthenticationUrl: string;
|
|
6
|
+
AccountsUrl: string;
|
|
7
|
+
Version: string;
|
|
8
|
+
GoogleClientId: string;
|
|
9
|
+
ApplicationName: string;
|
|
10
|
+
}
|
|
11
|
+
declare const AppSettings: IAppSettings;
|
|
12
|
+
declare function loadConfig(): Promise<void>;
|
|
13
|
+
|
|
4
14
|
/**
|
|
5
15
|
* Represents an Auto-generated model for UserDTO.
|
|
6
16
|
*/
|
|
@@ -21,12 +31,59 @@ declare class UserDTO implements IUserDTO {
|
|
|
21
31
|
constructor(init: UserDTOInit);
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Represents an Auto-generated model for TokenRequest.
|
|
36
|
+
*/
|
|
37
|
+
interface ITokenRequest {
|
|
38
|
+
Token?: string;
|
|
39
|
+
}
|
|
40
|
+
type TokenRequestInit = Partial<ITokenRequest>;
|
|
41
|
+
declare class TokenRequest implements ITokenRequest {
|
|
42
|
+
Token?: string;
|
|
43
|
+
constructor(init: TokenRequestInit);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Represents an Auto-generated model for AuthResponse.
|
|
48
|
+
*/
|
|
49
|
+
interface IAuthResponse {
|
|
50
|
+
Token?: string;
|
|
51
|
+
User: UserDTO;
|
|
52
|
+
}
|
|
53
|
+
type AuthResponseInit = Partial<IAuthResponse> & Pick<IAuthResponse, "User">;
|
|
54
|
+
declare class AuthResponse implements IAuthResponse {
|
|
55
|
+
Token?: string;
|
|
56
|
+
User: UserDTO;
|
|
57
|
+
constructor(init: AuthResponseInit);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Auto-generated client for the Auth controller.
|
|
62
|
+
*/
|
|
63
|
+
declare class Auth {
|
|
64
|
+
private baseUrl;
|
|
65
|
+
constructor(baseUrl: string);
|
|
66
|
+
Logout(): Promise<UserDTO>;
|
|
67
|
+
GetCurrentUser(): Promise<UserDTO>;
|
|
68
|
+
SignIn(tokenRequest: TokenRequest): Promise<AuthResponse>;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Auto-generated client for the Home controller.
|
|
73
|
+
*/
|
|
74
|
+
declare class Home {
|
|
75
|
+
private baseUrl;
|
|
76
|
+
constructor(baseUrl: string);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Auto-generated API client.
|
|
81
|
+
*/
|
|
82
|
+
declare class SparkStudioAuthenticationSDK {
|
|
83
|
+
auth: Auth;
|
|
84
|
+
home: Home;
|
|
85
|
+
constructor(baseUrl: string);
|
|
28
86
|
}
|
|
29
|
-
declare function UserInfoCard({ onLogin, onLogout, onLoginFailed }: UserInfoCardProps): react_jsx_runtime.JSX.Element;
|
|
30
87
|
|
|
31
88
|
interface AuthenticatorProviderProps {
|
|
32
89
|
googleClientId: string;
|
|
@@ -44,19 +101,12 @@ interface AuthenticatorProviderProps {
|
|
|
44
101
|
*/
|
|
45
102
|
declare function AuthenticatorProvider({ googleClientId, authenticationUrl, accountsUrl, children, onLoginSuccess, onLoginFailed, onLogoutSuccess, onLogoutFailed, }: AuthenticatorProviderProps): react_jsx_runtime.JSX.Element;
|
|
46
103
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
Token?: string;
|
|
52
|
-
User: UserDTO;
|
|
53
|
-
}
|
|
54
|
-
type AuthResponseInit = Partial<IAuthResponse> & Pick<IAuthResponse, "User">;
|
|
55
|
-
declare class AuthResponse implements IAuthResponse {
|
|
56
|
-
Token?: string;
|
|
57
|
-
User: UserDTO;
|
|
58
|
-
constructor(init: AuthResponseInit);
|
|
104
|
+
interface UserInfoCardProps {
|
|
105
|
+
onLogin?: (user: UserDTO) => void;
|
|
106
|
+
onLoginFailed?: (error: unknown) => void;
|
|
107
|
+
onLogout?: () => void;
|
|
59
108
|
}
|
|
109
|
+
declare function UserInfoCard({ onLogin, onLogout, onLoginFailed }: UserInfoCardProps): react_jsx_runtime.JSX.Element;
|
|
60
110
|
|
|
61
111
|
interface LoginButtonProps {
|
|
62
112
|
onLogin?: (user: AuthResponse["User"]) => void;
|
|
@@ -88,44 +138,4 @@ declare function useUser(): UserContextType;
|
|
|
88
138
|
type Guid = string;
|
|
89
139
|
declare const EMPTY_GUID: Guid;
|
|
90
140
|
|
|
91
|
-
|
|
92
|
-
* Represents an Auto-generated model for TokenRequest.
|
|
93
|
-
*/
|
|
94
|
-
interface ITokenRequest {
|
|
95
|
-
Token?: string;
|
|
96
|
-
}
|
|
97
|
-
type TokenRequestInit = Partial<ITokenRequest>;
|
|
98
|
-
declare class TokenRequest implements ITokenRequest {
|
|
99
|
-
Token?: string;
|
|
100
|
-
constructor(init: TokenRequestInit);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Auto-generated client for the Auth controller.
|
|
105
|
-
*/
|
|
106
|
-
declare class Auth {
|
|
107
|
-
private baseUrl;
|
|
108
|
-
constructor(baseUrl: string);
|
|
109
|
-
Logout(): Promise<UserDTO>;
|
|
110
|
-
GetCurrentUser(): Promise<UserDTO>;
|
|
111
|
-
SignIn(tokenRequest: TokenRequest): Promise<AuthResponse>;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Auto-generated client for the Home controller.
|
|
116
|
-
*/
|
|
117
|
-
declare class Home {
|
|
118
|
-
private baseUrl;
|
|
119
|
-
constructor(baseUrl: string);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Auto-generated API client.
|
|
124
|
-
*/
|
|
125
|
-
declare class SparkStudioAuthenticationSDK {
|
|
126
|
-
auth: Auth;
|
|
127
|
-
home: Home;
|
|
128
|
-
constructor(baseUrl: string);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export { AuthenticatorProvider, type AuthenticatorProviderProps, EMPTY_GUID, type Guid, LoginButton, SparkStudioAuthenticationSDK, UserInfoCard, UserProvider, useUser };
|
|
141
|
+
export { AppSettings, Auth, AuthResponse, AuthenticatorProvider, type AuthenticatorProviderProps, EMPTY_GUID, type Guid, Home, type IAppSettings, type IAuthResponse, type ITokenRequest, type IUserDTO, LoginButton, SparkStudioAuthenticationSDK, TokenRequest, UserDTO, UserInfoCard, UserProvider, loadConfig, useUser };
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
// src/AppSettings.ts
|
|
2
|
+
var AppSettings = {
|
|
3
|
+
AuthenticationUrl: "https://nqf2pnj4zh.execute-api.us-east-2.amazonaws.com/Prod",
|
|
4
|
+
AccountsUrl: "https://qm80qdl3rh.execute-api.us-east-2.amazonaws.com/Prod",
|
|
5
|
+
Version: "1.0.0",
|
|
6
|
+
GoogleClientId: "317399248822-u2seld36hjot7nf2p24oe3icm01aok51.apps.googleusercontent.com",
|
|
7
|
+
ApplicationName: "Spark Studio Authentication"
|
|
8
|
+
};
|
|
9
|
+
async function loadConfig() {
|
|
10
|
+
const response = await fetch("/appsettings.json");
|
|
11
|
+
const config = await response.json();
|
|
12
|
+
AppSettings.AuthenticationUrl = config.AuthenticationUrl;
|
|
13
|
+
AppSettings.AccountsUrl = config.AccountsUrl;
|
|
14
|
+
AppSettings.Version = config.Version;
|
|
15
|
+
AppSettings.GoogleClientId = config.GoogleClientId;
|
|
16
|
+
AppSettings.ApplicationName = config.ApplicationName;
|
|
17
|
+
}
|
|
8
18
|
|
|
9
19
|
// src/api/Controllers/Auth.ts
|
|
10
20
|
var Auth = class {
|
|
@@ -75,7 +85,50 @@ var SparkStudioAuthenticationSDK = class {
|
|
|
75
85
|
}
|
|
76
86
|
};
|
|
77
87
|
|
|
88
|
+
// src/api/DTOs/AuthResponse.ts
|
|
89
|
+
var AuthResponse = class {
|
|
90
|
+
Token;
|
|
91
|
+
User;
|
|
92
|
+
constructor(init) {
|
|
93
|
+
this.Token = init.Token;
|
|
94
|
+
this.User = init.User;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// src/api/DTOs/TokenRequest.ts
|
|
99
|
+
var TokenRequest = class {
|
|
100
|
+
Token;
|
|
101
|
+
constructor(init) {
|
|
102
|
+
this.Token = init.Token;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// src/api/DTOs/UserDTO.ts
|
|
107
|
+
var UserDTO = class {
|
|
108
|
+
Id;
|
|
109
|
+
Sub;
|
|
110
|
+
Name;
|
|
111
|
+
Email;
|
|
112
|
+
ProfilePicture;
|
|
113
|
+
constructor(init) {
|
|
114
|
+
this.Id = init.Id;
|
|
115
|
+
this.Sub = init.Sub;
|
|
116
|
+
this.Name = init.Name;
|
|
117
|
+
this.Email = init.Email;
|
|
118
|
+
this.ProfilePicture = init.ProfilePicture;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
// src/components/AuthenticatorProvider.tsx
|
|
123
|
+
import { GoogleOAuthProvider } from "@react-oauth/google";
|
|
124
|
+
|
|
78
125
|
// src/context/UserProvider.tsx
|
|
126
|
+
import {
|
|
127
|
+
createContext,
|
|
128
|
+
useContext,
|
|
129
|
+
useState,
|
|
130
|
+
useEffect
|
|
131
|
+
} from "react";
|
|
79
132
|
import { SparkStudioAccountsSDK } from "@sparkstudio/accounts-sdk";
|
|
80
133
|
import { jsx } from "react/jsx-runtime";
|
|
81
134
|
var UserContext = createContext(void 0);
|
|
@@ -98,8 +151,11 @@ function UserProvider({
|
|
|
98
151
|
const me = await api.auth.GetCurrentUser();
|
|
99
152
|
if (me) {
|
|
100
153
|
const accountsApi = new SparkStudioAccountsSDK(accountsUrl);
|
|
101
|
-
const
|
|
102
|
-
|
|
154
|
+
const authResponseDTO = await accountsApi.users.SyncUser();
|
|
155
|
+
localStorage.setItem("auth_token", authResponseDTO?.Token ?? "");
|
|
156
|
+
const user2 = authResponseDTO?.User ?? null;
|
|
157
|
+
setUser(user2);
|
|
158
|
+
onLoginSuccess?.(user2);
|
|
103
159
|
} else {
|
|
104
160
|
throw new Error("Authenticated user in cache does not exist.");
|
|
105
161
|
}
|
|
@@ -156,28 +212,56 @@ function useUser() {
|
|
|
156
212
|
return context;
|
|
157
213
|
}
|
|
158
214
|
|
|
215
|
+
// src/components/AuthenticatorProvider.tsx
|
|
216
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
217
|
+
function AuthenticatorProvider({
|
|
218
|
+
googleClientId,
|
|
219
|
+
authenticationUrl,
|
|
220
|
+
accountsUrl,
|
|
221
|
+
children,
|
|
222
|
+
onLoginSuccess,
|
|
223
|
+
onLoginFailed,
|
|
224
|
+
onLogoutSuccess,
|
|
225
|
+
onLogoutFailed
|
|
226
|
+
}) {
|
|
227
|
+
return /* @__PURE__ */ jsx2(GoogleOAuthProvider, { clientId: googleClientId, children: /* @__PURE__ */ jsx2(
|
|
228
|
+
UserProvider,
|
|
229
|
+
{
|
|
230
|
+
authenticationUrl,
|
|
231
|
+
accountsUrl,
|
|
232
|
+
onLoginSuccess,
|
|
233
|
+
onLoginFailed,
|
|
234
|
+
onLogoutSuccess,
|
|
235
|
+
onLogoutFailed,
|
|
236
|
+
children
|
|
237
|
+
}
|
|
238
|
+
) });
|
|
239
|
+
}
|
|
240
|
+
|
|
159
241
|
// src/components/Buttons/LoginButton.tsx
|
|
160
242
|
import { useState as useState2 } from "react";
|
|
161
243
|
import { useGoogleLogin } from "@react-oauth/google";
|
|
162
244
|
import { Button } from "@sparkstudio/common-ui";
|
|
163
245
|
import { SparkStudioAccountsSDK as SparkStudioAccountsSDK2 } from "@sparkstudio/accounts-sdk";
|
|
164
|
-
import { Fragment, jsx as
|
|
246
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
165
247
|
function LoginButton({ onLogin, onLoginFailed }) {
|
|
166
248
|
const { setUser, authenticationUrl, accountsUrl } = useUser();
|
|
167
249
|
const [loading, setLoading] = useState2(false);
|
|
168
250
|
const login = useGoogleLogin({
|
|
169
251
|
flow: "implicit",
|
|
252
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
170
253
|
onSuccess: async (tokenResponse) => {
|
|
171
254
|
try {
|
|
172
255
|
const api = new SparkStudioAuthenticationSDK(authenticationUrl);
|
|
173
256
|
const authentication = await api.auth.SignIn({
|
|
174
257
|
Token: tokenResponse.access_token
|
|
175
258
|
});
|
|
176
|
-
const user = authentication?.User ?? null;
|
|
177
259
|
localStorage.setItem("auth_token", authentication?.Token ?? "");
|
|
178
260
|
const accountsApi = new SparkStudioAccountsSDK2(accountsUrl);
|
|
179
|
-
const
|
|
180
|
-
|
|
261
|
+
const authResponseDTO = await accountsApi.users.SyncUser();
|
|
262
|
+
localStorage.setItem("auth_token", authResponseDTO?.Token ?? "");
|
|
263
|
+
const user = authResponseDTO?.User ?? null;
|
|
264
|
+
setUser(user);
|
|
181
265
|
onLogin?.(user);
|
|
182
266
|
} catch (error) {
|
|
183
267
|
console.error("\u{1F534} Login failed (Google or backend SignIn)", error);
|
|
@@ -208,8 +292,8 @@ function LoginButton({ onLogin, onLoginFailed }) {
|
|
|
208
292
|
setLoading(false);
|
|
209
293
|
}
|
|
210
294
|
};
|
|
211
|
-
return /* @__PURE__ */
|
|
212
|
-
/* @__PURE__ */
|
|
295
|
+
return /* @__PURE__ */ jsx3(Button, { onClick: handleClick, disabled: loading, children: loading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
296
|
+
/* @__PURE__ */ jsx3(
|
|
213
297
|
"span",
|
|
214
298
|
{
|
|
215
299
|
className: "spinner-border spinner-border-sm me-2 async-btn__spinner",
|
|
@@ -219,7 +303,7 @@ function LoginButton({ onLogin, onLoginFailed }) {
|
|
|
219
303
|
),
|
|
220
304
|
"Signing in..."
|
|
221
305
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
222
|
-
/* @__PURE__ */
|
|
306
|
+
/* @__PURE__ */ jsx3(
|
|
223
307
|
"img",
|
|
224
308
|
{
|
|
225
309
|
src: "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3c/Google_Favicon_2025.svg/960px-Google_Favicon_2025.svg.png",
|
|
@@ -227,13 +311,13 @@ function LoginButton({ onLogin, onLoginFailed }) {
|
|
|
227
311
|
style: { width: "21px", height: "21px", margin: 0, padding: 0 }
|
|
228
312
|
}
|
|
229
313
|
),
|
|
230
|
-
/* @__PURE__ */
|
|
314
|
+
/* @__PURE__ */ jsx3("span", { className: "d-none d-sm-inline ms-2", children: "Login" })
|
|
231
315
|
] }) });
|
|
232
316
|
}
|
|
233
317
|
|
|
234
318
|
// src/components/UserInfoCard.tsx
|
|
235
319
|
import { Button as Button2 } from "@sparkstudio/common-ui";
|
|
236
|
-
import { Fragment as Fragment2, jsx as
|
|
320
|
+
import { Fragment as Fragment2, jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
237
321
|
function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
238
322
|
const { user, logout } = useUser();
|
|
239
323
|
const handleLogout = async () => {
|
|
@@ -244,14 +328,14 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
244
328
|
console.error("Logout failed", err);
|
|
245
329
|
}
|
|
246
330
|
};
|
|
247
|
-
return /* @__PURE__ */
|
|
331
|
+
return /* @__PURE__ */ jsx4(Fragment2, { children: user ? /* @__PURE__ */ jsx4(
|
|
248
332
|
Button2,
|
|
249
333
|
{
|
|
250
334
|
loadingText: "Logging out...",
|
|
251
335
|
showSpinner: true,
|
|
252
336
|
onAction: handleLogout,
|
|
253
337
|
renderContent: () => /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
254
|
-
/* @__PURE__ */
|
|
338
|
+
/* @__PURE__ */ jsx4(
|
|
255
339
|
"img",
|
|
256
340
|
{
|
|
257
341
|
src: user.ProfilePicture,
|
|
@@ -259,10 +343,10 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
259
343
|
style: { width: "21px", height: "21px", margin: 0, padding: 0 }
|
|
260
344
|
}
|
|
261
345
|
),
|
|
262
|
-
/* @__PURE__ */
|
|
346
|
+
/* @__PURE__ */ jsx4("span", { className: "d-none d-sm-inline ms-2", children: "Logout" })
|
|
263
347
|
] }),
|
|
264
348
|
renderLoading: () => /* @__PURE__ */ jsxs2(Fragment2, { children: [
|
|
265
|
-
/* @__PURE__ */
|
|
349
|
+
/* @__PURE__ */ jsx4(
|
|
266
350
|
"span",
|
|
267
351
|
{
|
|
268
352
|
className: "spinner-border spinner-border-sm me-2 async-btn__spinner",
|
|
@@ -273,7 +357,7 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
273
357
|
"Logging out..."
|
|
274
358
|
] })
|
|
275
359
|
}
|
|
276
|
-
) : /* @__PURE__ */
|
|
360
|
+
) : /* @__PURE__ */ jsx4(
|
|
277
361
|
LoginButton,
|
|
278
362
|
{
|
|
279
363
|
onLogin,
|
|
@@ -282,41 +366,21 @@ function UserInfoCard({ onLogin, onLogout, onLoginFailed }) {
|
|
|
282
366
|
) });
|
|
283
367
|
}
|
|
284
368
|
|
|
285
|
-
// src/components/AuthenticatorProvider.tsx
|
|
286
|
-
import { GoogleOAuthProvider } from "@react-oauth/google";
|
|
287
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
288
|
-
function AuthenticatorProvider({
|
|
289
|
-
googleClientId,
|
|
290
|
-
authenticationUrl,
|
|
291
|
-
accountsUrl,
|
|
292
|
-
children,
|
|
293
|
-
onLoginSuccess,
|
|
294
|
-
onLoginFailed,
|
|
295
|
-
onLogoutSuccess,
|
|
296
|
-
onLogoutFailed
|
|
297
|
-
}) {
|
|
298
|
-
return /* @__PURE__ */ jsx4(GoogleOAuthProvider, { clientId: googleClientId, children: /* @__PURE__ */ jsx4(
|
|
299
|
-
UserProvider,
|
|
300
|
-
{
|
|
301
|
-
authenticationUrl,
|
|
302
|
-
accountsUrl,
|
|
303
|
-
onLoginSuccess,
|
|
304
|
-
onLoginFailed,
|
|
305
|
-
onLogoutSuccess,
|
|
306
|
-
onLogoutFailed,
|
|
307
|
-
children
|
|
308
|
-
}
|
|
309
|
-
) });
|
|
310
|
-
}
|
|
311
|
-
|
|
312
369
|
// src/types/Guid.ts
|
|
313
370
|
var EMPTY_GUID = "00000000-0000-0000-0000-000000000000";
|
|
314
371
|
export {
|
|
372
|
+
AppSettings,
|
|
373
|
+
Auth,
|
|
374
|
+
AuthResponse,
|
|
315
375
|
AuthenticatorProvider,
|
|
316
376
|
EMPTY_GUID,
|
|
377
|
+
Home,
|
|
317
378
|
LoginButton,
|
|
318
379
|
SparkStudioAuthenticationSDK,
|
|
380
|
+
TokenRequest,
|
|
381
|
+
UserDTO,
|
|
319
382
|
UserInfoCard,
|
|
320
383
|
UserProvider,
|
|
384
|
+
loadConfig,
|
|
321
385
|
useUser
|
|
322
386
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sparkstudio/authentication-ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"scripts": {
|
|
26
26
|
"dev": "vite",
|
|
27
|
-
"
|
|
27
|
+
"generateIndex": "barrelsby --delete --directory src --location top --exclude react-env.d.ts --exclude main.tsx --exclude App.tsx",
|
|
28
|
+
"build": "npm run generateIndex && tsup src/index.ts --format cjs,esm --dts --tsconfig tsconfig.lib.json && sass --load-path=node_modules src/index.scss dist/index.css",
|
|
28
29
|
"lint": "eslint .",
|
|
29
30
|
"preview": "vite preview",
|
|
30
31
|
"start": "vite"
|
|
@@ -35,8 +36,8 @@
|
|
|
35
36
|
},
|
|
36
37
|
"dependencies": {
|
|
37
38
|
"@react-oauth/google": "^0.13.4",
|
|
38
|
-
"@sparkstudio/accounts-sdk": "^1.1.
|
|
39
|
-
"@sparkstudio/accounts-ui": "^1.1.
|
|
39
|
+
"@sparkstudio/accounts-sdk": "^1.1.73",
|
|
40
|
+
"@sparkstudio/accounts-ui": "^1.1.73",
|
|
40
41
|
"@sparkstudio/common-ui": "^1.0.5",
|
|
41
42
|
"rimraf": "^6.1.2"
|
|
42
43
|
},
|
|
@@ -46,6 +47,7 @@
|
|
|
46
47
|
"@types/react": "^19.1.16",
|
|
47
48
|
"@types/react-dom": "^19.1.9",
|
|
48
49
|
"@vitejs/plugin-react": "^5.0.4",
|
|
50
|
+
"barrelsby": "^2.8.1",
|
|
49
51
|
"eslint": "^9.36.0",
|
|
50
52
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
51
53
|
"eslint-plugin-react-refresh": "^0.4.22",
|