@raxonltd/raxon-core 1.0.1 → 1.0.4
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/core/context/cart.context.d.ts +4 -9
- package/dist/core/context/cart.context.d.ts.map +1 -1
- package/dist/core/context/cart.context.js +18 -29
- package/dist/core/context/security.context.d.ts +4 -10
- package/dist/core/context/security.context.d.ts.map +1 -1
- package/dist/core/context/security.context.js +25 -32
- package/dist/core/feature/address/form/address-search-input.d.ts +1 -1
- package/dist/core/feature/address/hook/use.addres.d.ts +2 -2
- package/dist/core/feature/address/hook/use.addres.js +1 -1
- package/dist/core/feature/address/hook/use.address-autocomplete.d.ts +2 -2
- package/dist/core/feature/address/hook/use.address-autocomplete.js +1 -1
- package/dist/core/feature/address/util/parse-google-place.d.ts +2 -2
- package/dist/core/feature/article/hook/use.article.d.ts +2 -2
- package/dist/core/feature/article/hook/use.article.js +1 -1
- package/dist/core/feature/attribute/hook/use.attribute.d.ts +2 -2
- package/dist/core/feature/attribute/hook/use.attribute.js +1 -1
- package/dist/core/feature/auth/hook/use.auth.js +1 -1
- package/dist/core/feature/auth/modal/modal.auth.js +4 -4
- package/dist/core/feature/auth/view/view.login.js +1 -1
- package/dist/core/feature/auth/view/view.register.js +1 -1
- package/dist/core/feature/bank-account/hook/use.bank.account.d.ts +2 -2
- package/dist/core/feature/bank-account/hook/use.bank.account.js +1 -1
- package/dist/core/feature/cart/component/cart.order.summary.d.ts +1 -1
- package/dist/core/feature/cart/component/cart.order.summary.js +1 -1
- package/dist/core/feature/cart/component/cart.promo.code.section.js +5 -5
- package/dist/core/feature/cart/hook/use.cart.d.ts +7 -3
- package/dist/core/feature/cart/hook/use.cart.d.ts.map +1 -1
- package/dist/core/feature/cart/hook/use.cart.js +12 -3
- package/dist/core/feature/cart/util/basket-pay.response.js +1 -1
- package/dist/core/feature/cart/util/cart-optimistic.d.ts +1 -1
- package/dist/core/feature/cart/util/cart-optimistic.js +1 -1
- package/dist/core/feature/collection/hook/use.collection.d.ts +2 -2
- package/dist/core/feature/collection/hook/use.collection.js +1 -1
- package/dist/core/feature/delivery-method/hook/use.delivery.method.d.ts +1 -1
- package/dist/core/feature/delivery-method/hook/use.delivery.method.js +2 -2
- package/dist/core/feature/delivery-method/util/checkout.delivery.method.d.ts +1 -1
- package/dist/core/feature/faq/hook/use.faq.d.ts +2 -2
- package/dist/core/feature/faq/hook/use.faq.js +1 -1
- package/dist/core/feature/favorite/hook/use.favorite.d.ts +2 -2
- package/dist/core/feature/favorite/hook/use.favorite.js +1 -1
- package/dist/core/feature/form-submit/hook/use.form.submit.js +1 -1
- package/dist/core/feature/invoice/hook/use.invoice.d.ts +2 -2
- package/dist/core/feature/invoice/hook/use.invoice.js +1 -1
- package/dist/core/feature/newsletter/hook/use.newsletter.d.ts +1 -1
- package/dist/core/feature/newsletter/hook/use.newsletter.js +1 -1
- package/dist/core/feature/newsletter/modal/modal.newsletter.product.d.ts +1 -1
- package/dist/core/feature/newsletter/modal/modal.newsletter.product.js +3 -3
- package/dist/core/feature/order/hook/use.order.d.ts +2 -2
- package/dist/core/feature/order/hook/use.order.js +1 -1
- package/dist/core/feature/payment-method/checkout.payment.options.d.ts +1 -1
- package/dist/core/feature/payment-method/checkout.payment.options.js +1 -1
- package/dist/core/feature/payment-method/hook/use.payment.method.d.ts +2 -2
- package/dist/core/feature/payment-method/hook/use.payment.method.js +1 -1
- package/dist/core/feature/product/hook/use.product.d.ts +3 -3
- package/dist/core/feature/product/hook/use.product.js +2 -2
- package/dist/core/feature/profile/hook/use.profile.d.ts +1 -1
- package/dist/core/feature/profile/hook/use.profile.js +1 -1
- package/dist/core/feature/promo-code/hook/use.promo.code.d.ts +1 -1
- package/dist/core/feature/promo-code/hook/use.promo.code.js +1 -1
- package/dist/core/interface/inventory.interface.d.ts +1 -1
- package/dist/core/raxon.context.d.ts +13 -10
- package/dist/core/raxon.context.d.ts.map +1 -1
- package/dist/core/raxon.context.js +28 -21
- package/dist/core/util/garanti-payment.d.ts +1 -1
- package/dist/core/util/garanti-payment.js +1 -1
- package/dist/core/view/view.checkout.d.ts +2 -0
- package/dist/core/view/view.checkout.d.ts.map +1 -0
- package/dist/core/view/view.checkout.js +684 -0
- package/dist/hook.d.ts +19 -0
- package/dist/hook.d.ts.map +1 -0
- package/dist/hook.js +18 -0
- package/dist/index.d.ts +2 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -22
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/view.d.ts +2 -0
- package/dist/view.d.ts.map +1 -0
- package/dist/view.js +1 -0
- package/package.json +35 -13
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BasketSummaryInterface } from '
|
|
2
|
-
import { PromoCode } from '
|
|
3
|
-
interface
|
|
1
|
+
import { BasketSummaryInterface } from '../interface/basket.interface';
|
|
2
|
+
import { PromoCode } from '../interface/prisma.interface';
|
|
3
|
+
export interface CartState {
|
|
4
4
|
cart: BasketSummaryInterface | null;
|
|
5
5
|
cartLoading: boolean;
|
|
6
6
|
isAddingToCart: boolean;
|
|
@@ -16,10 +16,5 @@ interface CartContextType {
|
|
|
16
16
|
promoCode: PromoCode | null;
|
|
17
17
|
setPromoCode: (promoCode: PromoCode | null) => void;
|
|
18
18
|
}
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const CartProvider: ({ children }: {
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
}) => import("react").JSX.Element;
|
|
23
|
-
export declare const useCartContext: () => CartContextType;
|
|
24
|
-
export {};
|
|
19
|
+
export declare const useCartState: (isAuthenticated: boolean) => CartState;
|
|
25
20
|
//# sourceMappingURL=cart.context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.context.d.ts","sourceRoot":"","sources":["../../../core/context/cart.context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cart.context.d.ts","sourceRoot":"","sources":["../../../core/context/cart.context.tsx"],"names":[],"m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
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
3
|
import { useQueryClient } from '@tanstack/react-query';
|
|
5
|
-
import { useCart } from '
|
|
6
|
-
import { useSecurity } from '@/core/context/security.context';
|
|
4
|
+
import { useCart } from '../feature/cart/hook/use.cart';
|
|
7
5
|
import toast from 'react-hot-toast';
|
|
8
|
-
import { applyPendingAdds, applyPendingQuantities, cartLineKey, CART_QUANTITY_DEBOUNCE_MS, createEmptyOptimisticCart, extractBasketFromInsertResponse, extractInsertCartItem, findCartLine, applyBasketInsertResponse, mergeInsertItemIntoCart, patchCartCache, patchCartItemQuantity, readCartCache, removeCartLineByKey, } from '
|
|
9
|
-
export const
|
|
10
|
-
export const CartProvider = ({ children }) => {
|
|
11
|
-
const { isAuthenticated } = useSecurity();
|
|
6
|
+
import { applyPendingAdds, applyPendingQuantities, cartLineKey, CART_QUANTITY_DEBOUNCE_MS, createEmptyOptimisticCart, extractBasketFromInsertResponse, extractInsertCartItem, findCartLine, applyBasketInsertResponse, mergeInsertItemIntoCart, patchCartCache, patchCartItemQuantity, readCartCache, removeCartLineByKey, } from '../feature/cart/util/cart-optimistic';
|
|
7
|
+
export const useCartState = (isAuthenticated) => {
|
|
12
8
|
const queryClient = useQueryClient();
|
|
13
9
|
const [promoCode, setPromoCode] = useState(null);
|
|
14
10
|
const [pendingQuantities, setPendingQuantities] = useState({});
|
|
@@ -315,25 +311,18 @@ export const CartProvider = ({ children }) => {
|
|
|
315
311
|
},
|
|
316
312
|
});
|
|
317
313
|
};
|
|
318
|
-
return
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
};
|
|
333
|
-
export const useCartContext = () => {
|
|
334
|
-
const context = useContext(CartContext);
|
|
335
|
-
if (context === undefined) {
|
|
336
|
-
throw new Error('useCartContext must be used within an CartProvider');
|
|
337
|
-
}
|
|
338
|
-
return context;
|
|
314
|
+
return {
|
|
315
|
+
cart: displayCart,
|
|
316
|
+
cartLoading,
|
|
317
|
+
isAddingToCart,
|
|
318
|
+
isUpdatingCart,
|
|
319
|
+
isProductAdding,
|
|
320
|
+
addToCart,
|
|
321
|
+
updateQuantity,
|
|
322
|
+
changeQuantity,
|
|
323
|
+
removeItem,
|
|
324
|
+
cartTotal: displayCart?.info?.payPrice?.pay || 0,
|
|
325
|
+
promoCode,
|
|
326
|
+
setPromoCode,
|
|
327
|
+
};
|
|
339
328
|
};
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
interface SecurityContextType {
|
|
1
|
+
import { User } from '../interface/prisma.interface';
|
|
2
|
+
export interface SecurityState {
|
|
4
3
|
profile: User | null | undefined;
|
|
5
|
-
|
|
4
|
+
authLoading: boolean;
|
|
6
5
|
isAuthenticated: boolean;
|
|
7
6
|
isGuest: boolean;
|
|
8
7
|
}
|
|
9
|
-
|
|
10
|
-
children: React.ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export declare const SecurityProvider: React.FC<SecurityProviderProps>;
|
|
13
|
-
export declare const useSecurity: () => SecurityContextType;
|
|
14
|
-
export {};
|
|
8
|
+
export declare const useSecurityState: () => SecurityState;
|
|
15
9
|
//# sourceMappingURL=security.context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security.context.d.ts","sourceRoot":"","sources":["../../../core/context/security.context.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security.context.d.ts","sourceRoot":"","sources":["../../../core/context/security.context.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAa,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAIpE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,gBAAgB,QAAO,aAuInC,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
import { createContext, useContext, useEffect, useState, useCallback, useMemo } from 'react';
|
|
2
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
4
3
|
import { useRouter, usePathname } from 'next/navigation';
|
|
5
|
-
import { LoginType } from '
|
|
6
|
-
import { useAuth } from '
|
|
7
|
-
import { useProfile } from '
|
|
8
|
-
const
|
|
9
|
-
export const SecurityProvider = ({ children }) => {
|
|
4
|
+
import { LoginType } from '../interface/prisma.interface';
|
|
5
|
+
import { useAuth } from '../feature/auth/hook/use.auth';
|
|
6
|
+
import { useProfile } from '../feature/profile/hook/use.profile';
|
|
7
|
+
export const useSecurityState = () => {
|
|
10
8
|
const router = useRouter();
|
|
11
9
|
const pathname = usePathname();
|
|
12
10
|
const [authLoading, setAuthLoading] = useState(true);
|
|
@@ -24,7 +22,6 @@ export const SecurityProvider = ({ children }) => {
|
|
|
24
22
|
return status === 401 || status === 403;
|
|
25
23
|
};
|
|
26
24
|
const isServerAccessError = (error) => {
|
|
27
|
-
// axios: response yoksa çoğunlukla network/cors/offline; 5xx ise sunucu erişim sorunu
|
|
28
25
|
const status = error?.response?.status;
|
|
29
26
|
return !error?.response || (typeof status === 'number' && status >= 500);
|
|
30
27
|
};
|
|
@@ -45,7 +42,7 @@ export const SecurityProvider = ({ children }) => {
|
|
|
45
42
|
const checkToken = useCallback(() => {
|
|
46
43
|
if (typeof window !== 'undefined') {
|
|
47
44
|
const token = localStorage.getItem('koksal-token');
|
|
48
|
-
if (token && token.trim() !==
|
|
45
|
+
if (token && token.trim() !== '' && token.length > 3) {
|
|
49
46
|
setAuthLoading(true);
|
|
50
47
|
tokenCheck(undefined, {
|
|
51
48
|
onSuccess: () => {
|
|
@@ -54,22 +51,19 @@ export const SecurityProvider = ({ children }) => {
|
|
|
54
51
|
setAuthLoading(false);
|
|
55
52
|
},
|
|
56
53
|
onError: (error) => {
|
|
57
|
-
// Sunucu erişim sorunu varsa token silme
|
|
58
54
|
if (isServerAccessError(error)) {
|
|
59
55
|
setIsAuthEstablished(true);
|
|
60
56
|
setIsAuthenticated(true);
|
|
61
57
|
setAuthLoading(false);
|
|
62
58
|
return;
|
|
63
59
|
}
|
|
64
|
-
// Token geçersizse misafir girişe düş
|
|
65
60
|
if (isInvalidTokenError(error)) {
|
|
66
61
|
localStorage.removeItem('koksal-token');
|
|
67
62
|
ensureGuestLogin();
|
|
68
63
|
return;
|
|
69
64
|
}
|
|
70
|
-
// Diğer hatalarda da token silmeden misafir girişe düş
|
|
71
65
|
ensureGuestLogin();
|
|
72
|
-
}
|
|
66
|
+
},
|
|
73
67
|
});
|
|
74
68
|
}
|
|
75
69
|
else {
|
|
@@ -88,12 +82,10 @@ export const SecurityProvider = ({ children }) => {
|
|
|
88
82
|
checkToken();
|
|
89
83
|
}
|
|
90
84
|
};
|
|
91
|
-
// localStorage değişikliklerini dinle
|
|
92
|
-
window.addEventListener('storage', handleStorageChange);
|
|
93
|
-
// Aynı tab içindeki localStorage değişikliklerini dinlemek için custom event
|
|
94
85
|
const handleCustomStorageChange = () => {
|
|
95
86
|
checkToken();
|
|
96
87
|
};
|
|
88
|
+
window.addEventListener('storage', handleStorageChange);
|
|
97
89
|
window.addEventListener('koksal-token-changed', handleCustomStorageChange);
|
|
98
90
|
return () => {
|
|
99
91
|
window.removeEventListener('storage', handleStorageChange);
|
|
@@ -102,7 +94,6 @@ export const SecurityProvider = ({ children }) => {
|
|
|
102
94
|
}
|
|
103
95
|
}, [checkToken]);
|
|
104
96
|
useEffect(() => {
|
|
105
|
-
// Loading durumunda yönlendirme yapma
|
|
106
97
|
const isLoading = authLoading || (isAuthEstablished && (profileQuery.isLoading || profileQuery.isFetching));
|
|
107
98
|
if (isLoading)
|
|
108
99
|
return;
|
|
@@ -112,19 +103,21 @@ export const SecurityProvider = ({ children }) => {
|
|
|
112
103
|
if (pathname.startsWith('/hesabim') && (!isAuthenticated || profile?.loginType === LoginType.GUEST)) {
|
|
113
104
|
router.push('/guvenlik/giris-yap');
|
|
114
105
|
}
|
|
115
|
-
}, [
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
106
|
+
}, [
|
|
107
|
+
pathname,
|
|
108
|
+
isAuthenticated,
|
|
109
|
+
authLoading,
|
|
110
|
+
isAuthEstablished,
|
|
111
|
+
profileQuery.isLoading,
|
|
112
|
+
profileQuery.isFetching,
|
|
113
|
+
router,
|
|
114
|
+
profile?.loginType,
|
|
115
|
+
]);
|
|
116
|
+
const resolvedAuthLoading = authLoading || (isAuthEstablished && (profileQuery.isLoading || profileQuery.isFetching));
|
|
117
|
+
return {
|
|
118
|
+
profile,
|
|
119
|
+
authLoading: resolvedAuthLoading,
|
|
120
|
+
isAuthenticated,
|
|
121
|
+
isGuest,
|
|
122
|
+
};
|
|
130
123
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from "
|
|
2
|
-
import { Address } from "
|
|
1
|
+
import { IData } from "../../../interface/nexine.interface";
|
|
2
|
+
import { Address } from "../../../interface/prisma.interface";
|
|
3
3
|
export declare const useAddress: () => {
|
|
4
4
|
fetch: () => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<Address>>, Error>;
|
|
5
5
|
create: () => import("@tanstack/react-query").UseMutationResult<any, Error, any, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nexineAxios } from "
|
|
1
|
+
import { nexineAxios } from "../../../util/nexine.axios";
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
export const useAddress = () => {
|
|
4
4
|
const queryClient = useQueryClient();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GooglePlacePrediction } from '
|
|
1
|
+
import { GooglePlacePrediction } from '../../../feature/address/util/address.types';
|
|
2
2
|
export declare function useAddressAutocomplete(): {
|
|
3
3
|
query: string;
|
|
4
4
|
setQuery: (value: string) => void;
|
|
@@ -7,7 +7,7 @@ export declare function useAddressAutocomplete(): {
|
|
|
7
7
|
isSearching: boolean;
|
|
8
8
|
showResults: boolean;
|
|
9
9
|
setShowResults: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
10
|
-
selectPlace: (prediction: GooglePlacePrediction) => Promise<import("
|
|
10
|
+
selectPlace: (prediction: GooglePlacePrediction) => Promise<import("../../../feature/address/util/address.types").ParsedAddressData>;
|
|
11
11
|
resetSearch: () => void;
|
|
12
12
|
};
|
|
13
13
|
//# sourceMappingURL=use.address-autocomplete.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
|
-
import { parseGooglePlaceResult } from '
|
|
2
|
+
import { parseGooglePlaceResult } from '../../../feature/address/util/parse-google-place';
|
|
3
3
|
const DEBOUNCE_MS = 400;
|
|
4
4
|
const MIN_QUERY_LENGTH = 3;
|
|
5
5
|
export function useAddressAutocomplete() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Address } from '
|
|
2
|
-
import { GooglePlaceDetails, ParsedAddressData } from '
|
|
1
|
+
import { Address } from '../../../interface/prisma.interface';
|
|
2
|
+
import { GooglePlaceDetails, ParsedAddressData } from '../../../feature/address/util/address.types';
|
|
3
3
|
export declare function parseGooglePlaceResult(placeDetails: GooglePlaceDetails): ParsedAddressData;
|
|
4
4
|
export declare function formatAddressSummary(data: Partial<Address> | ParsedAddressData): string;
|
|
5
5
|
export declare function parsedAddressToFormFields(parsed: ParsedAddressData): {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from "
|
|
2
|
-
import { Article } from "
|
|
1
|
+
import { IData } from "../../../interface/nexine.interface";
|
|
2
|
+
import { Article } from "../../../interface/prisma.interface";
|
|
3
3
|
export declare const useArticle: () => {
|
|
4
4
|
fetch: (params?: any) => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<Article>>, Error>;
|
|
5
5
|
detail: (id: string) => import("@tanstack/react-query").UseQueryResult<NoInfer<Article>, Error>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from '
|
|
2
|
-
import { Attribute } from '
|
|
1
|
+
import { IData } from '../../../interface/nexine.interface';
|
|
2
|
+
import { Attribute } from '../../../interface/prisma.interface';
|
|
3
3
|
export declare const useAttribute: () => {
|
|
4
4
|
fetch: (params: {
|
|
5
5
|
categoryId?: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nexineAxios } from "
|
|
1
|
+
import { nexineAxios } from "../../../util/nexine.axios";
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
// Auth event'leri için custom eventler
|
|
4
4
|
export const LOGOUT_EVENT = 'intermarkt-logout';
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import React, { useImperativeHandle, useMemo, useState } from 'react';
|
|
3
3
|
import { Modal } from 'rizzui';
|
|
4
4
|
import { X } from 'lucide-react';
|
|
5
|
-
import ViewLogin from '
|
|
6
|
-
import ViewRegister from '
|
|
7
|
-
import { useRaxon } from '
|
|
8
|
-
import { GeneralImage } from '
|
|
5
|
+
import ViewLogin from '../../../feature/auth/view/view.login';
|
|
6
|
+
import ViewRegister from '../../../feature/auth/view/view.register';
|
|
7
|
+
import { useRaxon } from '../../../raxon.context';
|
|
8
|
+
import { GeneralImage } from '../../../component/general.image';
|
|
9
9
|
import { usePathname } from 'next/navigation';
|
|
10
10
|
import queryString from 'query-string';
|
|
11
11
|
export const ModalAuth = React.forwardRef((props, ref) => {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Eye, EyeOff } from 'lucide-react';
|
|
5
|
-
import { useAuth } from '
|
|
5
|
+
import { useAuth } from '../../../feature/auth/hook/use.auth';
|
|
6
6
|
import { useForm } from 'react-hook-form';
|
|
7
7
|
import toast from 'react-hot-toast';
|
|
8
8
|
export default function ViewLogin({ onClose, returnUrl }) {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Eye, EyeOff, Lock, Mail, User, Phone, ArrowRight } from 'lucide-react';
|
|
5
|
-
import { useAuth } from '
|
|
5
|
+
import { useAuth } from '../../../feature/auth/hook/use.auth';
|
|
6
6
|
import { useRouter } from 'next/navigation';
|
|
7
7
|
import { useForm } from 'react-hook-form';
|
|
8
8
|
import { zodResolver } from '@hookform/resolvers/zod';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from '
|
|
2
|
-
import { BankAccount, BankTransferCode } from '
|
|
1
|
+
import { IData } from '../../../interface/nexine.interface';
|
|
2
|
+
import { BankAccount, BankTransferCode } from '../../../interface/prisma.interface';
|
|
3
3
|
export declare const useBankAccount: () => {
|
|
4
4
|
fetch: (opts?: {
|
|
5
5
|
enabled?: boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nexineAxios } from '
|
|
1
|
+
import { nexineAxios } from '../../../util/nexine.axios';
|
|
2
2
|
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
3
3
|
async function fetchBankAccounts() {
|
|
4
4
|
const withTags = await nexineAxios.get('/customer/bank-account', {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import Link from 'next/link';
|
|
4
|
-
import { CartPromoCodeSection } from '
|
|
4
|
+
import { CartPromoCodeSection } from '../../../feature/cart/component/cart.promo.code.section';
|
|
5
5
|
const ShieldCheck = (props) => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: [_jsx("path", { d: "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z" }), _jsx("polyline", { points: "9 12 11 14 15 10" })] }));
|
|
6
6
|
export function CartOrderSummary({ cart, itemCount }) {
|
|
7
7
|
return (_jsx("aside", { className: "lg:col-span-4 lg:sticky lg:top-28 self-start w-full", children: _jsxs("div", { className: "p-4 bg-white border border-gray-100 rounded-2xl space-y-4", children: [_jsxs("div", { className: "pb-1", children: [_jsx("h2", { className: "text-sm font-medium text-gray-900 uppercase tracking-[0.1em]", children: "Sipari\u015F \u00D6zeti" }), _jsxs("p", { className: "text-[10px] font-bold text-gray-400 uppercase tracking-widest mt-0.5", children: [itemCount, " \u00DCr\u00FCn"] })] }), _jsxs("div", { className: "space-y-2.5", children: [_jsxs("div", { className: "flex justify-between items-center text-sm", children: [_jsx("span", { className: "text-gray-500", children: "Ara Toplam" }), _jsxs("span", { className: "font-bold text-gray-900", children: ["\u20BA", (Number(cart?.info?.payPrice?.total) || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 })] })] }), Number(cart?.info?.discount?.pay || 0) > 0 && (_jsxs("div", { className: "flex justify-between items-center text-sm", children: [_jsx("span", { className: "text-gray-500", children: "\u0130ndirim" }), _jsxs("span", { className: "font-bold text-green-600", children: ["-\u20BA", Number(cart?.info?.discount?.pay || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 })] })] })), Number(cart?.info?.promotion?.pay || 0) > 0 && (_jsxs("div", { className: "flex justify-between items-center text-sm", children: [_jsx("span", { className: "text-gray-500", children: "Promosyon" }), _jsxs("span", { className: "font-bold text-green-600", children: ["-\u20BA", Number(cart?.info?.promotion?.pay || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 })] })] })), _jsxs("div", { className: "flex justify-between items-center text-sm", children: [_jsx("span", { className: "text-gray-500", children: "KDV Dahil" }), _jsxs("span", { className: "font-bold text-gray-900", children: ["\u20BA", (Number(cart?.info?.payPrice?.tax) || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 })] })] })] }), _jsx("div", { className: "pt-3 border-t border-gray-100", children: _jsx(CartPromoCodeSection, { variant: "cart" }) }), _jsxs("div", { className: "pt-3 border-t border-gray-100 space-y-4", children: [_jsxs("div", { className: "flex justify-between items-end gap-3", children: [_jsx("span", { className: "text-sm font-bold text-gray-900", children: "Toplam" }), _jsxs("span", { className: "text-xl font-light text-gray-900", children: ["\u20BA", (Number(cart?.info?.payPrice?.pay) || 0).toLocaleString('tr-TR', { minimumFractionDigits: 2 })] })] }), _jsx(Link, { href: "/odeme", className: "block w-full bg-black text-white py-4 rounded-full text-center text-[11px] font-black uppercase tracking-[0.2em] hover:bg-[#CF0A2C] transition-all duration-300", children: "\u00D6demeye Ge\u00E7" }), _jsxs("div", { className: "flex items-center justify-center gap-2 text-[9px] font-bold text-gray-400 uppercase tracking-widest", children: [_jsx(ShieldCheck, { className: "w-3.5 h-3.5 shrink-0" }), "G\u00FCvenli \u00D6deme"] })] })] }) }));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useState } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
import { useCart } from '
|
|
6
|
-
import { usePromoCode } from '
|
|
7
|
-
import { Status } from '
|
|
4
|
+
import { useRaxon } from '../../../raxon.context';
|
|
5
|
+
import { useCart } from '../../../feature/cart/hook/use.cart';
|
|
6
|
+
import { usePromoCode } from '../../../feature/promo-code/hook/use.promo.code';
|
|
7
|
+
import { Status } from '../../../interface/prisma.interface';
|
|
8
8
|
const CheckCircle2 = (props) => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: [_jsx("path", { d: "M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10z" }), _jsx("polyline", { points: "9 11 12 14 22 4" })] }));
|
|
9
9
|
const Loader2 = (props) => (_jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: _jsx("path", { d: "M21 12a9 9 0 1 1-6.219-8.56" }) }));
|
|
10
10
|
const X = (props) => (_jsxs("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", ...props, children: [_jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }), _jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })] }));
|
|
@@ -12,7 +12,7 @@ function formatTRY(amount) {
|
|
|
12
12
|
return new Intl.NumberFormat('tr-TR', { style: 'currency', currency: 'TRY', maximumFractionDigits: 0 }).format(amount);
|
|
13
13
|
}
|
|
14
14
|
export function CartPromoCodeSection({ variant = 'cart' }) {
|
|
15
|
-
const { cart, promoCode, setPromoCode } =
|
|
15
|
+
const { cart, promoCode, setPromoCode } = useRaxon();
|
|
16
16
|
const { mutate: updateCart, isPending: isUpdatingCart } = useCart().update();
|
|
17
17
|
const { mutate: findPromoCode, isPending: isFindingPromoCode } = usePromoCode().findByCode();
|
|
18
18
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { CartItem } from '
|
|
2
|
-
import { BasketSummaryInterface } from '
|
|
3
|
-
import { IData } from '
|
|
1
|
+
import { BankTransferCode, CartItem } from '../../../interface/prisma.interface';
|
|
2
|
+
import { BasketSummaryInterface } from '../../../interface/basket.interface';
|
|
3
|
+
import { IData } from '../../../interface/nexine.interface';
|
|
4
4
|
export type BasketItemBulkInsertInput = {
|
|
5
5
|
id?: string;
|
|
6
6
|
productId?: string;
|
|
@@ -43,6 +43,10 @@ export declare const useCart: () => {
|
|
|
43
43
|
platform?: string;
|
|
44
44
|
webReturnUrl?: string;
|
|
45
45
|
}, unknown>;
|
|
46
|
+
createTransferCode: () => import("@tanstack/react-query").UseMutationResult<BankTransferCode, any, {
|
|
47
|
+
amount: number;
|
|
48
|
+
bankAccountId: string;
|
|
49
|
+
}, unknown>;
|
|
46
50
|
bulkInsert: () => import("@tanstack/react-query").UseMutationResult<import("axios").AxiosResponse<IData<CartItem[]>, any, {}>, any, BasketItemBulkInsertInput[], unknown>;
|
|
47
51
|
remove: () => import("@tanstack/react-query").UseMutationResult<import("axios").AxiosResponse<CartItem, any, {}>, Error, string, any>;
|
|
48
52
|
update: () => import("@tanstack/react-query").UseMutationResult<BasketSummaryInterface, any, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use.cart.d.ts","sourceRoot":"","sources":["../../../../../core/feature/cart/hook/use.cart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,QAAQ,EAAE,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"use.cart.d.ts","sourceRoot":"","sources":["../../../../../core/feature/cart/hook/use.cart.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAQ,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAGrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAE3E,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACv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GAAG,IAAI;qBACd,MAAM,GAAG,IAAI;0BACR,kBAAkB;yBACnB,kBAAkB;6BACd,MAAM,GAAG,IAAI;;;YAcL,MAAM;kBAAY,MAAM;oBAAc,MAAM;;CAqBlF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { nexineAxios } from '
|
|
1
|
+
import { nexineAxios } from '../../../util/nexine.axios';
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
3
|
-
import { globalEmitter, GLOBAL_EVENTS } from '
|
|
4
|
-
import { mergeCartWithOptimisticExtras, applyBasketInsertResponse, readCartCache, patchCartCache, CART_QUERY_KEY } from '
|
|
3
|
+
import { globalEmitter, GLOBAL_EVENTS } from '../../../util/util';
|
|
4
|
+
import { mergeCartWithOptimisticExtras, applyBasketInsertResponse, readCartCache, patchCartCache, CART_QUERY_KEY } from '../../../feature/cart/util/cart-optimistic';
|
|
5
5
|
export const useCart = () => {
|
|
6
6
|
const queryClient = useQueryClient();
|
|
7
7
|
const handleUnauthorizedError = (error) => {
|
|
@@ -97,6 +97,15 @@ export const useCart = () => {
|
|
|
97
97
|
onError: handleUnauthorizedError,
|
|
98
98
|
});
|
|
99
99
|
},
|
|
100
|
+
createTransferCode: () => {
|
|
101
|
+
return useMutation({
|
|
102
|
+
mutationFn: async (data) => {
|
|
103
|
+
const response = await nexineAxios.post('/customer/payment/bank-transfer', data);
|
|
104
|
+
return response.data.bankTransferCode;
|
|
105
|
+
},
|
|
106
|
+
onError: handleUnauthorizedError,
|
|
107
|
+
});
|
|
108
|
+
},
|
|
100
109
|
bulkInsert: () => {
|
|
101
110
|
return useMutation({
|
|
102
111
|
mutationFn: (data) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BasketItemSummaryInterface, BasketSummaryInterface } from '
|
|
1
|
+
import { BasketItemSummaryInterface, BasketSummaryInterface } from '../../../interface/basket.interface';
|
|
2
2
|
import type { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
export declare const CART_QUERY_KEY: readonly ["organization", "cart"];
|
|
4
4
|
export declare const CART_QUANTITY_DEBOUNCE_MS = 400;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SaleType } from '
|
|
1
|
+
import { SaleType } from '../../../interface/prisma.interface';
|
|
2
2
|
export const CART_QUERY_KEY = ['organization', 'cart'];
|
|
3
3
|
export const CART_QUANTITY_DEBOUNCE_MS = 400;
|
|
4
4
|
export function createEmptyOptimisticCart() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from "
|
|
2
|
-
import { Collection } from "
|
|
1
|
+
import { IData } from "../../../interface/nexine.interface";
|
|
2
|
+
import { Collection } from "../../../interface/prisma.interface";
|
|
3
3
|
export declare const useCollection: () => {
|
|
4
4
|
fetch: (params?: any) => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<Collection>>, Error>;
|
|
5
5
|
detail: (id: string) => import("@tanstack/react-query").UseQueryResult<NoInfer<Collection>, Error>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { nexineAxios } from '
|
|
1
|
+
import { nexineAxios } from '../../../util/nexine.axios';
|
|
2
2
|
import { useQuery } from '@tanstack/react-query';
|
|
3
|
-
import { getCheckoutDeliveryMethods } from '
|
|
3
|
+
import { getCheckoutDeliveryMethods } from '../../../feature/delivery-method/util/checkout.delivery.method';
|
|
4
4
|
async function fetchDeliveryMethods() {
|
|
5
5
|
const withTags = await nexineAxios.get('/customer/delivery/method', {
|
|
6
6
|
params: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeliveryMethod } from '
|
|
1
|
+
import { DeliveryMethod } from '../../../interface/prisma.interface';
|
|
2
2
|
export declare function isCashDeskDeliveryMethod(method: Pick<DeliveryMethod, 'name'>): boolean;
|
|
3
3
|
/** Web checkout'ta gösterilecek kargo yöntemleri (kasadan satış hariç). */
|
|
4
4
|
export declare function getCheckoutDeliveryMethods(methods: DeliveryMethod[]): DeliveryMethod[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from "
|
|
2
|
-
import { Faq } from "
|
|
1
|
+
import { IData } from "../../../interface/nexine.interface";
|
|
2
|
+
import { Faq } from "../../../interface/prisma.interface";
|
|
3
3
|
export declare const useFaq: () => {
|
|
4
4
|
fetch: (params: {
|
|
5
5
|
page: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IData } from "
|
|
2
|
-
import { Favorite } from "
|
|
1
|
+
import { IData } from "../../../interface/nexine.interface";
|
|
2
|
+
import { Favorite } from "../../../interface/prisma.interface";
|
|
3
3
|
import { UseQueryOptions } from "@tanstack/react-query";
|
|
4
4
|
export interface FavoriteListResponse extends IData<Favorite> {
|
|
5
5
|
info?: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nexineAxios } from "
|
|
1
|
+
import { nexineAxios } from "../../../util/nexine.axios";
|
|
2
2
|
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
3
|
import toast from "react-hot-toast";
|
|
4
4
|
export const useFavorite = () => {
|