@raxonltd/raxon-core 1.0.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.
- package/dist/core/component/general.image.d.ts +25 -0
- package/dist/core/component/general.image.d.ts.map +1 -0
- package/dist/core/component/general.image.js +30 -0
- package/dist/core/context/cart.context.d.ts +25 -0
- package/dist/core/context/cart.context.d.ts.map +1 -0
- package/dist/core/context/cart.context.js +339 -0
- package/dist/core/context/security.context.d.ts +15 -0
- package/dist/core/context/security.context.d.ts.map +1 -0
- package/dist/core/context/security.context.js +130 -0
- package/dist/core/feature/address/form/address-search-input.d.ts +17 -0
- package/dist/core/feature/address/form/address-search-input.d.ts.map +1 -0
- package/dist/core/feature/address/form/address-search-input.js +30 -0
- package/dist/core/feature/address/hook/use.addres.d.ts +10 -0
- package/dist/core/feature/address/hook/use.addres.d.ts.map +1 -0
- package/dist/core/feature/address/hook/use.addres.js +57 -0
- package/dist/core/feature/address/hook/use.address-autocomplete.d.ts +13 -0
- package/dist/core/feature/address/hook/use.address-autocomplete.d.ts.map +1 -0
- package/dist/core/feature/address/hook/use.address-autocomplete.js +105 -0
- package/dist/core/feature/address/util/address.types.d.ts +37 -0
- package/dist/core/feature/address/util/address.types.d.ts.map +1 -0
- package/dist/core/feature/address/util/address.types.js +1 -0
- package/dist/core/feature/address/util/parse-google-place.d.ts +13 -0
- package/dist/core/feature/address/util/parse-google-place.d.ts.map +1 -0
- package/dist/core/feature/address/util/parse-google-place.js +49 -0
- package/dist/core/feature/analytic-event/analytic.event.context.d.ts +19 -0
- package/dist/core/feature/analytic-event/analytic.event.context.d.ts.map +1 -0
- package/dist/core/feature/analytic-event/analytic.event.context.js +151 -0
- package/dist/core/feature/article/hook/use.article.d.ts +7 -0
- package/dist/core/feature/article/hook/use.article.d.ts.map +1 -0
- package/dist/core/feature/article/hook/use.article.js +28 -0
- package/dist/core/feature/attribute/hook/use.attribute.d.ts +10 -0
- package/dist/core/feature/attribute/hook/use.attribute.d.ts.map +1 -0
- package/dist/core/feature/attribute/hook/use.attribute.js +21 -0
- package/dist/core/feature/auth/hook/use.auth.d.ts +29 -0
- package/dist/core/feature/auth/hook/use.auth.d.ts.map +1 -0
- package/dist/core/feature/auth/hook/use.auth.js +122 -0
- package/dist/core/feature/auth/modal/modal.auth.d.ts +9 -0
- package/dist/core/feature/auth/modal/modal.auth.d.ts.map +1 -0
- package/dist/core/feature/auth/modal/modal.auth.js +34 -0
- package/dist/core/feature/auth/view/view.login.d.ts +8 -0
- package/dist/core/feature/auth/view/view.login.d.ts.map +1 -0
- package/dist/core/feature/auth/view/view.login.js +45 -0
- package/dist/core/feature/auth/view/view.register.d.ts +8 -0
- package/dist/core/feature/auth/view/view.register.d.ts.map +1 -0
- package/dist/core/feature/auth/view/view.register.js +83 -0
- package/dist/core/feature/bank-account/hook/use.bank.account.d.ts +12 -0
- package/dist/core/feature/bank-account/hook/use.bank.account.d.ts.map +1 -0
- package/dist/core/feature/bank-account/hook/use.bank.account.js +38 -0
- package/dist/core/feature/cart/component/cart.order.summary.d.ts +8 -0
- package/dist/core/feature/cart/component/cart.order.summary.d.ts.map +1 -0
- package/dist/core/feature/cart/component/cart.order.summary.js +8 -0
- package/dist/core/feature/cart/component/cart.promo.code.section.d.ts +6 -0
- package/dist/core/feature/cart/component/cart.promo.code.section.d.ts.map +1 -0
- package/dist/core/feature/cart/component/cart.promo.code.section.js +109 -0
- package/dist/core/feature/cart/hook/use.cart.d.ts +67 -0
- package/dist/core/feature/cart/hook/use.cart.d.ts.map +1 -0
- package/dist/core/feature/cart/hook/use.cart.js +196 -0
- package/dist/core/feature/cart/util/basket-pay.response.d.ts +20 -0
- package/dist/core/feature/cart/util/basket-pay.response.d.ts.map +1 -0
- package/dist/core/feature/cart/util/basket-pay.response.js +40 -0
- package/dist/core/feature/cart/util/cart-optimistic.d.ts +36 -0
- package/dist/core/feature/cart/util/cart-optimistic.d.ts.map +1 -0
- package/dist/core/feature/cart/util/cart-optimistic.js +320 -0
- package/dist/core/feature/cart/util/garanti-payment.d.ts +4 -0
- package/dist/core/feature/cart/util/garanti-payment.d.ts.map +1 -0
- package/dist/core/feature/cart/util/garanti-payment.js +26 -0
- package/dist/core/feature/collection/hook/use.collection.d.ts +7 -0
- package/dist/core/feature/collection/hook/use.collection.d.ts.map +1 -0
- package/dist/core/feature/collection/hook/use.collection.js +27 -0
- package/dist/core/feature/delivery-method/hook/use.delivery.method.d.ts +10 -0
- package/dist/core/feature/delivery-method/hook/use.delivery.method.d.ts.map +1 -0
- package/dist/core/feature/delivery-method/hook/use.delivery.method.js +33 -0
- package/dist/core/feature/delivery-method/util/checkout.delivery.method.d.ts +5 -0
- package/dist/core/feature/delivery-method/util/checkout.delivery.method.d.ts.map +1 -0
- package/dist/core/feature/delivery-method/util/checkout.delivery.method.js +8 -0
- package/dist/core/feature/faq/hook/use.faq.d.ts +9 -0
- package/dist/core/feature/faq/hook/use.faq.d.ts.map +1 -0
- package/dist/core/feature/faq/hook/use.faq.js +20 -0
- package/dist/core/feature/favorite/hook/use.favorite.d.ts +17 -0
- package/dist/core/feature/favorite/hook/use.favorite.d.ts.map +1 -0
- package/dist/core/feature/favorite/hook/use.favorite.js +35 -0
- package/dist/core/feature/form-submit/form/form.contact.d.ts +6 -0
- package/dist/core/feature/form-submit/form/form.contact.d.ts.map +1 -0
- package/dist/core/feature/form-submit/form/form.contact.js +8 -0
- package/dist/core/feature/form-submit/hook/use.form.submit.d.ts +4 -0
- package/dist/core/feature/form-submit/hook/use.form.submit.d.ts.map +1 -0
- package/dist/core/feature/form-submit/hook/use.form.submit.js +13 -0
- package/dist/core/feature/invoice/hook/use.invoice.d.ts +9 -0
- package/dist/core/feature/invoice/hook/use.invoice.d.ts.map +1 -0
- package/dist/core/feature/invoice/hook/use.invoice.js +46 -0
- package/dist/core/feature/newsletter/hook/use.newsletter.d.ts +13 -0
- package/dist/core/feature/newsletter/hook/use.newsletter.d.ts.map +1 -0
- package/dist/core/feature/newsletter/hook/use.newsletter.js +21 -0
- package/dist/core/feature/newsletter/modal/modal.newsletter.product.d.ts +27 -0
- package/dist/core/feature/newsletter/modal/modal.newsletter.product.d.ts.map +1 -0
- package/dist/core/feature/newsletter/modal/modal.newsletter.product.js +77 -0
- package/dist/core/feature/order/hook/use.order.d.ts +7 -0
- package/dist/core/feature/order/hook/use.order.d.ts.map +1 -0
- package/dist/core/feature/order/hook/use.order.js +26 -0
- package/dist/core/feature/payment-method/checkout.payment.options.d.ts +18 -0
- package/dist/core/feature/payment-method/checkout.payment.options.d.ts.map +1 -0
- package/dist/core/feature/payment-method/checkout.payment.options.js +74 -0
- package/dist/core/feature/payment-method/hook/use.payment.method.d.ts +8 -0
- package/dist/core/feature/payment-method/hook/use.payment.method.d.ts.map +1 -0
- package/dist/core/feature/payment-method/hook/use.payment.method.js +36 -0
- package/dist/core/feature/product/hook/use.product.d.ts +62 -0
- package/dist/core/feature/product/hook/use.product.d.ts.map +1 -0
- package/dist/core/feature/product/hook/use.product.js +60 -0
- package/dist/core/feature/profile/hook/use.profile.d.ts +26 -0
- package/dist/core/feature/profile/hook/use.profile.d.ts.map +1 -0
- package/dist/core/feature/profile/hook/use.profile.js +83 -0
- package/dist/core/feature/promo-code/hook/use.promo.code.d.ts +8 -0
- package/dist/core/feature/promo-code/hook/use.promo.code.d.ts.map +1 -0
- package/dist/core/feature/promo-code/hook/use.promo.code.js +24 -0
- package/dist/core/interface/basket.interface.d.ts +347 -0
- package/dist/core/interface/basket.interface.d.ts.map +1 -0
- package/dist/core/interface/basket.interface.js +1 -0
- package/dist/core/interface/inventory.interface.d.ts +87 -0
- package/dist/core/interface/inventory.interface.d.ts.map +1 -0
- package/dist/core/interface/inventory.interface.js +1 -0
- package/dist/core/interface/nexine.interface.d.ts +5 -0
- package/dist/core/interface/nexine.interface.d.ts.map +1 -0
- package/dist/core/interface/nexine.interface.js +1 -0
- package/dist/core/interface/prisma.interface.d.ts +8404 -0
- package/dist/core/interface/prisma.interface.d.ts.map +1 -0
- package/dist/core/interface/prisma.interface.js +1227 -0
- package/dist/core/interface/product.interface.d.ts +100 -0
- package/dist/core/interface/product.interface.d.ts.map +1 -0
- package/dist/core/interface/product.interface.js +1 -0
- package/dist/core/raxon.context.d.ts +44 -0
- package/dist/core/raxon.context.d.ts.map +1 -0
- package/dist/core/raxon.context.js +90 -0
- package/dist/core/schema/checkout.schema.d.ts +46 -0
- package/dist/core/schema/checkout.schema.d.ts.map +1 -0
- package/dist/core/schema/checkout.schema.js +83 -0
- package/dist/core/util/basket.item.display.d.ts +3 -0
- package/dist/core/util/basket.item.display.d.ts.map +1 -0
- package/dist/core/util/basket.item.display.js +18 -0
- package/dist/core/util/category.nav.d.ts +9 -0
- package/dist/core/util/category.nav.d.ts.map +1 -0
- package/dist/core/util/category.nav.js +37 -0
- package/dist/core/util/client-ip.d.ts +2 -0
- package/dist/core/util/client-ip.d.ts.map +1 -0
- package/dist/core/util/client-ip.js +32 -0
- package/dist/core/util/collection.util.d.ts +31 -0
- package/dist/core/util/collection.util.d.ts.map +1 -0
- package/dist/core/util/collection.util.js +167 -0
- package/dist/core/util/garanti-payment.d.ts +2 -0
- package/dist/core/util/garanti-payment.d.ts.map +1 -0
- package/dist/core/util/garanti-payment.js +1 -0
- package/dist/core/util/nexine.axios.d.ts +2 -0
- package/dist/core/util/nexine.axios.d.ts.map +1 -0
- package/dist/core/util/nexine.axios.js +62 -0
- package/dist/core/util/no-cache.d.ts +6 -0
- package/dist/core/util/no-cache.d.ts.map +1 -0
- package/dist/core/util/no-cache.js +6 -0
- package/dist/core/util/util.d.ts +18 -0
- package/dist/core/util/util.d.ts.map +1 -0
- package/dist/core/util/util.js +163 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { nexineAxios } from "@/core/util/nexine.axios";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
export const useInvoice = () => {
|
|
4
|
+
const queryClient = useQueryClient();
|
|
5
|
+
return {
|
|
6
|
+
fetch: () => {
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: ['web', 'invoice', 'list'],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
const response = await nexineAxios.get('/customer/invoice');
|
|
11
|
+
return response.data;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
detail: (id) => {
|
|
16
|
+
return useQuery({
|
|
17
|
+
queryKey: ['web', 'invoice', 'detail', id],
|
|
18
|
+
enabled: !!id && id !== "" && id !== "create",
|
|
19
|
+
queryFn: async () => {
|
|
20
|
+
const response = await nexineAxios.get(`/customer/invoice/${id}`);
|
|
21
|
+
return response.data;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
download: () => {
|
|
26
|
+
return useMutation({
|
|
27
|
+
mutationFn: async (id) => {
|
|
28
|
+
const response = await nexineAxios.get(`/customer/invoice/${id}/download`, {
|
|
29
|
+
responseType: 'blob',
|
|
30
|
+
});
|
|
31
|
+
return response.data;
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
downloadByOrder: () => {
|
|
36
|
+
return useMutation({
|
|
37
|
+
mutationFn: async (orderId) => {
|
|
38
|
+
const response = await nexineAxios.get(`/customer/invoice/order/${orderId}/download`, {
|
|
39
|
+
responseType: 'blob',
|
|
40
|
+
});
|
|
41
|
+
return response.data;
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Newsletter } from '@/core/interface/prisma.interface';
|
|
2
|
+
export declare const useNewsletter: () => {
|
|
3
|
+
subscribe: import("@tanstack/react-query").UseMutationResult<Newsletter, Error, {
|
|
4
|
+
email: string;
|
|
5
|
+
userId?: string;
|
|
6
|
+
}, unknown>;
|
|
7
|
+
subscribeByVariant: import("@tanstack/react-query").UseMutationResult<Newsletter, Error, {
|
|
8
|
+
variantId?: string;
|
|
9
|
+
productId?: string;
|
|
10
|
+
email: string;
|
|
11
|
+
}, unknown>;
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=use.newsletter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.newsletter.d.ts","sourceRoot":"","sources":["../../../../../core/feature/newsletter/hook/use.newsletter.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAG/D,eAAO,MAAM,aAAa;;eAEY,MAAM;iBAAW,MAAM;;;oBAOlB,MAAM;oBAAc,MAAM;eAAS,MAAM;;CAWnF,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { nexineAxios } from '@/core/util/nexine.axios';
|
|
2
|
+
import { useMutation } from '@tanstack/react-query';
|
|
3
|
+
export const useNewsletter = () => {
|
|
4
|
+
const subscribe = useMutation({
|
|
5
|
+
mutationFn: async (data) => {
|
|
6
|
+
const response = await nexineAxios.post('/customer/newsletter/subscribe', data);
|
|
7
|
+
return response.data;
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
const subscribeByVariant = useMutation({
|
|
11
|
+
mutationFn: async (data) => {
|
|
12
|
+
const response = await nexineAxios.post('/customer/newsletter/subscribe/variant', {
|
|
13
|
+
variantId: data.variantId,
|
|
14
|
+
productId: data.productId,
|
|
15
|
+
email: data.email,
|
|
16
|
+
});
|
|
17
|
+
return response.data;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
return { subscribe, subscribeByVariant };
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ProductDetail } from '@/core/interface/product.interface';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export interface ModalVariantArg {
|
|
4
|
+
id: string;
|
|
5
|
+
attributeOption1?: {
|
|
6
|
+
id?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
} | null;
|
|
10
|
+
attributeOption2?: {
|
|
11
|
+
id?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
name?: string;
|
|
14
|
+
} | null;
|
|
15
|
+
price?: {
|
|
16
|
+
mainPrice?: number;
|
|
17
|
+
discountPrice?: number;
|
|
18
|
+
} | null;
|
|
19
|
+
}
|
|
20
|
+
export interface ModalNewsletterVariantProductRef {
|
|
21
|
+
open: (product: ProductDetail, variant: ModalVariantArg | null) => void;
|
|
22
|
+
close: () => void;
|
|
23
|
+
}
|
|
24
|
+
export interface ModalNewsletterVariantProductProps {
|
|
25
|
+
}
|
|
26
|
+
export declare const ModalNewsletterVariantProduct: React.ForwardRefExoticComponent<ModalNewsletterVariantProductProps & React.RefAttributes<ModalNewsletterVariantProductRef>>;
|
|
27
|
+
//# sourceMappingURL=modal.newsletter.product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modal.newsletter.product.d.ts","sourceRoot":"","sources":["../../../../../core/feature/newsletter/modal/modal.newsletter.product.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAgD,MAAM,OAAO,CAAC;AAMrE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,gBAAgB,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzE,gBAAgB,CAAC,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzE,KAAK,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CAC/D;AAED,MAAM,WAAW,gCAAgC;IAC/C,IAAI,EAAE,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,KAAK,IAAI,CAAC;IACxE,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AAED,MAAM,WAAW,kCAAkC;CAAG;AAEtD,eAAO,MAAM,6BAA6B,6HA4IxC,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useSecurity } from '@/core/context/security.context';
|
|
3
|
+
import React, { useImperativeHandle, useRef, useState } from 'react';
|
|
4
|
+
import { Modal } from 'rizzui/modal';
|
|
5
|
+
import { Button } from 'rizzui/button';
|
|
6
|
+
import { Input } from 'rizzui/input';
|
|
7
|
+
import { useNewsletter } from '@/core/feature/newsletter/hook/use.newsletter';
|
|
8
|
+
export const ModalNewsletterVariantProduct = React.forwardRef((props, ref) => {
|
|
9
|
+
const callbackRef = useRef(null);
|
|
10
|
+
const { mutate: subscribeByVariant } = useNewsletter().subscribeByVariant;
|
|
11
|
+
const { profile } = useSecurity();
|
|
12
|
+
const [product, setProduct] = useState(null);
|
|
13
|
+
const [variant, setVariant] = useState(null);
|
|
14
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
15
|
+
const [email, setEmail] = useState('');
|
|
16
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
17
|
+
const onHandleSubscripeProduct = async () => {
|
|
18
|
+
if (!product)
|
|
19
|
+
return;
|
|
20
|
+
const emailToUse = profile?.email || email;
|
|
21
|
+
if (!emailToUse)
|
|
22
|
+
return;
|
|
23
|
+
setIsLoading(true);
|
|
24
|
+
try {
|
|
25
|
+
// Varyant varsa variantId, yoksa productId ile abone ol
|
|
26
|
+
if (variant?.id) {
|
|
27
|
+
await subscribeByVariant({
|
|
28
|
+
variantId: variant.id,
|
|
29
|
+
email: emailToUse,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
await subscribeByVariant({
|
|
34
|
+
productId: product.id,
|
|
35
|
+
email: emailToUse,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
setIsOpen(false);
|
|
39
|
+
setEmail('');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error('Newsletter subscription error:', error);
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
setIsLoading(false);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
useImperativeHandle(ref, () => ({
|
|
49
|
+
open: (product, variant) => {
|
|
50
|
+
setProduct(product);
|
|
51
|
+
setVariant(variant);
|
|
52
|
+
setIsOpen(true);
|
|
53
|
+
setEmail('');
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
callbackRef.current = { resolve, reject };
|
|
56
|
+
resolve(true);
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
close: () => {
|
|
60
|
+
setIsOpen(false);
|
|
61
|
+
setProduct(null);
|
|
62
|
+
setVariant(null);
|
|
63
|
+
setEmail('');
|
|
64
|
+
},
|
|
65
|
+
}));
|
|
66
|
+
return (_jsx(Modal, { isOpen: isOpen, onClose: () => {
|
|
67
|
+
setIsOpen(false);
|
|
68
|
+
setProduct(null);
|
|
69
|
+
setVariant(null);
|
|
70
|
+
setEmail('');
|
|
71
|
+
}, size: "md", children: _jsxs("div", { className: "p-6", children: [_jsxs("div", { className: "mb-6", children: [_jsx("h2", { className: "text-xl font-semibold mb-2", children: "\u00DCr\u00FCn Gelince Haber Ver" }), _jsx("p", { className: "text-gray-600", children: "Bu \u00FCr\u00FCn sto\u011Fa geldi\u011Finde size haber verelim" })] }), product && (_jsxs("div", { className: "mb-6 p-4 bg-gray-50 rounded-lg", children: [_jsx("p", { className: "font-medium mb-2", children: product.name }), variant && (_jsxs("p", { className: "text-sm text-gray-600 mb-1", children: ["Varyant: ", variant.attributeOption1?.label ?? variant.attributeOption1?.name, " ", variant.attributeOption2?.label ?? variant.attributeOption2?.name] })), (variant?.price || product.variant?.[0]?.price) && (_jsxs("p", { className: "text-sm font-medium text-green-600", children: ["\u20BA", (variant?.price?.discountPrice ?? variant?.price?.mainPrice ?? product.variant?.[0]?.price?.discountPrice ?? product.variant?.[0]?.price?.mainPrice ?? 0).toFixed(2)] }))] })), !profile?.email && (_jsx("div", { className: "mb-4", children: _jsx(Input, { label: "E-posta Adresiniz", type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "ornek@email.com", required: true }) })), profile?.email && (_jsx("div", { className: "mb-4", children: _jsxs("p", { className: "text-sm text-gray-600", children: ["Bildirim g\u00F6nderilecek e-posta: ", _jsx("span", { className: "font-medium", children: profile.email })] }) })), _jsxs("div", { className: "flex gap-3 justify-end", children: [_jsx(Button, { variant: "outline", onClick: () => {
|
|
72
|
+
setIsOpen(false);
|
|
73
|
+
setProduct(null);
|
|
74
|
+
setVariant(null);
|
|
75
|
+
setEmail('');
|
|
76
|
+
}, disabled: isLoading, children: "\u0130ptal" }), _jsx(Button, { onClick: onHandleSubscripeProduct, disabled: isLoading || (!profile?.email && !email), isLoading: isLoading, children: "Haber Ver" })] })] }) }));
|
|
77
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IData } from "@/core/interface/nexine.interface";
|
|
2
|
+
import { Order } from "@/core/interface/prisma.interface";
|
|
3
|
+
export declare const useOrder: () => {
|
|
4
|
+
fetch: () => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<Order>>, Error>;
|
|
5
|
+
detail: (id: string) => import("@tanstack/react-query").UseQueryResult<NoInfer<Order>, Error>;
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=use.order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.order.d.ts","sourceRoot":"","sources":["../../../../../core/feature/order/hook/use.order.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAW,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAGnE,eAAO,MAAM,QAAQ;;iBAcG,MAAM;CAW7B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { nexineAxios } from "@/core/util/nexine.axios";
|
|
2
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
export const useOrder = () => {
|
|
4
|
+
const queryClient = useQueryClient();
|
|
5
|
+
return {
|
|
6
|
+
fetch: () => {
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: ['web', 'order', 'list'],
|
|
9
|
+
queryFn: async () => {
|
|
10
|
+
var response = await nexineAxios.get(`/customer/order`);
|
|
11
|
+
return response.data;
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
detail: (id) => {
|
|
16
|
+
return useQuery({
|
|
17
|
+
queryKey: ['web', 'order', 'detail', id],
|
|
18
|
+
enabled: !!id && id !== "" && id != "create",
|
|
19
|
+
queryFn: async () => {
|
|
20
|
+
var response = await nexineAxios.get(`/customer/order/${id}`);
|
|
21
|
+
return response.data;
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PaymentMethod } from '../../interface/prisma.interface';
|
|
2
|
+
import { PaymentUiType } from '@/core/schema/checkout.schema';
|
|
3
|
+
export interface CheckoutPaymentOption {
|
|
4
|
+
key: PaymentUiType;
|
|
5
|
+
label: string;
|
|
6
|
+
paymentMethodId: string | null;
|
|
7
|
+
method?: PaymentMethod;
|
|
8
|
+
/** Checkout UI'da seçilebilir (her zaman true) */
|
|
9
|
+
available: boolean;
|
|
10
|
+
/** Backend'de karşılık gelen ödeme yöntemi tanımlı mı */
|
|
11
|
+
configured: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare function findGarantiPaymentMethod(methods: PaymentMethod[]): PaymentMethod | undefined;
|
|
14
|
+
/** Checkout'ta gösterilecek ödeme seçenekleri (Kredi Kartı, Havale, GarantiPay). */
|
|
15
|
+
export declare function buildCheckoutPaymentOptions(methods: PaymentMethod[]): CheckoutPaymentOption[];
|
|
16
|
+
export declare function resolveCheckoutPaymentMethodId(options: CheckoutPaymentOption[], selectedKey: PaymentUiType, allMethods: PaymentMethod[]): string | null;
|
|
17
|
+
export declare const DEFAULT_CHECKOUT_PAYMENT_KEY: PaymentUiType;
|
|
18
|
+
//# sourceMappingURL=checkout.payment.options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.payment.options.d.ts","sourceRoot":"","sources":["../../../../core/feature/payment-method/checkout.payment.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAmB,MAAM,kCAAkC,CAAC;AAClF,OAAO,EAAE,aAAa,EAAoB,MAAM,+BAA+B,CAAC;AAEhF,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,aAAa,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,aAAa,GAAG,SAAS,CAO5F;AAoCD,oFAAoF;AACpF,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,aAAa,EAAE,GAAG,qBAAqB,EAAE,CA4C7F;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,qBAAqB,EAAE,EAChC,WAAW,EAAE,aAAa,EAC1B,UAAU,EAAE,aAAa,EAAE,GAC1B,MAAM,GAAG,IAAI,CAMf;AAED,eAAO,MAAM,4BAA4B,EAAE,aAA6B,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { PaymentProvider } from '../../interface/prisma.interface';
|
|
2
|
+
import { getPaymentUiType } from '@/core/schema/checkout.schema';
|
|
3
|
+
export function findGarantiPaymentMethod(methods) {
|
|
4
|
+
return methods.find((m) => m.provider === PaymentProvider.GARANTI ||
|
|
5
|
+
/garanti/i.test(m.name) ||
|
|
6
|
+
/garanti/i.test(m.provider || ''));
|
|
7
|
+
}
|
|
8
|
+
const CHECKOUT_SLOTS = [
|
|
9
|
+
{ key: 'credit_card', label: 'Kredi Kartı' },
|
|
10
|
+
{ key: 'bank_transfer', label: 'Havale' },
|
|
11
|
+
{ key: 'garanti', label: 'GarantiPay' },
|
|
12
|
+
];
|
|
13
|
+
function resolveMethodForType(methods, type) {
|
|
14
|
+
const byUi = methods.find((m) => getPaymentUiType(m.name, m.provider) === type);
|
|
15
|
+
if (byUi)
|
|
16
|
+
return byUi;
|
|
17
|
+
if (type === 'credit_card') {
|
|
18
|
+
return methods.find((m) => m.provider === PaymentProvider.PAYTR ||
|
|
19
|
+
m.provider === PaymentProvider.STRIPE ||
|
|
20
|
+
/kredi|kart|card/i.test(m.name));
|
|
21
|
+
}
|
|
22
|
+
if (type === 'bank_transfer') {
|
|
23
|
+
return methods.find((m) => m.provider === PaymentProvider.BANK_TRANSFER ||
|
|
24
|
+
/havale|eft|peşin|pesin|transfer/i.test(m.name));
|
|
25
|
+
}
|
|
26
|
+
if (type === 'garanti') {
|
|
27
|
+
return findGarantiPaymentMethod(methods);
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
/** Checkout'ta gösterilecek ödeme seçenekleri (Kredi Kartı, Havale, GarantiPay). */
|
|
32
|
+
export function buildCheckoutPaymentOptions(methods) {
|
|
33
|
+
const slots = CHECKOUT_SLOTS;
|
|
34
|
+
const usedIds = new Set();
|
|
35
|
+
const options = slots.map((slot) => {
|
|
36
|
+
const method = resolveMethodForType(methods.filter((m) => !usedIds.has(m.id)), slot.key);
|
|
37
|
+
if (method)
|
|
38
|
+
usedIds.add(method.id);
|
|
39
|
+
const configured = slot.key === 'garanti'
|
|
40
|
+
? Boolean(method && method.provider === PaymentProvider.GARANTI)
|
|
41
|
+
: Boolean(method);
|
|
42
|
+
return {
|
|
43
|
+
key: slot.key,
|
|
44
|
+
label: slot.label,
|
|
45
|
+
paymentMethodId: method?.id ?? null,
|
|
46
|
+
method,
|
|
47
|
+
available: true,
|
|
48
|
+
configured,
|
|
49
|
+
};
|
|
50
|
+
});
|
|
51
|
+
// Eşleşmeyen yöntemleri yalnızca uyumlu boş slotlara ata (Garanti slotuna Cari vb. gitmesin)
|
|
52
|
+
const unused = methods.filter((m) => !usedIds.has(m.id));
|
|
53
|
+
unused.forEach((method) => {
|
|
54
|
+
const slotType = getPaymentUiType(method.name, method.provider);
|
|
55
|
+
const matchingSlot = options.find((o) => !o.paymentMethodId && o.key === slotType && slotType !== 'other');
|
|
56
|
+
if (!matchingSlot)
|
|
57
|
+
return;
|
|
58
|
+
matchingSlot.paymentMethodId = method.id;
|
|
59
|
+
matchingSlot.method = method;
|
|
60
|
+
matchingSlot.configured =
|
|
61
|
+
matchingSlot.key === 'garanti'
|
|
62
|
+
? method.provider === PaymentProvider.GARANTI
|
|
63
|
+
: true;
|
|
64
|
+
});
|
|
65
|
+
return options;
|
|
66
|
+
}
|
|
67
|
+
export function resolveCheckoutPaymentMethodId(options, selectedKey, allMethods) {
|
|
68
|
+
const selected = options.find((o) => o.key === selectedKey);
|
|
69
|
+
if (selected?.paymentMethodId)
|
|
70
|
+
return selected.paymentMethodId;
|
|
71
|
+
const fallback = resolveMethodForType(allMethods, selectedKey);
|
|
72
|
+
return fallback?.id ?? null;
|
|
73
|
+
}
|
|
74
|
+
export const DEFAULT_CHECKOUT_PAYMENT_KEY = 'credit_card';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IData } from '@/core/interface/nexine.interface';
|
|
2
|
+
import { PaymentMethod } from '@/core/interface/prisma.interface';
|
|
3
|
+
export declare const usePaymentMethod: () => {
|
|
4
|
+
fetch: (opts?: {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<PaymentMethod>>, Error>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=use.payment.method.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.payment.method.d.ts","sourceRoot":"","sources":["../../../../../core/feature/payment-method/hook/use.payment.method.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AA+BlE,eAAO,MAAM,gBAAgB;mBAEV;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;CAQvC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { nexineAxios } from '@/core/util/nexine.axios';
|
|
2
|
+
import { useQuery } from '@tanstack/react-query';
|
|
3
|
+
async function fetchPaymentMethods() {
|
|
4
|
+
const baseParams = { isCompanySpecificVisible: true };
|
|
5
|
+
const [withTags, withoutTags] = await Promise.all([
|
|
6
|
+
nexineAxios.get('/customer/payment/method', {
|
|
7
|
+
params: { ...baseParams, tags: ['WEB'] },
|
|
8
|
+
}),
|
|
9
|
+
nexineAxios.get('/customer/payment/method', {
|
|
10
|
+
params: baseParams,
|
|
11
|
+
}),
|
|
12
|
+
]);
|
|
13
|
+
const tagged = withTags.data?.data ?? [];
|
|
14
|
+
const all = withoutTags.data?.data ?? [];
|
|
15
|
+
if (tagged.length === 0)
|
|
16
|
+
return withoutTags.data;
|
|
17
|
+
// WEB etiketli GarantiPay ile etiketsiz diğer yöntemleri birleştir
|
|
18
|
+
const merged = new Map();
|
|
19
|
+
all.forEach((method) => merged.set(method.id, method));
|
|
20
|
+
tagged.forEach((method) => merged.set(method.id, method));
|
|
21
|
+
return {
|
|
22
|
+
...withoutTags.data,
|
|
23
|
+
data: Array.from(merged.values()),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const usePaymentMethod = () => {
|
|
27
|
+
return {
|
|
28
|
+
fetch: (opts) => {
|
|
29
|
+
return useQuery({
|
|
30
|
+
queryKey: ['payment-method'],
|
|
31
|
+
queryFn: fetchPaymentMethods,
|
|
32
|
+
enabled: opts?.enabled !== false,
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { IData } from "@/core/interface/nexine.interface";
|
|
2
|
+
import { Status } from "@/core/interface/prisma.interface";
|
|
3
|
+
import { Product as CustomProduct, ProductDetail } from "@/core/interface/product.interface";
|
|
4
|
+
export declare const PRODUCT_PAGE_SIZE = 24;
|
|
5
|
+
export interface ProductListResponse {
|
|
6
|
+
data: CustomProduct[];
|
|
7
|
+
count: number;
|
|
8
|
+
hasNextPage: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ProductListFetchParams {
|
|
11
|
+
categoryId?: string | null;
|
|
12
|
+
tags?: string[];
|
|
13
|
+
orderBy?: "createdAt" | "reviewCount" | "avgRating";
|
|
14
|
+
orderDirection?: "asc" | "desc";
|
|
15
|
+
search?: string | null;
|
|
16
|
+
page: number;
|
|
17
|
+
amount?: number;
|
|
18
|
+
materialType?: string;
|
|
19
|
+
status?: Status;
|
|
20
|
+
outOfStock?: boolean;
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
/** Varyant özellik seçenekleri (API destekliyorsa sunucu tarafı filtre) */
|
|
23
|
+
attributeOptionIds?: string[];
|
|
24
|
+
}
|
|
25
|
+
interface ProductFetchParams {
|
|
26
|
+
tags?: string[];
|
|
27
|
+
materialType?: string;
|
|
28
|
+
categoryId?: string;
|
|
29
|
+
subCategoryId?: string;
|
|
30
|
+
sortBy?: string;
|
|
31
|
+
order?: {
|
|
32
|
+
column: string;
|
|
33
|
+
direction: 'asc' | 'desc';
|
|
34
|
+
} | undefined;
|
|
35
|
+
bestCartItem?: boolean;
|
|
36
|
+
page?: number;
|
|
37
|
+
enabled?: boolean;
|
|
38
|
+
amount?: number;
|
|
39
|
+
status?: Status;
|
|
40
|
+
outOfStock?: boolean;
|
|
41
|
+
collectionId?: string;
|
|
42
|
+
attributeOptionId?: string[];
|
|
43
|
+
variantCount?: number;
|
|
44
|
+
search?: string;
|
|
45
|
+
isFavorite?: boolean;
|
|
46
|
+
/** Sunucu bu alanları destekliyorsa uygulanır */
|
|
47
|
+
minPrice?: number;
|
|
48
|
+
maxPrice?: number;
|
|
49
|
+
brandId?: string[];
|
|
50
|
+
campaignId?: string;
|
|
51
|
+
isLimitedTimeOffer?: boolean;
|
|
52
|
+
isDiscountBasket?: boolean;
|
|
53
|
+
isLimitedStock?: boolean;
|
|
54
|
+
}
|
|
55
|
+
export declare const useProduct: () => {
|
|
56
|
+
fetch: (params: ProductFetchParams) => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<CustomProduct>>, Error>;
|
|
57
|
+
searchData: (search: string) => import("@tanstack/react-query").UseQueryResult<NoInfer<IData<CustomProduct>>, Error>;
|
|
58
|
+
related: (productId: string) => import("@tanstack/react-query").UseQueryResult<NoInfer<CustomProduct[]>, Error>;
|
|
59
|
+
detail: (slug: string) => import("@tanstack/react-query").UseQueryResult<NoInfer<ProductDetail>, Error>;
|
|
60
|
+
};
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=use.product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.product.d.ts","sourceRoot":"","sources":["../../../../../core/feature/product/hook/use.product.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,mCAAmC,CAAC;AAC1D,OAAO,EAAW,MAAM,EAAW,MAAM,mCAAmC,CAAC;AAG7E,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAG7F,eAAO,MAAM,iBAAiB,KAAK,CAAC;AAEpC,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,aAAa,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,GAAG,aAAa,GAAG,WAAW,CAAC;IACpD,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,2EAA2E;IAC3E,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAGD,UAAU,kBAAkB;IAC1B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAG;QACP,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,KAAK,GAAG,MAAM,CAAC;KAC3B,GAAG,SAAS,CAAC;IAGd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iDAAiD;IACjD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,UAAU;oBAEH,kBAAkB;yBAab,MAAM;yBAgBN,MAAM;mBASZ,MAAM;CAcxB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { nexineAxios } from "@/core/util/nexine.axios";
|
|
2
|
+
import { Status } from "@/core/interface/prisma.interface";
|
|
3
|
+
import { useQuery } from "@tanstack/react-query";
|
|
4
|
+
const SEARCH_PAGE_SIZE = 12;
|
|
5
|
+
export const PRODUCT_PAGE_SIZE = 24;
|
|
6
|
+
export const useProduct = () => {
|
|
7
|
+
return {
|
|
8
|
+
fetch: (params) => {
|
|
9
|
+
const finalCategoryId = params.subCategoryId || params.categoryId;
|
|
10
|
+
return useQuery({
|
|
11
|
+
queryKey: ['product', 'list', params],
|
|
12
|
+
enabled: params.enabled ?? true,
|
|
13
|
+
queryFn: async () => {
|
|
14
|
+
const response = await nexineAxios.get("/customer/product", {
|
|
15
|
+
params: params
|
|
16
|
+
});
|
|
17
|
+
return response.data;
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
searchData: (search) => {
|
|
22
|
+
return useQuery({
|
|
23
|
+
queryKey: ["product", "search", search],
|
|
24
|
+
enabled: search != undefined && search != "" && search.length > 2,
|
|
25
|
+
queryFn: async () => {
|
|
26
|
+
var data = await nexineAxios.get("/customer/product", {
|
|
27
|
+
params: {
|
|
28
|
+
materialType: "product",
|
|
29
|
+
search: search,
|
|
30
|
+
amount: 12
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return data.data;
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
related: (productId) => {
|
|
38
|
+
return useQuery({
|
|
39
|
+
queryKey: ["product", "related", productId],
|
|
40
|
+
queryFn: async () => {
|
|
41
|
+
var data = await nexineAxios.get(`/customer/product/${productId}/related`);
|
|
42
|
+
return data.data;
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
detail: (slug) => {
|
|
47
|
+
return useQuery({
|
|
48
|
+
queryKey: ["product", slug],
|
|
49
|
+
queryFn: async () => {
|
|
50
|
+
var data = await nexineAxios.get(`/customer/product/${slug}`, {
|
|
51
|
+
params: {
|
|
52
|
+
status: Status.PUBLISHED,
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return data.data;
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Company, Media, User } from "@/core/interface/prisma.interface";
|
|
2
|
+
export interface CompanyProfileData {
|
|
3
|
+
hasCompany: boolean;
|
|
4
|
+
canApply: boolean;
|
|
5
|
+
company: Company | null;
|
|
6
|
+
}
|
|
7
|
+
export declare const useProfile: () => {
|
|
8
|
+
fetch: ({ isEnabled }: {
|
|
9
|
+
isEnabled?: boolean;
|
|
10
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<User>, Error>;
|
|
11
|
+
update: () => import("@tanstack/react-query").UseMutationResult<import("axios").AxiosResponse<any, any, {}>, Error, any, unknown>;
|
|
12
|
+
verifyPhoneNumber: () => import("@tanstack/react-query").UseMutationResult<import("axios").AxiosResponse<any, any, {}>, Error, {
|
|
13
|
+
phoneNumber: string;
|
|
14
|
+
code?: string;
|
|
15
|
+
}, unknown>;
|
|
16
|
+
verifyEmail: () => import("@tanstack/react-query").UseMutationResult<import("axios").AxiosResponse<any, any, {}>, Error, {
|
|
17
|
+
email: string;
|
|
18
|
+
code?: string;
|
|
19
|
+
}, unknown>;
|
|
20
|
+
fetchCompany: ({ enabled }?: {
|
|
21
|
+
enabled?: boolean;
|
|
22
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<CompanyProfileData>, Error>;
|
|
23
|
+
applyCompany: () => import("@tanstack/react-query").UseMutationResult<import("axios").AxiosResponse<any, any, {}>, Error, any, unknown>;
|
|
24
|
+
uploadCompanyDocument: () => import("@tanstack/react-query").UseMutationResult<Media, Error, File, unknown>;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=use.profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.profile.d.ts","sourceRoot":"","sources":["../../../../../core/feature/profile/hook/use.profile.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,mCAAmC,CAAC;AAGzE,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,UAAU;;;;;;qBAuByB,MAAM;eAAS,MAAM;;;eAO3B,MAAM;eAAS,MAAM;;iCAKxB;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;;;CA6C3D,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { nexineAxios } from "@/core/util/nexine.axios";
|
|
2
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
3
|
+
export const useProfile = () => {
|
|
4
|
+
const queryClient = useQueryClient();
|
|
5
|
+
return {
|
|
6
|
+
fetch: ({ isEnabled = false }) => {
|
|
7
|
+
return useQuery({
|
|
8
|
+
queryKey: ["profile"],
|
|
9
|
+
enabled: isEnabled,
|
|
10
|
+
queryFn: async () => {
|
|
11
|
+
var response = await nexineAxios.get("/customer/profile");
|
|
12
|
+
return response.data;
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
update: () => {
|
|
17
|
+
return useMutation({
|
|
18
|
+
mutationFn: async (data) => {
|
|
19
|
+
return await nexineAxios.put("/customer/profile", data);
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
verifyPhoneNumber: () => {
|
|
24
|
+
return useMutation({
|
|
25
|
+
mutationFn: async (data) => {
|
|
26
|
+
return await nexineAxios.post("/customer/profile/verify/phone", data);
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
verifyEmail: () => {
|
|
31
|
+
return useMutation({
|
|
32
|
+
mutationFn: async (data) => {
|
|
33
|
+
return await nexineAxios.post("/customer/profile/verify/email", data);
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
fetchCompany: ({ enabled = true } = {}) => {
|
|
38
|
+
return useQuery({
|
|
39
|
+
queryKey: ["company-profile"],
|
|
40
|
+
enabled,
|
|
41
|
+
retry: false,
|
|
42
|
+
queryFn: async () => {
|
|
43
|
+
try {
|
|
44
|
+
var response = await nexineAxios.get("/customer/profile/company");
|
|
45
|
+
return response.data;
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
if (error?.response?.status === 404) {
|
|
49
|
+
return {
|
|
50
|
+
hasCompany: false,
|
|
51
|
+
canApply: true,
|
|
52
|
+
company: null,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
},
|
|
60
|
+
applyCompany: () => {
|
|
61
|
+
return useMutation({
|
|
62
|
+
mutationFn: async (data) => {
|
|
63
|
+
return await nexineAxios.post("/customer/profile/company", data);
|
|
64
|
+
},
|
|
65
|
+
onSuccess: () => {
|
|
66
|
+
queryClient.invalidateQueries({ queryKey: ["company-profile"] });
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
},
|
|
70
|
+
uploadCompanyDocument: () => {
|
|
71
|
+
return useMutation({
|
|
72
|
+
mutationFn: async (file) => {
|
|
73
|
+
const formData = new FormData();
|
|
74
|
+
formData.append("file", file);
|
|
75
|
+
var response = await nexineAxios.post("/customer/profile/company/document", formData, {
|
|
76
|
+
headers: { "Content-Type": "multipart/form-data" },
|
|
77
|
+
});
|
|
78
|
+
return response.data;
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PromoCode } from '@/core/interface/prisma.interface';
|
|
2
|
+
export declare const usePromoCode: () => {
|
|
3
|
+
fetch: (params?: {
|
|
4
|
+
status?: string;
|
|
5
|
+
}) => import("@tanstack/react-query").UseQueryResult<NoInfer<PromoCode[]>, Error>;
|
|
6
|
+
findByCode: () => import("@tanstack/react-query").UseMutationResult<PromoCode, Error, string, unknown>;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=use.promo.code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use.promo.code.d.ts","sourceRoot":"","sources":["../../../../../core/feature/promo-code/hook/use.promo.code.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAG9D,eAAO,MAAM,YAAY;qBAEJ;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;;CAmBvC,CAAC"}
|