@q2devel/q2-core 1.0.26 → 1.0.28

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.
@@ -0,0 +1,4 @@
1
+ import { AxiosInstance, AxiosRequestConfig } from "axios";
2
+ import { ProductDetailQuestionForm } from "./QuestionFormService.types";
3
+ export declare const sendProductDetailQuestionForm: (axiosInstance: AxiosInstance, request: ProductDetailQuestionForm, config?: AxiosRequestConfig) => Promise<void>;
4
+ //# sourceMappingURL=QuestionForm.service%20copy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QuestionForm.service copy.d.ts","sourceRoot":"","sources":["../../../../api/products/product-detail/QuestionForm.service copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAEvE,eAAO,MAAM,6BAA6B,GACtC,eAAe,aAAa,EAC5B,SAAS,yBAAyB,EAClC,SAAQ,kBAAuB,KAChC,OAAO,CAAC,IAAI,CAKd,CAAA"}
@@ -0,0 +1,6 @@
1
+ export const sendProductDetailQuestionForm = async (axiosInstance, request, config = {}) => {
2
+ const { data } = await axiosInstance.post(`/webform_rest/submit`, request, {
3
+ ...config,
4
+ });
5
+ return data;
6
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../../auth/context/AuthContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAe,gBAAgB,EAAE,iBAAiB,EAAQ,MAAM,oBAAoB,CAAA;AAI3F,eAAO,MAAM,mBAAmB,GAAI,+DAKjC,iBAAiB,4CAuJnB,CAAA;AAED,eAAO,MAAM,OAAO,QAAO,gBAM1B,CAAA"}
1
+ {"version":3,"file":"AuthContext.d.ts","sourceRoot":"","sources":["../../../auth/context/AuthContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAe,gBAAgB,EAAE,iBAAiB,EAAQ,MAAM,oBAAoB,CAAA;AAI3F,eAAO,MAAM,mBAAmB,GAAI,+DAKjC,iBAAiB,4CAkKnB,CAAA;AAED,eAAO,MAAM,OAAO,QAAO,gBAM1B,CAAA"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import Cookies from 'js-cookie';
4
- import { createContext, useCallback, useContext, useEffect, useRef, useState } from 'react';
4
+ import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
5
5
  import { fetchUserInfo, refreshTokenService } from '../auth/auth';
6
6
  const AuthContext = createContext(undefined);
7
7
  export const AuthContextProvider = ({ children, config, initialAccessToken, initialCurrentUser, }) => {
@@ -11,11 +11,15 @@ export const AuthContextProvider = ({ children, config, initialAccessToken, init
11
11
  const [isLoading, setIsLoading] = useState(false);
12
12
  const [isReady, setIsReady] = useState(false);
13
13
  const refreshingRef = useRef(false);
14
- const COOKIE_OPTIONS = {
14
+ const COOKIE_OPTIONS = useMemo(() => ({
15
15
  secure: config.cookieOptions?.secure ?? false,
16
16
  sameSite: config.cookieOptions?.sameSite ?? 'strict',
17
17
  expires: config.cookieOptions?.expires ?? 1,
18
- };
18
+ }), [
19
+ config.cookieOptions?.secure,
20
+ config.cookieOptions?.sameSite,
21
+ config.cookieOptions?.expires,
22
+ ]);
19
23
  useEffect(() => {
20
24
  const savedToken = Cookies.get('accessToken');
21
25
  const savedRefreshToken = Cookies.get('refreshToken');
@@ -51,14 +55,23 @@ export const AuthContextProvider = ({ children, config, initialAccessToken, init
51
55
  }
52
56
  else {
53
57
  Cookies.remove('accessToken');
54
- Cookies.remove('refreshToken');
55
58
  Cookies.remove('expiresAt');
56
59
  Cookies.remove('user');
57
60
  }
58
61
  }, [accessToken, expiresAt, user, COOKIE_OPTIONS]);
62
+ const clearAllAuth = useCallback(() => {
63
+ Cookies.remove('accessToken');
64
+ Cookies.remove('refreshToken');
65
+ Cookies.remove('expiresAt');
66
+ Cookies.remove('user');
67
+ setAccessToken(undefined);
68
+ setExpiresAt(undefined);
69
+ setUser(undefined);
70
+ }, []);
59
71
  // ✅ Čítajte refresh token priamo z cookies keď ho potrebujete
60
72
  const refreshTokenIfNeeded = useCallback(async () => {
61
73
  const currentRefreshToken = Cookies.get('refreshToken'); // ✅ z cookie
74
+ console.log('🔄 Refresh začína, refresh token:', !!currentRefreshToken); // Debug
62
75
  if (refreshingRef.current || !currentRefreshToken)
63
76
  return;
64
77
  if (expiresAt && Date.now() < expiresAt - 10000)
@@ -69,6 +82,7 @@ export const AuthContextProvider = ({ children, config, initialAccessToken, init
69
82
  const refreshed = await refreshTokenService(currentRefreshToken, config);
70
83
  // ✅ Uložiť nový refresh token priamo do cookie
71
84
  Cookies.set('refreshToken', refreshed.refreshToken, COOKIE_OPTIONS);
85
+ console.log('✅ Nový refresh token uložený'); // Debug
72
86
  setAccessToken(refreshed.token);
73
87
  setExpiresAt(refreshed.expiresAt);
74
88
  setUser({ ...refreshed });
@@ -78,20 +92,14 @@ export const AuthContextProvider = ({ children, config, initialAccessToken, init
78
92
  // Pokud refresh token selhal, můžeme vymazat autentifikační data
79
93
  if (error instanceof Error && error.message === 'Failed to refresh token') {
80
94
  // Odstranění cookies
81
- Cookies.remove('accessToken');
82
- Cookies.remove('refreshToken');
83
- Cookies.remove('expiresAt');
84
- Cookies.remove('user');
85
- setAccessToken(undefined);
86
- setExpiresAt(undefined);
87
- setUser(undefined);
95
+ clearAllAuth();
88
96
  }
89
97
  }
90
98
  finally {
91
99
  setIsLoading(false);
92
100
  refreshingRef.current = false;
93
101
  }
94
- }, [expiresAt, config]);
102
+ }, [expiresAt, config, COOKIE_OPTIONS, clearAllAuth]);
95
103
  // Pravidelný refresh tokenu
96
104
  useEffect(() => {
97
105
  if (!refreshTokenIfNeeded)
@@ -1 +1 @@
1
- {"version":3,"file":"useSignOut.d.ts","sourceRoot":"","sources":["../../../auth/hooks/useSignOut.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,UAAU;;;CAuBtB,CAAA"}
1
+ {"version":3,"file":"useSignOut.d.ts","sourceRoot":"","sources":["../../../auth/hooks/useSignOut.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,UAAU;;;CAwBtB,CAAA"}
@@ -2,6 +2,7 @@
2
2
  import { useAuth } from '../context/AuthContext';
3
3
  import { signOutService } from '../auth/auth';
4
4
  import { useCallback, useState } from 'react';
5
+ import Cookies from 'js-cookie';
5
6
  export const useSignOut = () => {
6
7
  const [isLoading, setIsLoading] = useState(false);
7
8
  const { setAccessToken, setExpiresAt, setUser } = useAuth();
@@ -9,6 +10,7 @@ export const useSignOut = () => {
9
10
  try {
10
11
  setIsLoading(true);
11
12
  await signOutService();
13
+ Cookies.remove('refreshToken');
12
14
  setAccessToken(undefined);
13
15
  setExpiresAt(undefined);
14
16
  setUser(undefined);
@@ -6,7 +6,14 @@ export type BlogItem = {
6
6
  body: string;
7
7
  field_image_url?: string;
8
8
  field_image_alt?: string;
9
+ field_video_link?: string;
10
+ field_carousel_items?: CarouselItem[];
9
11
  created: string;
10
12
  changed: string;
11
13
  };
14
+ export type CarouselItem = {
15
+ field_image_url?: string;
16
+ field_image_alt?: string;
17
+ field_video_link?: string;
18
+ };
12
19
  //# sourceMappingURL=Blog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Blog.d.ts","sourceRoot":"","sources":["../../../types/content/Blog.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC"}
1
+ {"version":3,"file":"Blog.d.ts","sourceRoot":"","sources":["../../../types/content/Blog.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oBAAoB,CAAC,EAAE,YAAY,EAAE,CAAA;IACrC,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACvB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC5B,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@q2devel/q2-core",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {
@@ -1 +0,0 @@
1
- //# sourceMappingURL=getUserCart.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getUserCart.d.ts","sourceRoot":"","sources":["../../../api/user/getUserCart.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,8 +0,0 @@
1
- export type ResetPasswordResponse = {
2
- data: {
3
- id: string;
4
- email: string;
5
- };
6
- status: number;
7
- };
8
- //# sourceMappingURL=ResetPassword.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResetPassword.d.ts","sourceRoot":"","sources":["../../types/ResetPassword.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export type ResetPasswordResponse = {
2
- data: {
3
- id: string;
4
- email: string;
5
- };
6
- status: number;
7
- };
8
- //# sourceMappingURL=ResetPassword.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ResetPassword.d.ts","sourceRoot":"","sources":["../../../types/content/ResetPassword.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
@@ -1 +0,0 @@
1
- export {};