@carlonicora/nextjs-jsonapi 1.31.0 → 1.32.0

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 (52) hide show
  1. package/dist/{BlockNoteEditor-CUIQPN6C.mjs → BlockNoteEditor-TFL6ZXIJ.mjs} +4 -4
  2. package/dist/{BlockNoteEditor-NBASFIQP.js → BlockNoteEditor-YEVSJSOI.js} +14 -14
  3. package/dist/{BlockNoteEditor-NBASFIQP.js.map → BlockNoteEditor-YEVSJSOI.js.map} +1 -1
  4. package/dist/billing/index.js +335 -335
  5. package/dist/billing/index.mjs +3 -3
  6. package/dist/{chunk-ITBPDMUX.js → chunk-HIF7DYR3.js} +537 -482
  7. package/dist/chunk-HIF7DYR3.js.map +1 -0
  8. package/dist/{chunk-C62JXXUX.mjs → chunk-IXVNXOZT.mjs} +8 -1
  9. package/dist/{chunk-C62JXXUX.mjs.map → chunk-IXVNXOZT.mjs.map} +1 -1
  10. package/dist/{chunk-HBCIT6KE.js → chunk-KYG2PIRB.js} +5 -1
  11. package/dist/chunk-KYG2PIRB.js.map +1 -0
  12. package/dist/{chunk-OR5NPUWF.js → chunk-NPNKFWV2.js} +9 -2
  13. package/dist/chunk-NPNKFWV2.js.map +1 -0
  14. package/dist/{chunk-TM4RWVZE.mjs → chunk-SLANIL6B.mjs} +455 -400
  15. package/dist/chunk-SLANIL6B.mjs.map +1 -0
  16. package/dist/{chunk-RACFENTQ.mjs → chunk-YCP2OMFD.mjs} +5 -1
  17. package/dist/chunk-YCP2OMFD.mjs.map +1 -0
  18. package/dist/client/index.js +4 -4
  19. package/dist/client/index.mjs +3 -3
  20. package/dist/components/index.js +4 -4
  21. package/dist/components/index.mjs +3 -3
  22. package/dist/contexts/index.js +4 -4
  23. package/dist/contexts/index.mjs +3 -3
  24. package/dist/core/index.d.mts +2 -2
  25. package/dist/core/index.d.ts +2 -2
  26. package/dist/core/index.js +2 -2
  27. package/dist/core/index.mjs +1 -1
  28. package/dist/index.d.mts +2 -1
  29. package/dist/index.d.ts +2 -1
  30. package/dist/index.js +3 -3
  31. package/dist/index.mjs +2 -2
  32. package/dist/{s3.service-D7NyMnNY.d.ts → s3.service-CoC0k0iu.d.ts} +3 -0
  33. package/dist/{s3.service-D2vIfl9y.d.mts → s3.service-Duh9HW2n.d.mts} +3 -0
  34. package/dist/server/index.d.mts +1 -1
  35. package/dist/server/index.d.ts +1 -1
  36. package/dist/server/index.js +3 -3
  37. package/dist/server/index.mjs +1 -1
  38. package/package.json +1 -1
  39. package/src/features/auth/components/buttons/GoogleSignInButton.tsx +41 -0
  40. package/src/features/auth/components/details/LandingComponent.tsx +3 -1
  41. package/src/features/auth/components/forms/Login.tsx +3 -1
  42. package/src/features/auth/data/auth.interface.ts +3 -0
  43. package/src/features/auth/data/auth.service.ts +1 -0
  44. package/src/features/auth/data/auth.ts +3 -0
  45. package/src/login/config.ts +7 -0
  46. package/src/login/index.ts +7 -1
  47. package/dist/chunk-HBCIT6KE.js.map +0 -1
  48. package/dist/chunk-ITBPDMUX.js.map +0 -1
  49. package/dist/chunk-OR5NPUWF.js.map +0 -1
  50. package/dist/chunk-RACFENTQ.mjs.map +0 -1
  51. package/dist/chunk-TM4RWVZE.mjs.map +0 -1
  52. /package/dist/{BlockNoteEditor-CUIQPN6C.mjs.map → BlockNoteEditor-TFL6ZXIJ.mjs.map} +0 -0
@@ -3,10 +3,11 @@
3
3
  import { useTranslations } from "next-intl";
4
4
  import Image from "next/image";
5
5
  import { getApiUrl } from "../../../../client/config";
6
- import { isDiscordAuthEnabled, isInternalAuthEnabled, isRegistrationAllowed } from "../../../../login";
6
+ import { isDiscordAuthEnabled, isGoogleAuthEnabled, isInternalAuthEnabled, isRegistrationAllowed } from "../../../../login";
7
7
  import { Button, CardDescription, CardFooter, CardHeader, CardTitle, Link } from "../../../../shadcnui";
8
8
  import { useAuthContext } from "../../contexts";
9
9
  import { AuthComponent } from "../../enums";
10
+ import { GoogleSignInButton } from "../buttons/GoogleSignInButton";
10
11
 
11
12
  export function LandingComponent() {
12
13
  const t = useTranslations();
@@ -45,6 +46,7 @@ export function LandingComponent() {
45
46
  </Link>
46
47
  </>
47
48
  )}
