@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,100 @@
|
|
|
1
|
+
import { ProductContent, ProductType, Property, SaleType, WeightType } from './prisma.interface';
|
|
2
|
+
export interface Price {
|
|
3
|
+
mainPrice: number;
|
|
4
|
+
discountPrice: number;
|
|
5
|
+
taxAmount?: number;
|
|
6
|
+
depositAmount?: number;
|
|
7
|
+
basketPrice?: number;
|
|
8
|
+
payPrice?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface Product {
|
|
11
|
+
id: string;
|
|
12
|
+
name: string;
|
|
13
|
+
saleType: SaleType;
|
|
14
|
+
createdAt?: string;
|
|
15
|
+
updatedAt?: string;
|
|
16
|
+
type: ProductType;
|
|
17
|
+
slug: string;
|
|
18
|
+
stock?: number;
|
|
19
|
+
sku?: string;
|
|
20
|
+
productContent?: ProductContent;
|
|
21
|
+
articleNumber?: string;
|
|
22
|
+
tags?: string[];
|
|
23
|
+
currentStock?: number;
|
|
24
|
+
icon?: string;
|
|
25
|
+
shortDescription?: string;
|
|
26
|
+
brand?: string;
|
|
27
|
+
weightType: WeightType;
|
|
28
|
+
weightValue: number;
|
|
29
|
+
barcode?: string;
|
|
30
|
+
dynamicContent?: any;
|
|
31
|
+
isFavorite?: boolean;
|
|
32
|
+
status?: 'PUBLISHED' | 'OUT_OF_STOCK' | 'UNKNOWN';
|
|
33
|
+
price?: Price;
|
|
34
|
+
review: {
|
|
35
|
+
count: number;
|
|
36
|
+
rating: number;
|
|
37
|
+
};
|
|
38
|
+
images: {
|
|
39
|
+
relativePath: string;
|
|
40
|
+
variantIds: string[];
|
|
41
|
+
attributeOptionId: string;
|
|
42
|
+
id: string;
|
|
43
|
+
}[];
|
|
44
|
+
categories: {
|
|
45
|
+
id: string;
|
|
46
|
+
name: string;
|
|
47
|
+
slug: string;
|
|
48
|
+
}[];
|
|
49
|
+
variant: {
|
|
50
|
+
id: string;
|
|
51
|
+
price: Price;
|
|
52
|
+
stock: number;
|
|
53
|
+
attributeOption1: {
|
|
54
|
+
id: string;
|
|
55
|
+
label: string;
|
|
56
|
+
value?: string | null;
|
|
57
|
+
icon?: string | null;
|
|
58
|
+
attributeId?: string | null;
|
|
59
|
+
};
|
|
60
|
+
attributeOption2: {
|
|
61
|
+
id: string;
|
|
62
|
+
label: string;
|
|
63
|
+
value?: string | null;
|
|
64
|
+
icon?: string | null;
|
|
65
|
+
attributeId?: string | null;
|
|
66
|
+
};
|
|
67
|
+
}[];
|
|
68
|
+
}
|
|
69
|
+
export interface ProductDetail extends Product {
|
|
70
|
+
baseUnit: string;
|
|
71
|
+
productUnits: {
|
|
72
|
+
id: string;
|
|
73
|
+
unit: string;
|
|
74
|
+
quantityPerUnitOfMeasure: number;
|
|
75
|
+
}[];
|
|
76
|
+
richContent: string;
|
|
77
|
+
description: string;
|
|
78
|
+
saleUnit: string;
|
|
79
|
+
property: Property[];
|
|
80
|
+
purchaseUnit: string;
|
|
81
|
+
shortDescription: string;
|
|
82
|
+
productContent: ProductContent;
|
|
83
|
+
matrix?: ProductPriceMatrixResponse[] | null;
|
|
84
|
+
}
|
|
85
|
+
export interface ProductPriceMatrixResponse {
|
|
86
|
+
supplier: {
|
|
87
|
+
id: string;
|
|
88
|
+
name: string;
|
|
89
|
+
} | null;
|
|
90
|
+
unit: {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
} | null;
|
|
94
|
+
price: {
|
|
95
|
+
mainPrice: number;
|
|
96
|
+
discountPrice: number;
|
|
97
|
+
minimumQuantity: number;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=product.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.interface.d.ts","sourceRoot":"","sources":["../../../core/interface/product.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG/F,MAAM,WAAW,KAAK;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,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,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;IACT,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;KACd,GAAG,IAAI,CAAC;IACT,KAAK,EAAE;QACL,SAAS,EAAE,MAAM,CAAC;QAClB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;KACzB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Article, BankAccount, Branch, Brand, Campaign, Category, Collection, DeliveryMethod, DynamicData, Faq, Feed, Holiday, Material, PaymentMethod, Review } from '@/core/interface/prisma.interface';
|
|
2
|
+
import { Product as CustomProduct } from '@/core/interface/product.interface';
|
|
3
|
+
import { ModalAuthRef } from '@/core/feature/auth/modal/modal.auth';
|
|
4
|
+
import { ModalNewsletterVariantProductRef } from '@/core/feature/newsletter/modal/modal.newsletter.product';
|
|
5
|
+
export declare const RaxonContext: import("react").Context<any>;
|
|
6
|
+
interface RaxonData {
|
|
7
|
+
campaign: Campaign[];
|
|
8
|
+
basketCampaign: Campaign[];
|
|
9
|
+
branch: Branch | null;
|
|
10
|
+
banner: Collection[];
|
|
11
|
+
collection: Collection[];
|
|
12
|
+
subHeroCollection: Collection[];
|
|
13
|
+
category: Category[];
|
|
14
|
+
flatCategory: Category[];
|
|
15
|
+
review: Review[];
|
|
16
|
+
article: Article[];
|
|
17
|
+
faq: Faq[];
|
|
18
|
+
feed: Feed[];
|
|
19
|
+
material: Material[];
|
|
20
|
+
holiday: Holiday[];
|
|
21
|
+
product: CustomProduct[];
|
|
22
|
+
bankAccount: BankAccount[];
|
|
23
|
+
bestSeller: CustomProduct[];
|
|
24
|
+
dynamicData: DynamicData[];
|
|
25
|
+
deliveryMethod: DeliveryMethod[];
|
|
26
|
+
paymentMethod: PaymentMethod[];
|
|
27
|
+
defaultDeliveryMethod: DeliveryMethod | null;
|
|
28
|
+
brand: Brand[];
|
|
29
|
+
isAuthenticated: boolean;
|
|
30
|
+
isGuest: boolean;
|
|
31
|
+
modalAuthRef: React.RefObject<ModalAuthRef | null>;
|
|
32
|
+
modalNewsletterVariantProductRef: React.RefObject<ModalNewsletterVariantProductRef | null>;
|
|
33
|
+
}
|
|
34
|
+
interface RaxonContextType extends RaxonData {
|
|
35
|
+
isLoading: boolean;
|
|
36
|
+
}
|
|
37
|
+
export declare const RaxonProvider: ({ children, apiKey, apiUrl }: {
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
apiKey: string;
|
|
40
|
+
apiUrl: string;
|
|
41
|
+
}) => import("react").JSX.Element;
|
|
42
|
+
export declare const useRaxon: () => RaxonContextType;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=raxon.context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raxon.context.d.ts","sourceRoot":"","sources":["../../core/raxon.context.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAgB,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAW,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAGjO,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAa,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAiC,gCAAgC,EAAE,MAAM,0DAA0D,CAAC;AAK3I,eAAO,MAAM,YAAY,8BAA4C,CAAC;AAEtE,UAAU,SAAS;IACjB,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,cAAc,EAAE,QAAQ,EAAE,CAAC;IAC3B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,MAAM,EAAE,UAAU,EAAE,CA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as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { CampaignType } from '@/core/interface/prisma.interface';
|
|
4
|
+
import { createContext, useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
5
|
+
import { nexineAxios } from '@/core/util/nexine.axios';
|
|
6
|
+
import { ModalAuth } from '@/core/feature/auth/modal/modal.auth';
|
|
7
|
+
import { ModalNewsletterVariantProduct } from '@/core/feature/newsletter/modal/modal.newsletter.product';
|
|
8
|
+
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
9
|
+
import { SecurityProvider } from '@/core/context/security.context';
|
|
10
|
+
import { CartProvider } from '@/core/context/cart.context';
|
|
11
|
+
export const RaxonContext = createContext(undefined);
|
|
12
|
+
export const RaxonProvider = ({ children, apiKey, apiUrl }) => {
|
|
13
|
+
const [raxon, setRaxon] = useState(null);
|
|
14
|
+
const [isLoading, setIsLoading] = useState(true);
|
|
15
|
+
const [hasFetched, setHasFetched] = useState(false);
|
|
16
|
+
const [queryClient] = useState(() => new QueryClient());
|
|
17
|
+
const modalAuthRef = useRef(null);
|
|
18
|
+
const modalNewsletterVariantProductRef = useRef(null);
|
|
19
|
+
// Configure axios with provided apiKey and apiUrl
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
if (typeof window !== 'undefined') {
|
|
22
|
+
window.__RAXON_API_KEY__ = apiKey;
|
|
23
|
+
window.__RAXON_API_URL__ = apiUrl;
|
|
24
|
+
nexineAxios.defaults.baseURL = apiUrl;
|
|
25
|
+
nexineAxios.defaults.headers.common['x-api-key'] = apiKey;
|
|
26
|
+
}
|
|
27
|
+
}, [apiKey, apiUrl]);
|
|
28
|
+
// Fetch data once on mount
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (hasFetched || !apiUrl)
|
|
31
|
+
return;
|
|
32
|
+
setHasFetched(true);
|
|
33
|
+
fetch(`${apiUrl}/customer/bootstrap`, {
|
|
34
|
+
headers: {
|
|
35
|
+
'x-api-key': apiKey,
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
.then(res => res.json())
|
|
39
|
+
.then(data => {
|
|
40
|
+
setRaxon(data);
|
|
41
|
+
setIsLoading(false);
|
|
42
|
+
})
|
|
43
|
+
.catch(err => {
|
|
44
|
+
console.error('[RAXON] ERROR:', err);
|
|
45
|
+
setIsLoading(false);
|
|
46
|
+
});
|
|
47
|
+
}, [hasFetched, apiUrl, apiKey]);
|
|
48
|
+
const flatCategory = useMemo(() => {
|
|
49
|
+
const flatten = (categories) => {
|
|
50
|
+
return categories.flatMap(cat => [cat, ...flatten(cat.children ?? [])]);
|
|
51
|
+
};
|
|
52
|
+
return flatten(Array.isArray(raxon?.category) ? raxon.category : []);
|
|
53
|
+
}, [raxon?.category]);
|
|
54
|
+
const value = useMemo(() => ({
|
|
55
|
+
campaign: raxon?.campaign ?? [],
|
|
56
|
+
basketCampaign: raxon?.campaign?.filter((it) => it.type !== CampaignType.COLLECTION) ?? [],
|
|
57
|
+
branch: raxon?.branch ?? null,
|
|
58
|
+
collection: raxon?.collection ?? [],
|
|
59
|
+
subHeroCollection: raxon?.subHeroCollection ?? [],
|
|
60
|
+
banner: raxon?.collection?.filter((it) => it.tags.includes('banner')) ?? [],
|
|
61
|
+
category: Array.isArray(raxon?.category) ? raxon.category : [],
|
|
62
|
+
flatCategory: flatCategory,
|
|
63
|
+
faq: raxon?.faq ?? [],
|
|
64
|
+
product: raxon?.product ?? [],
|
|
65
|
+
bankAccount: raxon?.bankAccount ?? [],
|
|
66
|
+
material: raxon?.material ?? [],
|
|
67
|
+
bestSeller: raxon?.bestSeller ?? [],
|
|
68
|
+
isLoading: isLoading,
|
|
69
|
+
dynamicData: raxon?.dynamicData ?? [],
|
|
70
|
+
deliveryMethod: raxon?.deliveryMethod ?? [],
|
|
71
|
+
paymentMethod: raxon?.paymentMethod ?? [],
|
|
72
|
+
defaultDeliveryMethod: raxon?.deliveryMethod?.find((it) => it.isDefault) ?? null,
|
|
73
|
+
review: raxon?.review ?? [],
|
|
74
|
+
article: raxon?.article ?? [],
|
|
75
|
+
feed: raxon?.feed ?? [],
|
|
76
|
+
brand: raxon?.brand ?? [],
|
|
77
|
+
isAuthenticated: false,
|
|
78
|
+
isGuest: true,
|
|
79
|
+
modalAuthRef,
|
|
80
|
+
modalNewsletterVariantProductRef,
|
|
81
|
+
}), [raxon, isLoading, flatCategory]);
|
|
82
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(RaxonContext.Provider, { value: value, children: _jsx(SecurityProvider, { children: _jsxs(CartProvider, { children: [children, _jsx(ModalAuth, { ref: modalAuthRef }), _jsx(ModalNewsletterVariantProduct, { ref: modalNewsletterVariantProductRef })] }) }) }) }));
|
|
83
|
+
};
|
|
84
|
+
export const useRaxon = () => {
|
|
85
|
+
const context = useContext(RaxonContext);
|
|
86
|
+
if (context === undefined) {
|
|
87
|
+
throw new Error('useRaxon must be used within a RaxonProvider');
|
|
88
|
+
}
|
|
89
|
+
return context;
|
|
90
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const addressCreateSchema: z.ZodObject<{
|
|
3
|
+
title: z.ZodString;
|
|
4
|
+
fullName: z.ZodString;
|
|
5
|
+
phoneNumber: z.ZodString;
|
|
6
|
+
country: z.ZodString;
|
|
7
|
+
administrativeAreaLevel1: z.ZodString;
|
|
8
|
+
administrativeAreaLevel2: z.ZodString;
|
|
9
|
+
fullAddress: z.ZodString;
|
|
10
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
11
|
+
invoiceType: z.ZodEnum<{
|
|
12
|
+
individual: "individual";
|
|
13
|
+
corporate: "corporate";
|
|
14
|
+
}>;
|
|
15
|
+
taxNumber: z.ZodOptional<z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const checkoutSchema: z.ZodObject<{
|
|
18
|
+
deliveryAddressId: z.ZodOptional<z.ZodString>;
|
|
19
|
+
invoiceAddressId: z.ZodOptional<z.ZodString>;
|
|
20
|
+
differentInvoiceAddress: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
deliveryMethodId: z.ZodString;
|
|
22
|
+
paymentMethodId: z.ZodString;
|
|
23
|
+
bankAccountId: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
export type AddressCreateFormData = z.infer<typeof addressCreateSchema>;
|
|
26
|
+
export type CheckoutFormData = z.infer<typeof checkoutSchema>;
|
|
27
|
+
export declare function getDeliveryFee(method: {
|
|
28
|
+
courierFee?: number | null;
|
|
29
|
+
minimumOrderAmount?: number | null;
|
|
30
|
+
isForceFee?: boolean;
|
|
31
|
+
}, subtotal: number): number;
|
|
32
|
+
export declare function formatTry(amount: number): string;
|
|
33
|
+
export type PaymentUiType = 'credit_card' | 'bank_transfer' | 'garanti' | 'other';
|
|
34
|
+
export declare function getPaymentUiType(name: string, provider?: string): PaymentUiType;
|
|
35
|
+
export declare function getPaymentDisplayName(name: string, provider?: string): string;
|
|
36
|
+
export declare function sortPaymentMethods<T extends {
|
|
37
|
+
name: string;
|
|
38
|
+
provider?: string;
|
|
39
|
+
}>(methods: T[]): T[];
|
|
40
|
+
/** Checkout'ta gösterilecek ödeme yöntemleri: Kredi Kartı → Havale → GarantiPay */
|
|
41
|
+
export declare function getCheckoutPaymentMethods<T extends {
|
|
42
|
+
id: string;
|
|
43
|
+
name: string;
|
|
44
|
+
provider?: string;
|
|
45
|
+
}>(methods: T[]): T[];
|
|
46
|
+
//# sourceMappingURL=checkout.schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout.schema.d.ts","sourceRoot":"","sources":["../../../core/schema/checkout.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;iBAW9B,CAAC;AAEH,eAAO,MAAM,cAAc;;;;;;;iBAOzB,CAAC;AAEH,MAAM,MA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orunludur'),
|
|
5
|
+
phoneNumber: z.string().min(10, 'Geçerli telefon giriniz'),
|
|
6
|
+
country: z.string().min(1, 'Ülke seçiniz'),
|
|
7
|
+
administrativeAreaLevel1: z.string().min(1, 'İl seçiniz'),
|
|
8
|
+
administrativeAreaLevel2: z.string().min(1, 'İlçe seçiniz'),
|
|
9
|
+
fullAddress: z.string().min(5, 'Adres zorunludur'),
|
|
10
|
+
postalCode: z.string().optional(),
|
|
11
|
+
invoiceType: z.enum(['individual', 'corporate']),
|
|
12
|
+
taxNumber: z.string().optional(),
|
|
13
|
+
});
|
|
14
|
+
export const checkoutSchema = z.object({
|
|
15
|
+
deliveryAddressId: z.string().optional(),
|
|
16
|
+
invoiceAddressId: z.string().optional(),
|
|
17
|
+
differentInvoiceAddress: z.boolean().optional(),
|
|
18
|
+
deliveryMethodId: z.string().min(1, 'Teslimat yöntemi seçiniz'),
|
|
19
|
+
paymentMethodId: z.string().min(1, 'Ödeme yöntemi seçiniz'),
|
|
20
|
+
bankAccountId: z.string().optional(),
|
|
21
|
+
});
|
|
22
|
+
export function getDeliveryFee(method, subtotal) {
|
|
23
|
+
const fee = Number(method.courierFee ?? 0);
|
|
24
|
+
const minAmount = Number(method.minimumOrderAmount ?? 0);
|
|
25
|
+
if (minAmount > 0 && subtotal >= minAmount && !method.isForceFee) {
|
|
26
|
+
return 0;
|
|
27
|
+
}
|
|
28
|
+
return fee;
|
|
29
|
+
}
|
|
30
|
+
export function formatTry(amount) {
|
|
31
|
+
return new Intl.NumberFormat('tr-TR', {
|
|
32
|
+
style: 'currency',
|
|
33
|
+
currency: 'TRY',
|
|
34
|
+
maximumFractionDigits: 2,
|
|
35
|
+
}).format(amount);
|
|
36
|
+
}
|
|
37
|
+
export function getPaymentUiType(name, provider) {
|
|
38
|
+
const n = name.toLowerCase();
|
|
39
|
+
const p = (provider || '').toUpperCase();
|
|
40
|
+
if (p === 'GARANTI' || p.includes('GARANTI') || n.includes('garanti'))
|
|
41
|
+
return 'garanti';
|
|
42
|
+
if (p === 'PAYTR' || p.includes('PAYTR') || p === 'STRIPE' || n.includes('kredi') || n.includes('kart')) {
|
|
43
|
+
return 'credit_card';
|
|
44
|
+
}
|
|
45
|
+
if (p === 'BANK_TRANSFER' ||
|
|
46
|
+
p.includes('BANK') ||
|
|
47
|
+
n.includes('havale') ||
|
|
48
|
+
n.includes('eft') ||
|
|
49
|
+
n.includes('peşin') ||
|
|
50
|
+
n.includes('pesin')) {
|
|
51
|
+
return 'bank_transfer';
|
|
52
|
+
}
|
|
53
|
+
return 'other';
|
|
54
|
+
}
|
|
55
|
+
export function getPaymentDisplayName(name, provider) {
|
|
56
|
+
const type = getPaymentUiType(name, provider);
|
|
57
|
+
if (type === 'credit_card')
|
|
58
|
+
return 'Kredi Kartı';
|
|
59
|
+
if (type === 'bank_transfer')
|
|
60
|
+
return 'Havale';
|
|
61
|
+
if (type === 'garanti')
|
|
62
|
+
return 'GarantiPay';
|
|
63
|
+
return name;
|
|
64
|
+
}
|
|
65
|
+
export function sortPaymentMethods(methods) {
|
|
66
|
+
const order = ['credit_card', 'bank_transfer', 'garanti', 'other'];
|
|
67
|
+
return [...methods].sort((a, b) => {
|
|
68
|
+
const ai = order.indexOf(getPaymentUiType(a.name, a.provider));
|
|
69
|
+
const bi = order.indexOf(getPaymentUiType(b.name, b.provider));
|
|
70
|
+
return ai - bi;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
/** Checkout'ta gösterilecek ödeme yöntemleri: Kredi Kartı → Havale → GarantiPay */
|
|
74
|
+
export function getCheckoutPaymentMethods(methods) {
|
|
75
|
+
const order = ['credit_card', 'bank_transfer', 'garanti'];
|
|
76
|
+
const picked = [];
|
|
77
|
+
for (const type of order) {
|
|
78
|
+
const match = methods.find((m) => getPaymentUiType(m.name, m.provider) === type);
|
|
79
|
+
if (match)
|
|
80
|
+
picked.push(match);
|
|
81
|
+
}
|
|
82
|
+
return picked;
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"basket.item.display.d.ts","sourceRoot":"","sources":["../../../core/util/basket.item.display.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAEhF,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,0BAA0B,GAAG,MAAM,GAAG,IAAI,CAgB3F"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export function formatBasketItemVariantLine(item) {
|
|
2
|
+
const v = item.variant;
|
|
3
|
+
if (!v)
|
|
4
|
+
return null;
|
|
5
|
+
const parts = [];
|
|
6
|
+
if (v.attributeOption1) {
|
|
7
|
+
const n = v.attributeOption1.name;
|
|
8
|
+
const label = v.attributeOption1.attribute?.name;
|
|
9
|
+
parts.push(label && n ? `${label}: ${n}` : n || '');
|
|
10
|
+
}
|
|
11
|
+
if (v.attributeOption2) {
|
|
12
|
+
const n = v.attributeOption2.name;
|
|
13
|
+
const label = v.attributeOption2.attribute?.name;
|
|
14
|
+
parts.push(label && n ? `${label}: ${n}` : n || '');
|
|
15
|
+
}
|
|
16
|
+
const s = parts.filter(Boolean).join(' · ');
|
|
17
|
+
return s.length > 0 ? s : null;
|
|
18
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Category } from '../interface/prisma.interface';
|
|
2
|
+
/** Header/footer ile aynı görünen kategori adı (çok dilli + eski getName formatı) */
|
|
3
|
+
export declare function categoryNavLabel(cat: Category): string;
|
|
4
|
+
export declare function getCategoryNavProductCount(cat: Category): number;
|
|
5
|
+
/**
|
|
6
|
+
* Header/footer menü kökleri: bazı API yanıtlarında tek şemsiye düğüm veya üst dizide hep dolu parentId gelir.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveCategoryNavRoots(categoryTreeTopLevel: Category[]): Category[];
|
|
9
|
+
//# sourceMappingURL=category.nav.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"category.nav.d.ts","sourceRoot":"","sources":["../../../core/util/category.nav.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAEzD,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAMtD;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAMhE;AAOD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,oBAAoB,EAAE,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAiBpF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import capitalize from 'lodash/capitalize';
|
|
2
|
+
/** Header/footer ile aynı görünen kategori adı (çok dilli + eski getName formatı) */
|
|
3
|
+
export function categoryNavLabel(cat) {
|
|
4
|
+
if (Array.isArray(cat.name) && cat.name.length > 0) {
|
|
5
|
+
return cat.name[0]?.value || '';
|
|
6
|
+
}
|
|
7
|
+
const raw = cat.name?.getName?.() ?? '';
|
|
8
|
+
return raw ? capitalize(raw) : '';
|
|
9
|
+
}
|
|
10
|
+
export function getCategoryNavProductCount(cat) {
|
|
11
|
+
const c = cat;
|
|
12
|
+
return c.totalProductCount ?? c._count?.product ?? c._count?.products ?? 0;
|
|
13
|
+
}
|
|
14
|
+
function categoryHasStoredParent(cat) {
|
|
15
|
+
const p = cat.parentId;
|
|
16
|
+
return p != null && String(p).trim().length > 0;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Header/footer menü kökleri: bazı API yanıtlarında tek şemsiye düğüm veya üst dizide hep dolu parentId gelir.
|
|
20
|
+
*/
|
|
21
|
+
export function resolveCategoryNavRoots(categoryTreeTopLevel) {
|
|
22
|
+
if (!categoryTreeTopLevel?.length)
|
|
23
|
+
return [];
|
|
24
|
+
const aliveTop = categoryTreeTopLevel.filter(c => !c.deletedAt);
|
|
25
|
+
const rootsWithoutParent = aliveTop.filter(c => !categoryHasStoredParent(c));
|
|
26
|
+
if (rootsWithoutParent.length === 1) {
|
|
27
|
+
const only = rootsWithoutParent[0];
|
|
28
|
+
const children = (only.children ?? []).filter(c => !c.deletedAt);
|
|
29
|
+
if (children.length > 0)
|
|
30
|
+
return children;
|
|
31
|
+
return [only];
|
|
32
|
+
}
|
|
33
|
+
if (rootsWithoutParent.length > 0)
|
|
34
|
+
return rootsWithoutParent;
|
|
35
|
+
/** parentId hep dolu: sunucunun döndürdüğü üst diziyi menü seviyesi kabul et */
|
|
36
|
+
return aliveTop;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-ip.d.ts","sourceRoot":"","sources":["../../../core/util/client-ip.ts"],"names":[],"mappings":"AAUA,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwB9D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const CLIENT_IP_STORAGE_KEY = 'kuatto-client-ip';
|
|
2
|
+
let clientIpPromise = null;
|
|
3
|
+
function isValidIp(ip) {
|
|
4
|
+
const trimmed = ip.trim();
|
|
5
|
+
if (!trimmed)
|
|
6
|
+
return false;
|
|
7
|
+
return /^(?:\d{1,3}\.){3}\d{1,3}$/.test(trimmed) || /^[0-9a-f:]+$/i.test(trimmed);
|
|
8
|
+
}
|
|
9
|
+
export async function resolveClientIp() {
|
|
10
|
+
if (typeof window === 'undefined') {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const cached = sessionStorage.getItem(CLIENT_IP_STORAGE_KEY);
|
|
14
|
+
if (cached && isValidIp(cached)) {
|
|
15
|
+
return cached;
|
|
16
|
+
}
|
|
17
|
+
if (!clientIpPromise) {
|
|
18
|
+
clientIpPromise = fetch('https://api.ipify.org?format=json', { cache: 'no-store' })
|
|
19
|
+
.then(async (response) => {
|
|
20
|
+
if (!response.ok)
|
|
21
|
+
return null;
|
|
22
|
+
const data = (await response.json());
|
|
23
|
+
const ip = data.ip?.trim();
|
|
24
|
+
if (!ip || !isValidIp(ip))
|
|
25
|
+
return null;
|
|
26
|
+
sessionStorage.setItem(CLIENT_IP_STORAGE_KEY, ip);
|
|
27
|
+
return ip;
|
|
28
|
+
})
|
|
29
|
+
.catch(() => null);
|
|
30
|
+
}
|
|
31
|
+
return clientIpPromise;
|
|
32
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare function getCollectionLabel(tags?: string[]): string;
|
|
2
|
+
export declare function isBrandCollectionTitle(title: string | undefined): boolean;
|
|
3
|
+
export declare function matchDirectBrandIdFromCollectionTitle(title: string | undefined, brands: Array<{
|
|
4
|
+
id: string;
|
|
5
|
+
name?: string | null;
|
|
6
|
+
}> | undefined): string;
|
|
7
|
+
export declare function matchBrandIdFromCollectionTitle(title: string | undefined, brands: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
}> | undefined): string;
|
|
11
|
+
export declare function matchSearchQueryFromCollectionTitle(title: string | undefined): string;
|
|
12
|
+
export declare function shouldPreferThematicCategoryFallback(title: string | undefined): boolean;
|
|
13
|
+
export declare function matchCategoryIdFromCollectionTitle(title: string | undefined, categories: Array<{
|
|
14
|
+
id: string;
|
|
15
|
+
name?: unknown;
|
|
16
|
+
}> | undefined): string;
|
|
17
|
+
export type CollectionProductSource = 'collection' | 'detail' | 'brand' | 'category' | 'search' | 'empty';
|
|
18
|
+
export declare function resolveCollectionProductSource(params: {
|
|
19
|
+
apiCount: number;
|
|
20
|
+
detailCount: number;
|
|
21
|
+
title?: string;
|
|
22
|
+
brandId?: string | null;
|
|
23
|
+
categoryId?: string | null;
|
|
24
|
+
searchQuery?: string | null;
|
|
25
|
+
isDirectBrandCollection?: boolean;
|
|
26
|
+
isCollectionProductsSettled: boolean;
|
|
27
|
+
}): CollectionProductSource | null;
|
|
28
|
+
export declare function filterProductsByCollectionAllowlist<T extends {
|
|
29
|
+
id?: string | null;
|
|
30
|
+
}>(products: T[], allowlistIds: Set<string>): T[];
|
|
31
|
+
//# sourceMapping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