@shophost/react 0.1.3
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/admin-client.cjs +2 -0
- package/admin-client.js +21796 -0
- package/components/admin/forms/manufacturer-form.d.ts +7 -0
- package/components/admin/forms/organization-configuration-form.d.ts +10 -0
- package/components/admin/forms/organization-form.d.ts +8 -0
- package/components/admin/forms/organization-schedule-form.d.ts +10 -0
- package/components/admin/forms/product-category.form.d.ts +7 -0
- package/components/admin/forms/product-form/basic-info-section.d.ts +8 -0
- package/components/admin/forms/product-form/index.d.ts +7 -0
- package/components/admin/forms/product-form/metadata-section.d.ts +8 -0
- package/components/admin/forms/product-form/modifier-group-dialog.d.ts +9 -0
- package/components/admin/forms/product-form/modifiers-list.d.ts +7 -0
- package/components/admin/forms/product-form/modifiers-section.d.ts +8 -0
- package/components/admin/forms/product-form/price-section.d.ts +9 -0
- package/components/admin/forms/shipping-method-form.d.ts +7 -0
- package/components/admin/forms/sign-in-form.d.ts +2 -0
- package/components/admin/forms/sign-up-form.d.ts +2 -0
- package/components/admin/partials/manufacturers-list/columns.d.ts +3 -0
- package/components/admin/partials/manufacturers-list/index.d.ts +2 -0
- package/components/admin/partials/orders-list/actions-cell.d.ts +10 -0
- package/components/admin/partials/orders-list/columns.d.ts +3 -0
- package/components/admin/partials/orders-list/index.d.ts +2 -0
- package/components/admin/partials/orders-list/order-details-modal.d.ts +9 -0
- package/components/admin/partials/organization-list/index.d.ts +2 -0
- package/components/admin/partials/product-categories-list/columns.d.ts +14 -0
- package/components/admin/partials/product-categories-list/index.d.ts +2 -0
- package/components/admin/partials/products-list/columns.d.ts +14 -0
- package/components/admin/partials/products-list/index.d.ts +2 -0
- package/components/admin/partials/reservations-list/actions-cell.d.ts +10 -0
- package/components/admin/partials/reservations-list/columns.d.ts +3 -0
- package/components/admin/partials/reservations-list/index.d.ts +2 -0
- package/components/admin/partials/reservations-list/reservation-details-modal.d.ts +8 -0
- package/components/admin/partials/shipping-methods-list/columns.d.ts +3 -0
- package/components/admin/partials/shipping-methods-list/index.d.ts +2 -0
- package/components/ui/badge.d.ts +31 -0
- package/components/ui/button.d.ts +35 -0
- package/components/ui/calendar.d.ts +21 -0
- package/components/ui/card.d.ts +6 -0
- package/components/ui/checkbox.d.ts +4 -0
- package/components/ui/command-bar.d.ts +24 -0
- package/components/ui/command.d.ts +80 -0
- package/components/ui/data-table/DataTable.d.ts +13 -0
- package/components/ui/data-table/DataTableBulkEditor.d.ts +7 -0
- package/components/ui/data-table/DataTableColumnHeader.d.ts +7 -0
- package/components/ui/data-table/DataTableFilter.d.ts +18 -0
- package/components/ui/data-table/DataTablePagination.d.ts +8 -0
- package/components/ui/data-table/DataTableViewOptions.d.ts +6 -0
- package/components/ui/data-table/tanstack-table.d.ts +7 -0
- package/components/ui/date-picker.d.ts +72 -0
- package/components/ui/dialog.d.ts +20 -0
- package/components/ui/divider.d.ts +5 -0
- package/components/ui/drawer.d.ts +18 -0
- package/components/ui/dropdown.d.ts +30 -0
- package/components/ui/form-generator.d.ts +29 -0
- package/components/ui/header.d.ts +2 -0
- package/components/ui/icons/ArrowAnimated.d.ts +1 -0
- package/components/ui/icons/spinner-icon.d.ts +5 -0
- package/components/ui/input/country-input.d.ts +7 -0
- package/components/ui/input/email-input.d.ts +7 -0
- package/components/ui/input/image-upload-input.d.ts +19 -0
- package/components/ui/input/phone-number-input.d.ts +8 -0
- package/components/ui/input/select-input.d.ts +14 -0
- package/components/ui/input/text-input.d.ts +87 -0
- package/components/ui/input-array-group.d.ts +10 -0
- package/components/ui/input-group.d.ts +19 -0
- package/components/ui/input-object-group.d.ts +8 -0
- package/components/ui/input.d.ts +13 -0
- package/components/ui/label.d.ts +7 -0
- package/components/ui/line-chart.d.ts +35 -0
- package/components/ui/logo.d.ts +5 -0
- package/components/ui/multiple-select.d.ts +73 -0
- package/components/ui/navigation/DropdownUserProfile.d.ts +6 -0
- package/components/ui/navigation/MobileSidebar.d.ts +1 -0
- package/components/ui/navigation/Sidebar.d.ts +1 -0
- package/components/ui/navigation/SidebarWorkspacesDropdown.d.ts +2 -0
- package/components/ui/navigation/UserProfile.d.ts +2 -0
- package/components/ui/overview/DashboardCategoryBarCard.d.ts +13 -0
- package/components/ui/overview/DashboardChartCard.d.ts +12 -0
- package/components/ui/overview/DashboardFilterbar.d.ts +16 -0
- package/components/ui/overview/DashboardProgressBarCard.d.ts +12 -0
- package/components/ui/overview/dashboard-types.d.ts +12 -0
- package/components/ui/popover.d.ts +13 -0
- package/components/ui/progress-bar.d.ts +89 -0
- package/components/ui/progress-circle.d.ts +91 -0
- package/components/ui/radio-card.d.ts +6 -0
- package/components/ui/search-bar.d.ts +29 -0
- package/components/ui/select.d.ts +17 -0
- package/components/ui/settings/ModalAddUser.d.ts +4 -0
- package/components/ui/switch.d.ts +50 -0
- package/components/ui/tab-navigation.d.ts +7 -0
- package/components/ui/table.d.ts +11 -0
- package/components/ui/tooltip.d.ts +11 -0
- package/config/countries.d.ts +8 -0
- package/data/data.d.ts +31 -0
- package/data/overview-data.d.ts +2 -0
- package/data/schema.d.ts +19 -0
- package/index.cjs +1 -0
- package/index.d.ts +7 -0
- package/index.mjs +14 -0
- package/index.react-server.cjs +1 -0
- package/index.react-server.d.ts +8 -0
- package/index.react-server.mjs +37 -0
- package/lib/auth-redirect.d.ts +4 -0
- package/lib/auth.d.ts +23 -0
- package/lib/chartUtils.d.ts +63 -0
- package/lib/query-client.d.ts +2 -0
- package/lib/useOnWindowResize.d.ts +3 -0
- package/lib/utils.d.ts +11 -0
- package/next/server.cjs +1 -0
- package/next/server.d.ts +43 -0
- package/next/server.mjs +21 -0
- package/next/views.cjs +2 -0
- package/next/views.d.ts +7 -0
- package/next/views.mjs +5 -0
- package/package.json +119 -0
- package/providers/admin-provider.d.ts +13 -0
- package/providers/flyout-provider.d.ts +10 -0
- package/providers/organization-provider.d.ts +22 -0
- package/react.css +1 -0
- package/router/AdminRouter.d.ts +5 -0
- package/router/resolve.d.ts +67 -0
- package/router/routes.d.ts +25 -0
- package/storefront/components/cart/cart-items.d.ts +20 -0
- package/storefront/components/cart-summary/index.d.ts +13 -0
- package/storefront/components/cart-summary/schimmer.d.ts +3 -0
- package/storefront/components/header/index.d.ts +11 -0
- package/storefront/components/header/shimmer.d.ts +2 -0
- package/storefront/components/header/user-profile.d.ts +1 -0
- package/storefront/components/index.d.ts +1 -0
- package/storefront/components/modifiers/index.d.ts +5 -0
- package/storefront/components/modifiers/modifier-dialog-container.d.ts +21 -0
- package/storefront/components/modifiers/modifiers-group.d.ts +37 -0
- package/storefront/components/modifiers/modifiers-modal.d.ts +12 -0
- package/storefront/components/modifiers/modifiers-option.d.ts +37 -0
- package/storefront/components/modifiers/quantity-control.d.ts +29 -0
- package/storefront/components/pages/account-pages/index.d.ts +2 -0
- package/storefront/components/pages/account-pages/layouts.d.ts +10 -0
- package/storefront/components/pages/account-pages/order-details-page/index.d.ts +5 -0
- package/storefront/components/pages/account-pages/order-details-page/shimmer.d.ts +2 -0
- package/storefront/components/pages/account-pages/order-details-page/tracking-icons.d.ts +13 -0
- package/storefront/components/pages/account-pages/order-details-page/tracking-step.d.ts +10 -0
- package/storefront/components/pages/account-pages/orders-list-page/index.d.ts +2 -0
- package/storefront/components/pages/account-pages/sign-in-page/index.d.ts +1 -0
- package/storefront/components/pages/account-pages/sign-in-page/sign-in-form.d.ts +2 -0
- package/storefront/components/pages/account-pages/sign-up-page/index.d.ts +1 -0
- package/storefront/components/pages/account-pages/sign-up-page/sign-up-form.d.ts +2 -0
- package/storefront/components/pages/checkout-pages/customer-details-page/customer-details-form.d.ts +9 -0
- package/storefront/components/pages/checkout-pages/customer-details-page/index.d.ts +6 -0
- package/storefront/components/pages/checkout-pages/customer-details-page/shimmer.d.ts +2 -0
- package/storefront/components/pages/checkout-pages/index.d.ts +2 -0
- package/storefront/components/pages/checkout-pages/reservation-page/index.d.ts +2 -0
- package/storefront/components/pages/checkout-pages/reservation-page/reservation-form.d.ts +10 -0
- package/storefront/components/pages/checkout-pages/shipping-and-payment-page/index.d.ts +6 -0
- package/storefront/components/pages/checkout-pages/shipping-and-payment-page/shimmer.d.ts +2 -0
- package/storefront/components/pages/checkout-pages/shipping-and-payment-page/shipping-and-payment-form.d.ts +9 -0
- package/storefront/components/ui/badge.d.ts +31 -0
- package/storefront/components/ui/button.d.ts +35 -0
- package/storefront/components/ui/command-bar.d.ts +24 -0
- package/storefront/components/ui/command.d.ts +80 -0
- package/storefront/components/ui/datefield-rac.d.ts +12 -0
- package/storefront/components/ui/dialog.d.ts +20 -0
- package/storefront/components/ui/divider.d.ts +5 -0
- package/storefront/components/ui/index.d.ts +12 -0
- package/storefront/components/ui/input/country-input.d.ts +8 -0
- package/storefront/components/ui/input/email-input.d.ts +7 -0
- package/storefront/components/ui/input/image-upload-input.d.ts +19 -0
- package/storefront/components/ui/input/index.d.ts +22 -0
- package/storefront/components/ui/input/location-input.d.ts +9 -0
- package/storefront/components/ui/input/phone-number-input.d.ts +8 -0
- package/storefront/components/ui/input/select-input.d.ts +14 -0
- package/storefront/components/ui/input/switch.d.ts +50 -0
- package/storefront/components/ui/input/text-input.d.ts +87 -0
- package/storefront/components/ui/input/time-input.d.ts +4 -0
- package/storefront/components/ui/input/week-time-input.d.ts +8 -0
- package/storefront/components/ui/input-group.d.ts +20 -0
- package/storefront/components/ui/label.d.ts +7 -0
- package/storefront/components/ui/popover.d.ts +13 -0
- package/storefront/components/ui/radio-card.d.ts +6 -0
- package/storefront/components/ui/slideover.d.ts +8 -0
- package/storefront/components/ui/text-input.d.ts +3 -0
- package/storefront/config/countries.d.ts +8 -0
- package/storefront/constants/cart.constants.d.ts +3 -0
- package/storefront/exports.d.ts +21 -0
- package/storefront/hooks/useLocalization.d.ts +12 -0
- package/storefront/hooks/useModifierSelection.d.ts +21 -0
- package/storefront/hooks/useProductDetails.d.ts +11 -0
- package/storefront/index.d.ts +1 -0
- package/storefront/lib/better-auth.d.ts +2642 -0
- package/storefront/lib/react-query.lib.d.ts +2 -0
- package/storefront/lib/utils.d.ts +11 -0
- package/storefront/mock/products.d.ts +48 -0
- package/storefront/providers/api-provider.d.ts +11 -0
- package/storefront/providers/auth-provider.d.ts +9 -0
- package/storefront/providers/cart-provider.d.ts +39 -0
- package/storefront/providers/modifiers-provider.d.ts +27 -0
- package/storefront/providers/organization-provider.d.ts +15 -0
- package/storefront/providers/shophost-provider.d.ts +29 -0
- package/storefront/providers/translation-provider.d.ts +16 -0
- package/storefront/reducers/cart.reducer.d.ts +13 -0
- package/storefront/schemas/cart.schema.d.ts +13 -0
- package/storefront/translations/en.d.ts +150 -0
- package/storefront/translations/index.d.ts +4 -0
- package/storefront/translations/pl.d.ts +150 -0
- package/storefront/types/cart.types.d.ts +109 -0
- package/storefront/utils/cart-item.util.d.ts +3 -0
- package/storefront/utils/cart.util.d.ts +53 -0
- package/storefront.cjs +2 -0
- package/storefront.mjs +81 -0
- package/utils/object.util.d.ts +11 -0
- package/views/AdminShell.d.ts +4 -0
- package/views/DashboardView.d.ts +3 -0
- package/views/ErrorView.d.ts +3 -0
- package/views/OrdersView.d.ts +1 -0
- package/views/OrganizationsView.d.ts +1 -0
- package/views/ReservationsView.d.ts +1 -0
- package/views/auth/SignInView.d.ts +1 -0
- package/views/auth/SignUpView.d.ts +1 -0
- package/views/auth/auth-layout.d.ts +4 -0
- package/views/manufacturers/ManufacturerCreateView.d.ts +1 -0
- package/views/manufacturers/ManufacturerEditView.d.ts +1 -0
- package/views/manufacturers/ManufacturersListView.d.ts +1 -0
- package/views/product-categories/ProductCategoriesListView.d.ts +1 -0
- package/views/product-categories/ProductCategoryCreateView.d.ts +1 -0
- package/views/product-categories/ProductCategoryEditView.d.ts +1 -0
- package/views/products/ProductCreateView.d.ts +1 -0
- package/views/products/ProductEditView.d.ts +1 -0
- package/views/products/ProductsListView.d.ts +1 -0
- package/views/settings/OpeningTimesView.d.ts +1 -0
- package/views/settings/SettingsLayout.d.ts +4 -0
- package/views/settings/SettingsView.d.ts +1 -0
- package/views/settings/shipping-methods/ShippingMethodCreateView.d.ts +1 -0
- package/views/settings/shipping-methods/ShippingMethodEditView.d.ts +1 -0
- package/views/settings/shipping-methods/ShippingMethodsListView.d.ts +1 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ClassValue } from 'clsx';
|
|
2
|
+
export declare function cx(...args: ClassValue[]): string;
|
|
3
|
+
export declare const focusInput: string[];
|
|
4
|
+
export declare const focusRing: string[];
|
|
5
|
+
export declare const hasErrorInput: string[];
|
|
6
|
+
export declare const usNumberformatter: (number: number, decimals?: number) => string;
|
|
7
|
+
export declare const percentageFormatter: (number: number, decimals?: number) => string;
|
|
8
|
+
export declare const millionFormatter: (number: number, decimals?: number) => string;
|
|
9
|
+
export declare const formatters: {
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const mockProducts: {
|
|
2
|
+
id: string;
|
|
3
|
+
slug: string;
|
|
4
|
+
sku: string;
|
|
5
|
+
basePrice: number;
|
|
6
|
+
discountedBasePrice: null;
|
|
7
|
+
currency: string;
|
|
8
|
+
images: {
|
|
9
|
+
id: string;
|
|
10
|
+
url: string;
|
|
11
|
+
mimeType: string;
|
|
12
|
+
size: number;
|
|
13
|
+
filename: string;
|
|
14
|
+
}[];
|
|
15
|
+
modifierGroups: {
|
|
16
|
+
id: string;
|
|
17
|
+
selectMin: number;
|
|
18
|
+
selectMax: number;
|
|
19
|
+
modifiers: {
|
|
20
|
+
id: string;
|
|
21
|
+
title: string;
|
|
22
|
+
sku: null;
|
|
23
|
+
price: number;
|
|
24
|
+
}[];
|
|
25
|
+
translations: {
|
|
26
|
+
locale: string;
|
|
27
|
+
title: string;
|
|
28
|
+
}[];
|
|
29
|
+
}[];
|
|
30
|
+
categories: {
|
|
31
|
+
id: string;
|
|
32
|
+
slug: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
translations: {
|
|
35
|
+
locale: string;
|
|
36
|
+
title: string;
|
|
37
|
+
description: string;
|
|
38
|
+
}[];
|
|
39
|
+
}[];
|
|
40
|
+
manufacturerId: null;
|
|
41
|
+
createdAt: string;
|
|
42
|
+
publishedAt: string;
|
|
43
|
+
translations: {
|
|
44
|
+
locale: string;
|
|
45
|
+
title: string;
|
|
46
|
+
description: string;
|
|
47
|
+
}[];
|
|
48
|
+
}[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { initClient } from '../../../../client/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface APIProviderProps {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const APIProvider: React.FC<APIProviderProps>;
|
|
8
|
+
declare const useAPI: () => {
|
|
9
|
+
client: ReturnType<typeof initClient>;
|
|
10
|
+
};
|
|
11
|
+
export { APIProvider, useAPI };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
type AuthContextType = any;
|
|
3
|
+
interface AuthProviderProps {
|
|
4
|
+
baseURL: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
export declare const AuthProvider: React.FC<AuthProviderProps>;
|
|
8
|
+
export declare const useAuth: () => AuthContextType;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { CartItem, Locale, LocalizedProduct, Product, ShippingMethod } from '../../../../client/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { CartContextType } from '../types/cart.types';
|
|
4
|
+
interface CartProviderProps {
|
|
5
|
+
organizationId: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
locale?: Locale;
|
|
8
|
+
}
|
|
9
|
+
export declare const CartProvider: React.FC<CartProviderProps>;
|
|
10
|
+
export declare const useCart: () => {
|
|
11
|
+
items: CartItem[];
|
|
12
|
+
total: number;
|
|
13
|
+
subtotal: number;
|
|
14
|
+
shipping: number | undefined;
|
|
15
|
+
loading: boolean;
|
|
16
|
+
formattedCartItems: import('../types/cart.types').FormattedCartItem[];
|
|
17
|
+
addProductToCart: (product: Product | LocalizedProduct) => void;
|
|
18
|
+
clearCart: () => void;
|
|
19
|
+
itemCount: number;
|
|
20
|
+
rawCart: CartItem[];
|
|
21
|
+
onCheckoutClick: () => void;
|
|
22
|
+
totalAmount: number;
|
|
23
|
+
paymentMethod: {
|
|
24
|
+
id: string;
|
|
25
|
+
provider: "stripe" | "revolut" | "payu" | "not_applicable";
|
|
26
|
+
method: "card" | "blik" | "cash_on_delivery" | "paypal";
|
|
27
|
+
description: string;
|
|
28
|
+
} | null;
|
|
29
|
+
setPaymentMethod: React.Dispatch<React.SetStateAction<{
|
|
30
|
+
id: string;
|
|
31
|
+
provider: "stripe" | "revolut" | "payu" | "not_applicable";
|
|
32
|
+
method: "card" | "blik" | "cash_on_delivery" | "paypal";
|
|
33
|
+
description: string;
|
|
34
|
+
} | null>>;
|
|
35
|
+
shippingMethod: ShippingMethod | null;
|
|
36
|
+
setShippingMethod: React.Dispatch<React.SetStateAction<ShippingMethod | null>>;
|
|
37
|
+
};
|
|
38
|
+
export declare const useCartContext: () => CartContextType;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
interface ModifiersContextType {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
product: any;
|
|
6
|
+
productName: string;
|
|
7
|
+
hasModifiers: boolean;
|
|
8
|
+
quantity: number;
|
|
9
|
+
handleIncrement: () => void;
|
|
10
|
+
handleDecrement: () => void;
|
|
11
|
+
handleAddToCart: () => void;
|
|
12
|
+
validationError: string | null;
|
|
13
|
+
modifierGroups: any[];
|
|
14
|
+
isModifierSelected: (groupId: string, modifierId: string) => boolean;
|
|
15
|
+
isMultiSelect: (group: any) => boolean;
|
|
16
|
+
toggleModifier: (groupId: string, modifierId: string) => void;
|
|
17
|
+
selectModifier: (groupId: string, modifierId: string) => void;
|
|
18
|
+
getModifierGroupName: (group: any) => string;
|
|
19
|
+
formatModifierPrice: (modifier: any, currency: string) => string;
|
|
20
|
+
locale: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const ModifiersProvider: React.FC<{
|
|
23
|
+
children: React.ReactNode;
|
|
24
|
+
locale?: string;
|
|
25
|
+
}>;
|
|
26
|
+
export declare const useModifiers: () => ModifiersContextType;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Organization } from '../../../../client/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
interface OrganizationContextType {
|
|
4
|
+
organizationId: string;
|
|
5
|
+
loading: boolean;
|
|
6
|
+
organization?: Organization;
|
|
7
|
+
error: string | Error | null;
|
|
8
|
+
}
|
|
9
|
+
interface OrganizationProviderProps {
|
|
10
|
+
organizationId: string;
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
export declare const OrganizationProvider: React.FC<OrganizationProviderProps>;
|
|
14
|
+
export declare const useOrganization: () => OrganizationContextType;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Locale } from '../../../../client/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface ShophostProviderProps {
|
|
4
|
+
/**
|
|
5
|
+
* The URL of shophost server
|
|
6
|
+
*/
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
/**
|
|
9
|
+
* Children to render inside the provider
|
|
10
|
+
*/
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Locale for translations
|
|
14
|
+
*/
|
|
15
|
+
locale?: Locale;
|
|
16
|
+
/**
|
|
17
|
+
* Custom modifiers modal component
|
|
18
|
+
*/
|
|
19
|
+
modifiersModal?: React.ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Organization ID
|
|
22
|
+
*/
|
|
23
|
+
organizationId: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* ShophostProvider is the main provider for the Shophost SDK.
|
|
27
|
+
* It wraps CartProvider and ModifiersModal to provide a complete shopping experience.
|
|
28
|
+
*/
|
|
29
|
+
export declare const ShophostProvider: React.FC<ShophostProviderProps>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Locale } from '../../../../client/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { translations } from '../translations';
|
|
4
|
+
type TranslationContextType = {
|
|
5
|
+
locale: Locale;
|
|
6
|
+
translations: typeof translations.en;
|
|
7
|
+
t: (key: string) => string;
|
|
8
|
+
};
|
|
9
|
+
interface TranslationProviderProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
locale: Locale;
|
|
12
|
+
}
|
|
13
|
+
export declare const TranslationProvider: ({ children, locale, }: TranslationProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const AppTranslationProvider: ({ children, locale, }: TranslationProviderProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare const useTranslation: () => TranslationContextType;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CartItem } from '../../../../client/src/index.ts';
|
|
2
|
+
import { CartAction } from '../types/cart.types';
|
|
3
|
+
export interface CartState {
|
|
4
|
+
items: CartItem[];
|
|
5
|
+
isInitialized: boolean;
|
|
6
|
+
isModifiersModalOpen: boolean;
|
|
7
|
+
selectedProduct: any | null;
|
|
8
|
+
onModalAddToCart: (() => void) | undefined;
|
|
9
|
+
totalAmount: number;
|
|
10
|
+
itemCount: number;
|
|
11
|
+
removedItemsAlert?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const cartReducer: (state: CartState, action: CartAction) => CartState;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from '@hono/zod-openapi';
|
|
2
|
+
export declare const CartItemSchema: z.ZodObject<{
|
|
3
|
+
productId: z.ZodString;
|
|
4
|
+
quantity: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
|
|
5
|
+
modifierGroups: z.ZodArray<z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
modifiers: z.ZodArray<z.ZodObject<{
|
|
8
|
+
id: z.ZodString;
|
|
9
|
+
quantity: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
}, z.core.$strip>>;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export type CartItem = z.infer<typeof CartItemSchema>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export declare const enTranslations: {
|
|
2
|
+
common: {
|
|
3
|
+
cart: string;
|
|
4
|
+
checkout: string;
|
|
5
|
+
products: string;
|
|
6
|
+
home: string;
|
|
7
|
+
search: string;
|
|
8
|
+
loading: string;
|
|
9
|
+
add: string;
|
|
10
|
+
remove: string;
|
|
11
|
+
close: string;
|
|
12
|
+
back: string;
|
|
13
|
+
next: string;
|
|
14
|
+
continue: string;
|
|
15
|
+
submit: string;
|
|
16
|
+
cancel: string;
|
|
17
|
+
apply: string;
|
|
18
|
+
save: string;
|
|
19
|
+
aboutUs: string;
|
|
20
|
+
ourStory: string;
|
|
21
|
+
menu: string;
|
|
22
|
+
reservations: string;
|
|
23
|
+
orderOnline: string;
|
|
24
|
+
checkOurMenu: string;
|
|
25
|
+
privacyPolicy: string;
|
|
26
|
+
termsAndConditions: string;
|
|
27
|
+
orderNow: string;
|
|
28
|
+
makeReservation: string;
|
|
29
|
+
};
|
|
30
|
+
product: {
|
|
31
|
+
addToCart: string;
|
|
32
|
+
outOfStock: string;
|
|
33
|
+
quantity: string;
|
|
34
|
+
price: string;
|
|
35
|
+
total: string;
|
|
36
|
+
description: string;
|
|
37
|
+
options: string;
|
|
38
|
+
modifiers: string;
|
|
39
|
+
};
|
|
40
|
+
checkout: {
|
|
41
|
+
yourOrder: string;
|
|
42
|
+
orderSummary: string;
|
|
43
|
+
delivery: string;
|
|
44
|
+
address: string;
|
|
45
|
+
payment: string;
|
|
46
|
+
confirmation: string;
|
|
47
|
+
deliveryDetails: string;
|
|
48
|
+
paymentMethod: string;
|
|
49
|
+
placeOrder: string;
|
|
50
|
+
subtotal: string;
|
|
51
|
+
total: string;
|
|
52
|
+
};
|
|
53
|
+
ourStory: {
|
|
54
|
+
title: string;
|
|
55
|
+
subtitle: string;
|
|
56
|
+
by: string;
|
|
57
|
+
paragraph1: string;
|
|
58
|
+
paragraph2: string;
|
|
59
|
+
paragraph3: string;
|
|
60
|
+
paragraph4: string;
|
|
61
|
+
paragraph5: string;
|
|
62
|
+
paragraph6: string;
|
|
63
|
+
signature: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
menuSection: {
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
orderOnline: {
|
|
71
|
+
title: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
hero: {
|
|
75
|
+
title: string;
|
|
76
|
+
subtitle: string;
|
|
77
|
+
};
|
|
78
|
+
introSection: {
|
|
79
|
+
title: string;
|
|
80
|
+
paragraph1: string;
|
|
81
|
+
paragraph2: string;
|
|
82
|
+
};
|
|
83
|
+
reservationSection: {
|
|
84
|
+
title: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
testimonialsSection: {
|
|
88
|
+
title: string;
|
|
89
|
+
description: string;
|
|
90
|
+
testimonials: {
|
|
91
|
+
name: string;
|
|
92
|
+
company: string;
|
|
93
|
+
text: string;
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
96
|
+
orderTracking: {
|
|
97
|
+
orderPlaced: string;
|
|
98
|
+
orderPlacedDesc: string;
|
|
99
|
+
orderAccepted: string;
|
|
100
|
+
orderAcceptedDesc: string;
|
|
101
|
+
readyForDispatch: string;
|
|
102
|
+
readyForDispatchDesc: string;
|
|
103
|
+
orderDispatched: string;
|
|
104
|
+
orderDispatchedDesc: string;
|
|
105
|
+
orderDelivered: string;
|
|
106
|
+
orderDeliveredDesc: string;
|
|
107
|
+
orderCancelled: string;
|
|
108
|
+
orderCancelledDesc: string;
|
|
109
|
+
price: string;
|
|
110
|
+
quantity: string;
|
|
111
|
+
subtotal: string;
|
|
112
|
+
total: string;
|
|
113
|
+
poweredBy: string;
|
|
114
|
+
reference: string;
|
|
115
|
+
status: string;
|
|
116
|
+
};
|
|
117
|
+
reservation: {
|
|
118
|
+
reservationDetails: string;
|
|
119
|
+
name: string;
|
|
120
|
+
phone: string;
|
|
121
|
+
guests: string;
|
|
122
|
+
date: string;
|
|
123
|
+
reference: string;
|
|
124
|
+
status: string;
|
|
125
|
+
notSpecified: string;
|
|
126
|
+
invalidDate: string;
|
|
127
|
+
requestSent: string;
|
|
128
|
+
requestSentDesc: string;
|
|
129
|
+
confirmed: string;
|
|
130
|
+
confirmedDesc: string;
|
|
131
|
+
cancelled: string;
|
|
132
|
+
cancelledDesc: string;
|
|
133
|
+
pendingStatus: string;
|
|
134
|
+
confirmedStatus: string;
|
|
135
|
+
cancelledStatus: string;
|
|
136
|
+
poweredBy: string;
|
|
137
|
+
};
|
|
138
|
+
homepage: {
|
|
139
|
+
description: string;
|
|
140
|
+
};
|
|
141
|
+
menu: {
|
|
142
|
+
description: string;
|
|
143
|
+
};
|
|
144
|
+
privacyPolicy: {
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
termsAndConditions: {
|
|
148
|
+
description: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
export declare const plTranslations: {
|
|
2
|
+
common: {
|
|
3
|
+
cart: string;
|
|
4
|
+
checkout: string;
|
|
5
|
+
products: string;
|
|
6
|
+
home: string;
|
|
7
|
+
search: string;
|
|
8
|
+
loading: string;
|
|
9
|
+
add: string;
|
|
10
|
+
remove: string;
|
|
11
|
+
close: string;
|
|
12
|
+
back: string;
|
|
13
|
+
next: string;
|
|
14
|
+
continue: string;
|
|
15
|
+
submit: string;
|
|
16
|
+
cancel: string;
|
|
17
|
+
apply: string;
|
|
18
|
+
save: string;
|
|
19
|
+
aboutUs: string;
|
|
20
|
+
ourStory: string;
|
|
21
|
+
menu: string;
|
|
22
|
+
reservations: string;
|
|
23
|
+
orderOnline: string;
|
|
24
|
+
checkOurMenu: string;
|
|
25
|
+
privacyPolicy: string;
|
|
26
|
+
termsAndConditions: string;
|
|
27
|
+
orderNow: string;
|
|
28
|
+
makeReservation: string;
|
|
29
|
+
};
|
|
30
|
+
product: {
|
|
31
|
+
addToCart: string;
|
|
32
|
+
outOfStock: string;
|
|
33
|
+
quantity: string;
|
|
34
|
+
price: string;
|
|
35
|
+
total: string;
|
|
36
|
+
description: string;
|
|
37
|
+
options: string;
|
|
38
|
+
modifiers: string;
|
|
39
|
+
};
|
|
40
|
+
checkout: {
|
|
41
|
+
yourOrder: string;
|
|
42
|
+
orderSummary: string;
|
|
43
|
+
delivery: string;
|
|
44
|
+
address: string;
|
|
45
|
+
payment: string;
|
|
46
|
+
confirmation: string;
|
|
47
|
+
deliveryDetails: string;
|
|
48
|
+
paymentMethod: string;
|
|
49
|
+
placeOrder: string;
|
|
50
|
+
subtotal: string;
|
|
51
|
+
total: string;
|
|
52
|
+
};
|
|
53
|
+
ourStory: {
|
|
54
|
+
title: string;
|
|
55
|
+
subtitle: string;
|
|
56
|
+
by: string;
|
|
57
|
+
paragraph1: string;
|
|
58
|
+
paragraph2: string;
|
|
59
|
+
paragraph3: string;
|
|
60
|
+
paragraph4: string;
|
|
61
|
+
paragraph5: string;
|
|
62
|
+
paragraph6: string;
|
|
63
|
+
signature: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
menuSection: {
|
|
67
|
+
title: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
orderOnline: {
|
|
71
|
+
title: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
hero: {
|
|
75
|
+
title: string;
|
|
76
|
+
subtitle: string;
|
|
77
|
+
};
|
|
78
|
+
introSection: {
|
|
79
|
+
title: string;
|
|
80
|
+
paragraph1: string;
|
|
81
|
+
paragraph2: string;
|
|
82
|
+
};
|
|
83
|
+
reservationSection: {
|
|
84
|
+
title: string;
|
|
85
|
+
description: string;
|
|
86
|
+
};
|
|
87
|
+
testimonialsSection: {
|
|
88
|
+
title: string;
|
|
89
|
+
description: string;
|
|
90
|
+
testimonials: {
|
|
91
|
+
name: string;
|
|
92
|
+
company: string;
|
|
93
|
+
text: string;
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
96
|
+
orderTracking: {
|
|
97
|
+
orderPlaced: string;
|
|
98
|
+
orderPlacedDesc: string;
|
|
99
|
+
orderAccepted: string;
|
|
100
|
+
orderAcceptedDesc: string;
|
|
101
|
+
readyForDispatch: string;
|
|
102
|
+
readyForDispatchDesc: string;
|
|
103
|
+
orderDispatched: string;
|
|
104
|
+
orderDispatchedDesc: string;
|
|
105
|
+
orderDelivered: string;
|
|
106
|
+
orderDeliveredDesc: string;
|
|
107
|
+
orderCancelled: string;
|
|
108
|
+
orderCancelledDesc: string;
|
|
109
|
+
price: string;
|
|
110
|
+
quantity: string;
|
|
111
|
+
subtotal: string;
|
|
112
|
+
total: string;
|
|
113
|
+
poweredBy: string;
|
|
114
|
+
reference: string;
|
|
115
|
+
status: string;
|
|
116
|
+
};
|
|
117
|
+
reservation: {
|
|
118
|
+
reservationDetails: string;
|
|
119
|
+
name: string;
|
|
120
|
+
phone: string;
|
|
121
|
+
guests: string;
|
|
122
|
+
date: string;
|
|
123
|
+
reference: string;
|
|
124
|
+
status: string;
|
|
125
|
+
notSpecified: string;
|
|
126
|
+
invalidDate: string;
|
|
127
|
+
requestSent: string;
|
|
128
|
+
requestSentDesc: string;
|
|
129
|
+
confirmed: string;
|
|
130
|
+
confirmedDesc: string;
|
|
131
|
+
cancelled: string;
|
|
132
|
+
cancelledDesc: string;
|
|
133
|
+
pendingStatus: string;
|
|
134
|
+
confirmedStatus: string;
|
|
135
|
+
cancelledStatus: string;
|
|
136
|
+
poweredBy: string;
|
|
137
|
+
};
|
|
138
|
+
homepage: {
|
|
139
|
+
description: string;
|
|
140
|
+
};
|
|
141
|
+
menu: {
|
|
142
|
+
description: string;
|
|
143
|
+
};
|
|
144
|
+
privacyPolicy: {
|
|
145
|
+
description: string;
|
|
146
|
+
};
|
|
147
|
+
termsAndConditions: {
|
|
148
|
+
description: string;
|
|
149
|
+
};
|
|
150
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { CartItem, LocalizedProduct, PaymentMethodDetails, ShippingMethod, UploadedFile } from '../../../../client/src/index.ts';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
export interface CartContextType {
|
|
4
|
+
locale: string;
|
|
5
|
+
items: CartItem[];
|
|
6
|
+
total: number;
|
|
7
|
+
shipping?: number;
|
|
8
|
+
subtotal: number;
|
|
9
|
+
addItem: (item: CartItem) => void;
|
|
10
|
+
removeItem: (productId: string, modifierGroups?: {
|
|
11
|
+
id: string;
|
|
12
|
+
modifiers: {
|
|
13
|
+
id: string;
|
|
14
|
+
quantity?: number;
|
|
15
|
+
}[];
|
|
16
|
+
}[]) => void;
|
|
17
|
+
updateItemQuantity: (productId: string, quantity: number, modifierGroups?: {
|
|
18
|
+
id: string;
|
|
19
|
+
modifiers: {
|
|
20
|
+
id: string;
|
|
21
|
+
quantity?: number;
|
|
22
|
+
}[];
|
|
23
|
+
}[]) => void;
|
|
24
|
+
clearCart: () => void;
|
|
25
|
+
itemCount: number;
|
|
26
|
+
totalAmount: number;
|
|
27
|
+
onCheckoutClick: () => void;
|
|
28
|
+
openModifiersModal: (product: any, onAddToCart?: () => void) => void;
|
|
29
|
+
closeModifiersModal: () => void;
|
|
30
|
+
isModifiersModalOpen: boolean;
|
|
31
|
+
selectedProduct: any | null;
|
|
32
|
+
onModalAddToCart: (() => void) | undefined;
|
|
33
|
+
products: Record<string, LocalizedProduct>;
|
|
34
|
+
isProductsLoading: boolean;
|
|
35
|
+
paymentMethod: PaymentMethodDetails | null;
|
|
36
|
+
setPaymentMethod: React.Dispatch<React.SetStateAction<PaymentMethodDetails | null>>;
|
|
37
|
+
shippingMethod: ShippingMethod | null;
|
|
38
|
+
setShippingMethod: React.Dispatch<React.SetStateAction<ShippingMethod | null>>;
|
|
39
|
+
formattedCartItems: FormattedCartItem[];
|
|
40
|
+
}
|
|
41
|
+
export interface FormattedCartItem {
|
|
42
|
+
title: string;
|
|
43
|
+
subtitle: (string | null)[];
|
|
44
|
+
image?: UploadedFile;
|
|
45
|
+
price: string;
|
|
46
|
+
unitPrice: string;
|
|
47
|
+
quantity: number;
|
|
48
|
+
}
|
|
49
|
+
export type CartAction = {
|
|
50
|
+
type: "INITIALIZE_CART";
|
|
51
|
+
payload: CartItem[];
|
|
52
|
+
} | {
|
|
53
|
+
type: "SET_INITIALIZED";
|
|
54
|
+
payload: boolean;
|
|
55
|
+
} | {
|
|
56
|
+
type: "ADD_ITEM";
|
|
57
|
+
payload: CartItem;
|
|
58
|
+
} | {
|
|
59
|
+
type: "UPDATE_ITEM_QUANTITY";
|
|
60
|
+
payload: {
|
|
61
|
+
productId: string;
|
|
62
|
+
modifierGroups?: {
|
|
63
|
+
id: string;
|
|
64
|
+
modifiers: {
|
|
65
|
+
id: string;
|
|
66
|
+
quantity?: number;
|
|
67
|
+
}[];
|
|
68
|
+
}[];
|
|
69
|
+
quantity: number;
|
|
70
|
+
};
|
|
71
|
+
} | {
|
|
72
|
+
type: "REMOVE_ITEM";
|
|
73
|
+
payload: {
|
|
74
|
+
productId: string;
|
|
75
|
+
modifierGroups?: {
|
|
76
|
+
id: string;
|
|
77
|
+
modifiers: {
|
|
78
|
+
id: string;
|
|
79
|
+
quantity?: number;
|
|
80
|
+
}[];
|
|
81
|
+
}[];
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
type: "CLEAR_CART";
|
|
85
|
+
} | {
|
|
86
|
+
type: "OPEN_MODIFIERS_MODAL";
|
|
87
|
+
payload: {
|
|
88
|
+
product: any;
|
|
89
|
+
onAddToCart?: () => void;
|
|
90
|
+
};
|
|
91
|
+
} | {
|
|
92
|
+
type: "CLOSE_MODIFIERS_MODAL";
|
|
93
|
+
} | {
|
|
94
|
+
type: "UPDATE_TOTALS";
|
|
95
|
+
payload: {
|
|
96
|
+
productsData: Record<string, LocalizedProduct>;
|
|
97
|
+
};
|
|
98
|
+
} | {
|
|
99
|
+
type: "REMOVE_UNAVAILABLE_PRODUCTS";
|
|
100
|
+
payload: {
|
|
101
|
+
productsData: Record<string, LocalizedProduct>;
|
|
102
|
+
showAlert?: boolean;
|
|
103
|
+
};
|
|
104
|
+
} | {
|
|
105
|
+
type: "REMOVE_INVALID_PRODUCTS";
|
|
106
|
+
payload: {
|
|
107
|
+
invalidProductIds: string[];
|
|
108
|
+
};
|
|
109
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CartItem, LocalizedProduct } from '../../../../client/src/index.ts';
|
|
2
|
+
import { FormattedCartItem } from '../types/cart.types';
|
|
3
|
+
export declare function formatCartItemData(item: CartItem, product: LocalizedProduct, currency: string, locale: string): FormattedCartItem;
|