@driveflux/auth 4.0.89 → 4.0.90

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 +1 @@
1
- {"version":3,"file":"AuthProvider.d.ts","sourceRoot":"","sources":["../src/AuthProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EACN,KAAK,EAAE,EACP,KAAK,iBAAiB,EAMtB,MAAM,OAAO,CAAA;AAed,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAyKvC,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"AuthProvider.d.ts","sourceRoot":"","sources":["../src/AuthProvider.tsx"],"names":[],"mappings":"AAWA,OAAO,EACN,KAAK,EAAE,EACP,KAAK,iBAAiB,EAMtB,MAAM,OAAO,CAAA;AAed,QAAA,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CAyKvC,CAAA;AAED,eAAe,YAAY,CAAA"}
@@ -5,9 +5,7 @@ import { enhancedFetch } from '@driveflux/fetch';
5
5
  import { useToastResult } from '@driveflux/ui/toast';
6
6
  import { useTrackEvent } from '@driveflux/web-analytics/track';
7
7
  import Cookies from 'js-cookie';
8
- //! seems like bad idea but it's the only way to resolve conflict
9
- //! between Vercel build and reference of NextRouter instance
10
- import Router, { useRouter } from 'next/dist/client/router.js';
8
+ import Router, { useRouter } from 'next/router';
11
9
  import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
12
10
  import useSWR from 'swr';
13
11
  import { AuthContext } from './context.js';
@@ -6,7 +6,7 @@ export const DEPARTMENTS = {
6
6
  SALES: 'sales',
7
7
  FINANCE: 'finance',
8
8
  DATA_ANALYTICS: 'dataAnalytics',
9
- PRODUCT: 'product',
9
+ PRODUCT: 'product'
10
10
  };
11
11
  export const ROLES = {
12
12
  CEO: 'ceo',
@@ -32,43 +32,54 @@ export const ROLES = {
32
32
  PRODUCT_MANAGER: 'productManager',
33
33
  MEMBER: 'member',
34
34
  BUSINESS_ADMIN: 'businessAdmin',
35
- BUSINESS_USER: 'businessUser',
35
+ BUSINESS_USER: 'businessUser'
36
36
  };
37
37
  export const DEPARTMENTS_MAP = {
38
38
  [DEPARTMENTS.CEO_OFFICE]: [
39
39
  ROLES.CEO,
40
40
  ROLES.HEAD_OF_HUMAN_RESOURCES,
41
- ROLES.HUMAN_RESOURCES_EXECUTIVE,
41
+ ROLES.HUMAN_RESOURCES_EXECUTIVE
42
42
  ],
43
43
  [DEPARTMENTS.OPERATIONS]: [
44
44
  ROLES.HEAD_OF_OPERATIONS,
45
45
  ROLES.CUSTOMER_SUCCESS_EXECUTIVE,
46
- ROLES.CONCIERGE,
46
+ ROLES.CONCIERGE
47
+ ],
48
+ [DEPARTMENTS.MARKETING]: [
49
+ ROLES.HEAD_OF_MARKETING,
50
+ ROLES.MARKETING_EXECUTIVE
47
51
  ],
48
- [DEPARTMENTS.MARKETING]: [ROLES.HEAD_OF_MARKETING, ROLES.MARKETING_EXECUTIVE],
49
52
  [DEPARTMENTS.BUSINESS_DEVELOPMENT]: [
50
53
  ROLES.HEAD_OF_BUSINESS_DEVELOPMENT,
51
- ROLES.BUSINESS_DEVELOPMENT_EXECUTIVE,
54
+ ROLES.BUSINESS_DEVELOPMENT_EXECUTIVE
55
+ ],
56
+ [DEPARTMENTS.SALES]: [
57
+ ROLES.HEAD_OF_SALES,
58
+ ROLES.SALES_EXECUTIVE
59
+ ],
60
+ [DEPARTMENTS.FINANCE]: [
61
+ ROLES.HEAD_OF_FINANCE,
62
+ ROLES.FINANCE_EXECUTIVE
52
63
  ],
53
- [DEPARTMENTS.SALES]: [ROLES.HEAD_OF_SALES, ROLES.SALES_EXECUTIVE],
54
- [DEPARTMENTS.FINANCE]: [ROLES.HEAD_OF_FINANCE, ROLES.FINANCE_EXECUTIVE],
55
64
  [DEPARTMENTS.DATA_ANALYTICS]: [
56
65
  ROLES.HEAD_OF_DATA_ANALYTICS,
57
- ROLES.DATA_ANALYST,
66
+ ROLES.DATA_ANALYST
58
67
  ],
59
68
  [DEPARTMENTS.PRODUCT]: [
60
69
  ROLES.HEAD_OF_PRODUCT,
61
70
  ROLES.HEAD_OF_ENGINEERING,
62
71
  ROLES.DESIGNER,
63
72
  ROLES.ENGINEER,
64
- ROLES.PRODUCT_MANAGER,
65
- ],
73
+ ROLES.PRODUCT_MANAGER
74
+ ]
66
75
  };
67
- export const OWNER_ROLES = [ROLES.CEO];
76
+ export const OWNER_ROLES = [
77
+ ROLES.CEO
78
+ ];
68
79
  export const HIGHER_ADMIN_ROLES = [
69
80
  ROLES.HEAD_OF_HUMAN_RESOURCES,
70
81
  ROLES.HEAD_OF_PRODUCT,
71
- ROLES.HEAD_OF_ENGINEERING,
82
+ ROLES.HEAD_OF_ENGINEERING
72
83
  ];
73
84
  export const ADMIN_ROLES = [
74
85
  ...HIGHER_ADMIN_ROLES,
@@ -88,28 +99,38 @@ export const ADMIN_ROLES = [
88
99
  ROLES.DATA_ANALYST,
89
100
  ROLES.DESIGNER,
90
101
  ROLES.ENGINEER,
91
- ROLES.PRODUCT_MANAGER,
102
+ ROLES.PRODUCT_MANAGER
103
+ ];
104
+ export const ALL_ADMIN_ROLES = [
105
+ ...ADMIN_ROLES,
106
+ ...OWNER_ROLES
92
107
  ];
93
- export const ALL_ADMIN_ROLES = [...ADMIN_ROLES, ...OWNER_ROLES];
94
108
  export const BUSINESS_ROLES = [
95
109
  ROLES.BUSINESS_ADMIN,
96
- ROLES.BUSINESS_USER,
110
+ ROLES.BUSINESS_USER
111
+ ];
112
+ export const CONSUMER_ROLES = [
113
+ ...BUSINESS_ROLES,
114
+ ROLES.MEMBER
115
+ ];
116
+ export const ASSIGNABLE_ROLES = [
117
+ ...ADMIN_ROLES,
118
+ ...CONSUMER_ROLES
97
119
  ];
98
- export const CONSUMER_ROLES = [...BUSINESS_ROLES, ROLES.MEMBER];
99
- export const ASSIGNABLE_ROLES = [...ADMIN_ROLES, ...CONSUMER_ROLES];
100
120
  /**
101
121
  * This is to make it easier for some libraries like zod to understand
102
122
  * the roles types. Keep this in sync with the above ROLES constant
103
- */
104
- export const GENERAL_ROLES = [...ALL_ADMIN_ROLES, ...CONSUMER_ROLES];
123
+ */ export const GENERAL_ROLES = [
124
+ ...ALL_ADMIN_ROLES,
125
+ ...CONSUMER_ROLES
126
+ ];
105
127
  export const GUEST_PERMISSIONS = [
106
128
  {
107
129
  action: 'create',
108
- subject: 'Inquiry',
130
+ subject: 'Inquiry'
109
131
  },
110
132
  {
111
133
  action: 'read',
112
- subject: 'Vehicle',
113
- // TODO: RESTRICT FIELDS
114
- },
134
+ subject: 'Vehicle'
135
+ }
115
136
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,8BAA8B,GAC1C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,kBAKtC,CAAA"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/authorization/roles/admin/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,eAAO,MAAM,8BAA8B,GAC1C,KAAK,cAAc,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,kBAYtC,CAAA"}
package/dist/constants.js CHANGED
@@ -1,7 +1,5 @@
1
- const envSuffux = process.env.APP_ENV === 'production' ? '' : (process.env.APP_ENV ?? '');
2
- export const AUTH_COOKIE_PREFIX = envSuffux
3
- ? `flux-auth.${envSuffux}`
4
- : 'flux-auth';
1
+ const envSuffux = process.env.APP_ENV === 'production' ? '' : process.env.APP_ENV ?? '';
2
+ export const AUTH_COOKIE_PREFIX = envSuffux ? `flux-auth.${envSuffux}` : 'flux-auth';
5
3
  export const AUTH_COOKIE_ACCESSED_ADMIN = `${AUTH_COOKIE_PREFIX}.has-accessed-admin`;
6
4
  export const AUTH_COOKIE_SESSION_TOKEN = `${AUTH_COOKIE_PREFIX}.session-token`;
7
5
  export const AUTH_COOKIE_CALLBACK_URL = `${AUTH_COOKIE_PREFIX}.callback-url`;
package/dist/context.js CHANGED
@@ -2,16 +2,15 @@ import { createContext } from 'react';
2
2
  const defaultContext = {
3
3
  user: undefined,
4
4
  isLoadingUser: false,
5
- signIn: async () => Promise.resolve(undefined),
6
- refresh: async () => Promise.resolve(undefined),
5
+ signIn: async ()=>Promise.resolve(undefined),
6
+ refresh: async ()=>Promise.resolve(undefined),
7
7
  /**
8
- *
9
- * @deprecated There's no need for access token anymore, we use cookies
10
- */
11
- getAccessToken: async () => Promise.resolve(undefined),
8
+ *
9
+ * @deprecated There's no need for access token anymore, we use cookies
10
+ */ getAccessToken: async ()=>Promise.resolve(undefined),
12
11
  // TODO
13
12
  // eslint-disable-next-line @typescript-eslint/no-empty-function -- initial state
14
- logout: () => { },
15
- status: 'loading',
13
+ logout: ()=>{},
14
+ status: 'loading'
16
15
  };
17
- export const AuthContext = createContext(defaultContext);
16
+ export const AuthContext = /*#__PURE__*/ createContext(defaultContext);
package/dist/default.js CHANGED
@@ -1,4 +1,4 @@
1
- export const extractDefault = (mod) => {
1
+ export const extractDefault = (mod)=>{
2
2
  if (typeof mod === 'object' && mod !== null && 'default' in mod) {
3
3
  return mod.default;
4
4
  }
@@ -47,6 +47,7 @@ export declare const authOptions: {
47
47
  }) => Promise<{
48
48
  user: {
49
49
  object?: "user" | undefined;
50
+ status?: import("@driveflux/db").UserStatus | undefined;
50
51
  id?: string | undefined;
51
52
  businessId?: string | null | undefined;
52
53
  hostId?: string | null | undefined;
@@ -60,7 +61,6 @@ export declare const authOptions: {
60
61
  dateOfBirth?: Date | null | undefined;
61
62
  nationality?: string | null | undefined;
62
63
  consented?: boolean | undefined;
63
- status?: import("@driveflux/db").UserStatus | undefined;
64
64
  race?: import("@driveflux/db").Race | null | undefined;
65
65
  maritalStatus?: import("@driveflux/db").MaritalStatus | null | undefined;
66
66
  emergencyContactName?: string | null | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"next-auth.d.ts","sourceRoot":"","sources":["../../src/server/next-auth.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,IAAI,IAAI,WAAW,EAAmB,MAAM,WAAW,CAAA;AA6BrE,eAAO,MAAM,oBAAoB,GAChC,MAAM,WAAW,KACf,OAAO,CAAC,MAAM,CAehB,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;2BAQlB,MAAM,CAAC,UAAU,GAAG,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,GAC3D,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAQ/B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;mCA+S24E,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADh4E,CAAA"}
1
+ {"version":3,"file":"next-auth.d.ts","sourceRoot":"","sources":["../../src/server/next-auth.ts"],"names":[],"mappings":"AAEA,OAAO,qBAAqB,CAAA;AAK5B,OAAO,KAAK,EAAE,IAAI,IAAI,WAAW,EAAmB,MAAM,WAAW,CAAA;AA6BrE,eAAO,MAAM,oBAAoB,GAChC,MAAM,WAAW,KACf,OAAO,CAAC,MAAM,CAehB,CAAA;AAED,eAAO,MAAM,qBAAqB;;;;;;;;;;;;2BAQlB,MAAM,CAAC,UAAU,GAAG,OAAO,EAAE,MAAM,CAAC,GAAG,SAAS,GAC3D,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CAQ/B,CAAA;AAED,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;mCA+S24E,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CADh4E,CAAA"}
@@ -4,15 +4,15 @@ export const translations = singleton('authTranslations', {
4
4
  password: 'Password',
5
5
  unauthenticated: 'Unauthenticated',
6
6
  unauthenticatedDescription: 'You are not authenticated. Please log in to continue.',
7
- wrongUsernameOrPassword: 'The username / password combination is invalid.',
7
+ wrongUsernameOrPassword: 'The username / password combination is invalid.'
8
8
  });
9
- export const setTranslations = (ts) => {
10
- for (const key in ts) {
9
+ export const setTranslations = (ts)=>{
10
+ for(const key in ts){
11
11
  // TODO
12
12
  // @ts-expect-error
13
13
  translations[key] = ts[key];
14
14
  }
15
15
  };
16
- export const setTranslation = (key, value) => {
16
+ export const setTranslation = (key, value)=>{
17
17
  translations[key] = value;
18
18
  };
package/dist/use-auth.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { useContext } from 'react';
2
2
  import { AuthContext } from './context.js';
3
- export const useAuth = () => {
3
+ export const useAuth = ()=>{
4
4
  return useContext(AuthContext);
5
5
  };
@@ -1,4 +1,4 @@
1
1
  import { useSession as originalUseSession } from 'next-auth/react';
2
- export const useSession = (options) => {
2
+ export const useSession = (options)=>{
3
3
  return originalUseSession(options);
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@driveflux/auth",
3
- "version": "4.0.89",
3
+ "version": "4.0.90",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -74,34 +74,34 @@
74
74
  "dependencies": {
75
75
  "@casl/ability": "^6.8.1",
76
76
  "@casl/prisma": "^1.6.2",
77
- "@driveflux/config": "3.0.11",
77
+ "@driveflux/config": "3.0.12",
78
78
  "@driveflux/db": "4.1.20",
79
- "@driveflux/fetch": "8.0.2",
80
- "@driveflux/problem": "6.0.2",
81
- "@driveflux/reporter": "7.0.3",
82
- "@driveflux/result": "6.0.2",
83
- "@driveflux/singleton": "3.0.1",
84
- "@driveflux/ui": "3.0.4",
85
- "@driveflux/utils": "6.0.1",
86
- "@driveflux/web-analytics": "3.0.4",
79
+ "@driveflux/fetch": "8.0.3",
80
+ "@driveflux/problem": "6.0.3",
81
+ "@driveflux/reporter": "7.0.4",
82
+ "@driveflux/result": "6.0.3",
83
+ "@driveflux/singleton": "3.0.2",
84
+ "@driveflux/ui": "3.0.5",
85
+ "@driveflux/utils": "6.0.2",
86
+ "@driveflux/web-analytics": "3.0.5",
87
87
  "@types/cors": "^2.8.19",
88
88
  "bcryptjs": "^3.0.3",
89
89
  "change-case": "^5.4.4",
90
90
  "cors": "^2.8.6",
91
91
  "jose": "^6.2.3",
92
- "js-cookie": "^3.0.5",
92
+ "js-cookie": "^3.0.7",
93
93
  "nanoid": "^5.1.11",
94
94
  "next-auth": "4.24.14",
95
95
  "universal-cookie": "^8.1.2"
96
96
  },
97
97
  "devDependencies": {
98
- "@driveflux/fab": "4.0.1",
99
- "@driveflux/tsconfig": "3.0.1",
98
+ "@driveflux/fab": "4.0.2",
99
+ "@driveflux/tsconfig": "3.0.2",
100
100
  "@swc/cli": "^0.8.1",
101
101
  "@swc/core": "^1.15.33",
102
102
  "@types/js-cookie": "^3.0.6",
103
- "@types/node": "^25.7.0",
104
- "@types/react": "19.2.14",
103
+ "@types/node": "^25.9.1",
104
+ "@types/react": "19.2.15",
105
105
  "del-cli": "^7.0.0",
106
106
  "next": "16.2.6",
107
107
  "react": "19.2.6",