49
+ {isGoogleAuthEnabled() && <GoogleSignInButton />}
48
50
  {isDiscordAuthEnabled() && (
49
51
  <Link href={`${getApiUrl()}auth/discord`} className="flex w-full justify-end">
50
52
  <Button className="w-full" variant={`outline`} data-testid="page-login-button-initial-login">
@@ -8,7 +8,7 @@ import { z } from "zod";
8
8
  import { getApiUrl } from "../../../../client/config";
9
9
  import { errorToast, FormInput, FormPassword } from "../../../../components";
10
10
  import { useI18nRouter, usePageUrlGenerator } from "../../../../hooks";
11
- import { isDiscordAuthEnabled, isInternalAuthEnabled } from "../../../../login";
11
+ import { isDiscordAuthEnabled, isGoogleAuthEnabled, isInternalAuthEnabled } from "../../../../login";
12
12
  import {
13
13
  Button,
14
14
  CardContent,
@@ -24,6 +24,7 @@ import { useCurrentUserContext } from "../../../user/contexts";
24
24
  import { useAuthContext } from "../../contexts";
25
25
  import { AuthService } from "../../data/auth.service";
26
26
  import { AuthComponent } from "../../enums";
27
+ import { GoogleSignInButton } from "../buttons/GoogleSignInButton";
27
28
 
28
29
  export function Login() {
29
30
  const t = useTranslations();
@@ -101,6 +102,7 @@ export function Login() {
101
102
  )}
102
103
  </CardContent>
103
104
  <CardFooter className="flex w-full flex-col gap-y-4 mt-4">
105
+ {isGoogleAuthEnabled() && <GoogleSignInButton />}
104
106
  {isDiscordAuthEnabled() && (
105
107
  <Link href={`${getApiUrl()}auth/discord`} className="flex w-full justify-end">
106
108
  <Button className="w-full" variant={`outline`} data-testid="page-login-button-initial-login">
@@ -9,6 +9,9 @@ export type AuthInput = {
9
9
  companyName?: string;
10
10
  partitaIva?: string;
11
11
  codiceFiscale?: string;
12
+ termsAcceptedAt?: string;
13
+ marketingConsent?: boolean;
14
+ marketingConsentAt?: string | null;
12
15
  };
13
16
 
14
17
  export type AuthQuery = {
@@ -167,6 +167,7 @@ export class AuthService extends AbstractService {
167
167
  classKey: Modules.Auth,
168
168
  endpoint: endpoint.generate(),
169
169
  body: params,
170
+ overridesJsonApiCreation: true,
170
171
  language: "en",
171
172
  });
172
173
 
@@ -46,6 +46,9 @@ export class Auth extends AbstractApiData implements AuthInterface {
46
46
  if (data.name !== undefined) response.data.attributes.name = data.name;
47
47
  if (data.companyName !== undefined) response.data.attributes.companyName = data.companyName;
48
48
  if (data.password !== undefined) response.data.attributes.password = data.password;
49
+ if (data.termsAcceptedAt !== undefined) response.data.attributes.termsAcceptedAt = data.termsAcceptedAt;
50
+ if (data.marketingConsent !== undefined) response.data.attributes.marketingConsent = data.marketingConsent;
51
+ if (data.marketingConsentAt !== undefined) response.data.attributes.marketingConsentAt = data.marketingConsentAt;
49
52
 
50
53
  return response;
51
54
  }
@@ -1,15 +1,18 @@
1
1
  let _useDiscordAuth: boolean = false;
2
+ let _useGoogleAuth: boolean = false;
2
3
  let _useInternalAuth: boolean = true;
3
4
  let _allowRegistration: boolean = true;
4
5
 
5
6
  export interface LoginConfig {
6
7
  useDiscordAuth: boolean;
8
+ useGoogleAuth: boolean;
7
9
  useInternalAuth: boolean;
8
10
  allowRegistration?: boolean;
9
11
  }
10
12
 
11
13
  export function configureLogin(params: LoginConfig): void {
12
14
  _useDiscordAuth = params.useDiscordAuth;
15
+ _useGoogleAuth = params.useGoogleAuth;
13
16
  _useInternalAuth = params.useInternalAuth;
14
17
  _allowRegistration = params.allowRegistration ?? true;
15
18
  }
@@ -18,6 +21,10 @@ export function isDiscordAuthEnabled(): boolean {
18
21
  return _useDiscordAuth;
19
22
  }
20
23
 
24
+ export function isGoogleAuthEnabled(): boolean {
25
+ return _useGoogleAuth;
26
+ }
27
+
21
28
  export function isInternalAuthEnabled(): boolean {
22
29
  return _useInternalAuth;
23
30
  }
@@ -1,2 +1,8 @@
1
- export { configureLogin, isDiscordAuthEnabled, isInternalAuthEnabled, isRegistrationAllowed } from "./config";
1
+ export {
2
+ configureLogin,
3
+ isDiscordAuthEnabled,
4
+ isGoogleAuthEnabled,
5
+ isInternalAuthEnabled,
6
+ isRegistrationAllowed,
7
+ } from "./config";
2
8
  export type { LoginConfig } from "./config";