bananas-commerce-admin 0.1.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/README.md +25 -0
- package/dist/cjs/Admin.js +47 -0
- package/dist/cjs/App.js +49 -0
- package/dist/cjs/api.js +225 -0
- package/dist/cjs/components/Branding.js +41 -0
- package/dist/cjs/components/Hamburger.js +40 -0
- package/dist/cjs/components/Link.js +21 -0
- package/dist/cjs/components/Logo.js +25 -0
- package/dist/cjs/components/NavBar.js +101 -0
- package/dist/cjs/components/NavBarItem.js +42 -0
- package/dist/cjs/components/NavBarRoutes.js +47 -0
- package/dist/cjs/components/ProgressBar.js +14 -0
- package/dist/cjs/components/User.js +71 -0
- package/dist/cjs/containers/Content.js +16 -0
- package/dist/cjs/containers/ErrorScreen.js +35 -0
- package/dist/cjs/containers/LoadingScreen.js +84 -0
- package/dist/cjs/containers/PageErrorBoundary.js +43 -0
- package/dist/cjs/containers/PageLoader.js +123 -0
- package/dist/cjs/contexts/ApiContext.js +105 -0
- package/dist/cjs/contexts/I18nContext.js +109 -0
- package/dist/cjs/contexts/RouterContext.js +99 -0
- package/dist/cjs/contexts/UserContext.js +144 -0
- package/dist/cjs/extensions/bananas/components/PasswordChangeForm.js +85 -0
- package/dist/cjs/extensions/bananas/index.js +54 -0
- package/dist/cjs/extensions/bananas/pages/me/list.js +20 -0
- package/dist/cjs/extensions/pos/components/PurchaseRow.js +32 -0
- package/dist/cjs/extensions/pos/components/ReceiptCard.js +86 -0
- package/dist/cjs/extensions/pos/components/ReceiptLine.js +29 -0
- package/dist/cjs/extensions/pos/index.js +22 -0
- package/dist/cjs/extensions/pos/pages/purchase/detail.js +13 -0
- package/dist/cjs/extensions/pos/pages/purchase/list.js +34 -0
- package/dist/cjs/extensions/pos/types/purchase.js +2 -0
- package/dist/cjs/extensions/pos/types/receipt.js +2 -0
- package/dist/cjs/forms/LoginForm.js +63 -0
- package/dist/cjs/hooks/useAsyncError.js +15 -0
- package/dist/cjs/hooks/useLocalStorage.js +47 -0
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/pages/DashboardPage.js +10 -0
- package/dist/cjs/pages/LoginPage.js +31 -0
- package/dist/cjs/router/Router.js +35 -0
- package/dist/cjs/router/routes.js +57 -0
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/util/get_cookie.js +10 -0
- package/dist/cjs/util/index.js +62 -0
- package/dist/cjs/util/select_styles.js +38 -0
- package/dist/esm/Admin.js +42 -0
- package/dist/esm/App.js +44 -0
- package/dist/esm/api.js +219 -0
- package/dist/esm/components/Branding.js +36 -0
- package/dist/esm/components/Hamburger.js +35 -0
- package/dist/esm/components/Link.js +16 -0
- package/dist/esm/components/Logo.js +20 -0
- package/dist/esm/components/NavBar.js +73 -0
- package/dist/esm/components/NavBarItem.js +37 -0
- package/dist/esm/components/NavBarRoutes.js +42 -0
- package/dist/esm/components/ProgressBar.js +9 -0
- package/dist/esm/components/User.js +66 -0
- package/dist/esm/containers/Content.js +11 -0
- package/dist/esm/containers/ErrorScreen.js +30 -0
- package/dist/esm/containers/LoadingScreen.js +79 -0
- package/dist/esm/containers/PageErrorBoundary.js +38 -0
- package/dist/esm/containers/PageLoader.js +117 -0
- package/dist/esm/contexts/ApiContext.js +77 -0
- package/dist/esm/contexts/I18nContext.js +77 -0
- package/dist/esm/contexts/RouterContext.js +71 -0
- package/dist/esm/contexts/UserContext.js +113 -0
- package/dist/esm/extensions/bananas/components/PasswordChangeForm.js +80 -0
- package/dist/esm/extensions/bananas/index.js +48 -0
- package/dist/esm/extensions/bananas/pages/me/list.js +15 -0
- package/dist/esm/extensions/pos/components/PurchaseRow.js +25 -0
- package/dist/esm/extensions/pos/components/ReceiptCard.js +56 -0
- package/dist/esm/extensions/pos/components/ReceiptLine.js +22 -0
- package/dist/esm/extensions/pos/index.js +16 -0
- package/dist/esm/extensions/pos/pages/purchase/detail.js +8 -0
- package/dist/esm/extensions/pos/pages/purchase/list.js +29 -0
- package/dist/esm/extensions/pos/types/purchase.js +1 -0
- package/dist/esm/extensions/pos/types/receipt.js +1 -0
- package/dist/esm/forms/LoginForm.js +58 -0
- package/dist/esm/hooks/useAsyncError.js +9 -0
- package/dist/esm/hooks/useLocalStorage.js +41 -0
- package/dist/esm/index.js +14 -0
- package/dist/esm/pages/DashboardPage.js +5 -0
- package/dist/esm/pages/LoginPage.js +26 -0
- package/dist/esm/router/Router.js +28 -0
- package/dist/esm/router/routes.js +49 -0
- package/dist/esm/types/index.js +1 -0
- package/dist/esm/util/get_cookie.js +6 -0
- package/dist/esm/util/index.js +54 -0
- package/dist/esm/util/select_styles.js +34 -0
- package/dist/types/Admin.d.ts +13 -0
- package/dist/types/App.d.ts +13 -0
- package/dist/types/api.d.ts +20 -0
- package/dist/types/components/Branding.d.ts +14 -0
- package/dist/types/components/Hamburger.d.ts +8 -0
- package/dist/types/components/Link.d.ts +9 -0
- package/dist/types/components/Logo.d.ts +7 -0
- package/dist/types/components/NavBar.d.ts +11 -0
- package/dist/types/components/NavBarItem.d.ts +12 -0
- package/dist/types/components/NavBarRoutes.d.ts +7 -0
- package/dist/types/components/ProgressBar.d.ts +7 -0
- package/dist/types/components/User.d.ts +824 -0
- package/dist/types/containers/Content.d.ts +3 -0
- package/dist/types/containers/ErrorScreen.d.ts +7 -0
- package/dist/types/containers/LoadingScreen.d.ts +50 -0
- package/dist/types/containers/PageErrorBoundary.d.ts +16 -0
- package/dist/types/containers/PageLoader.d.ts +13 -0
- package/dist/types/contexts/ApiContext.d.ts +12 -0
- package/dist/types/contexts/I18nContext.d.ts +10 -0
- package/dist/types/contexts/RouterContext.d.ts +24 -0
- package/dist/types/contexts/UserContext.d.ts +20 -0
- package/dist/types/extensions/bananas/components/PasswordChangeForm.d.ts +3 -0
- package/dist/types/extensions/bananas/index.d.ts +2 -0
- package/dist/types/extensions/bananas/pages/me/list.d.ts +6 -0
- package/dist/types/extensions/pos/components/PurchaseRow.d.ts +7 -0
- package/dist/types/extensions/pos/components/ReceiptCard.d.ts +7 -0
- package/dist/types/extensions/pos/components/ReceiptLine.d.ts +7 -0
- package/dist/types/extensions/pos/index.d.ts +2 -0
- package/dist/types/extensions/pos/pages/purchase/detail.d.ts +7 -0
- package/dist/types/extensions/pos/pages/purchase/list.d.ts +9 -0
- package/dist/types/extensions/pos/types/purchase.d.ts +18 -0
- package/dist/types/extensions/pos/types/receipt.d.ts +34 -0
- package/dist/types/forms/LoginForm.d.ts +3 -0
- package/dist/types/hooks/useAsyncError.d.ts +1 -0
- package/dist/types/hooks/useLocalStorage.d.ts +2 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/pages/DashboardPage.d.ts +5 -0
- package/dist/types/pages/LoginPage.d.ts +9 -0
- package/dist/types/router/Router.d.ts +13 -0
- package/dist/types/router/routes.d.ts +20 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/util/get_cookie.d.ts +1 -0
- package/dist/types/util/index.d.ts +8 -0
- package/dist/types/util/select_styles.d.ts +3 -0
- package/example/Dockerfile +27 -0
- package/example/docker-compose.yml +7 -0
- package/example/index.html +13 -0
- package/example/index.tsx +21 -0
- package/example/package-lock.json +13167 -0
- package/example/package.json +52 -0
- package/example/pages/.gitkeep +0 -0
- package/example/webpack.config.js +67 -0
- package/package.json +52 -0
- package/src/Admin.tsx +94 -0
- package/src/App.tsx +43 -0
- package/src/api.ts +202 -0
- package/src/components/Branding.tsx +79 -0
- package/src/components/Hamburger.tsx +41 -0
- package/src/components/Link.tsx +23 -0
- package/src/components/Logo.tsx +57 -0
- package/src/components/NavBar.tsx +115 -0
- package/src/components/NavBarItem.tsx +73 -0
- package/src/components/NavBarRoutes.tsx +67 -0
- package/src/components/ProgressBar.tsx +30 -0
- package/src/components/User.tsx +97 -0
- package/src/containers/Content.tsx +18 -0
- package/src/containers/ErrorScreen.tsx +64 -0
- package/src/containers/LoadingScreen.tsx +135 -0
- package/src/containers/PageErrorBoundary.tsx +32 -0
- package/src/containers/PageLoader.tsx +64 -0
- package/src/contexts/ApiContext.tsx +55 -0
- package/src/contexts/I18nContext.tsx +55 -0
- package/src/contexts/RouterContext.tsx +127 -0
- package/src/contexts/UserContext.tsx +99 -0
- package/src/extensions/bananas/components/PasswordChangeForm.tsx +138 -0
- package/src/extensions/bananas/index.ts +14 -0
- package/src/extensions/bananas/pages/me/list.tsx +31 -0
- package/src/extensions/pos/components/PurchaseRow.tsx +42 -0
- package/src/extensions/pos/components/ReceiptCard.tsx +101 -0
- package/src/extensions/pos/components/ReceiptLine.tsx +51 -0
- package/src/extensions/pos/index.tsx +20 -0
- package/src/extensions/pos/pages/purchase/detail.tsx +22 -0
- package/src/extensions/pos/pages/purchase/list.tsx +56 -0
- package/src/extensions/pos/types/purchase.ts +20 -0
- package/src/extensions/pos/types/receipt.ts +36 -0
- package/src/forms/LoginForm.tsx +99 -0
- package/src/hooks/useAsyncError.ts +13 -0
- package/src/hooks/useLocalStorage.ts +42 -0
- package/src/index.ts +18 -0
- package/src/pages/DashboardPage.tsx +9 -0
- package/src/pages/LoginPage.tsx +50 -0
- package/src/router/Router.tsx +63 -0
- package/src/router/routes.ts +67 -0
- package/src/types/index.ts +4 -0
- package/src/types/swagger-client.d.ts +1 -0
- package/src/util/get_cookie.ts +6 -0
- package/src/util/index.ts +63 -0
- package/src/util/select_styles.ts +29 -0
- package/tsconfig.json +38 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Theme } from "@mui/material/styles";
|
|
3
|
+
import { LogoType } from "../types";
|
|
4
|
+
declare const styles: (theme: Theme) => {
|
|
5
|
+
readonly root: {
|
|
6
|
+
readonly position: "relative";
|
|
7
|
+
readonly top: 0;
|
|
8
|
+
readonly left: 0;
|
|
9
|
+
readonly width: "100%";
|
|
10
|
+
readonly height: "100%";
|
|
11
|
+
readonly display: "flex";
|
|
12
|
+
readonly flexDirection: "column";
|
|
13
|
+
readonly alignItems: "center";
|
|
14
|
+
readonly justifyContent: "center";
|
|
15
|
+
};
|
|
16
|
+
readonly backdrop: {
|
|
17
|
+
readonly position: "absolute";
|
|
18
|
+
readonly zIndex: 2000;
|
|
19
|
+
readonly backgroundColor: string;
|
|
20
|
+
};
|
|
21
|
+
readonly backdropPrimary: {
|
|
22
|
+
readonly backgroundColor: string;
|
|
23
|
+
};
|
|
24
|
+
readonly backdropSecondary: {
|
|
25
|
+
readonly backgroundColor: string;
|
|
26
|
+
};
|
|
27
|
+
readonly backdropPaper: {
|
|
28
|
+
readonly backgroundColor: string;
|
|
29
|
+
};
|
|
30
|
+
readonly spinner: {
|
|
31
|
+
readonly color: string;
|
|
32
|
+
};
|
|
33
|
+
readonly spinnerContrast: {
|
|
34
|
+
readonly color: string;
|
|
35
|
+
};
|
|
36
|
+
readonly logo: {
|
|
37
|
+
readonly position: "absolute";
|
|
38
|
+
readonly margin: 0;
|
|
39
|
+
readonly marginTop: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
interface LoadingScreenProps {
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
logo?: LogoType;
|
|
45
|
+
backdrop?: boolean;
|
|
46
|
+
color?: string;
|
|
47
|
+
classes?: ReturnType<typeof styles>;
|
|
48
|
+
}
|
|
49
|
+
declare const LoadingScreen: React.FC<LoadingScreenProps>;
|
|
50
|
+
export default LoadingScreen;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface PageErrorBoundaryProps<T = Error> {
|
|
3
|
+
errorPage: React.ComponentType<{
|
|
4
|
+
error: T;
|
|
5
|
+
}>;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
}
|
|
8
|
+
export default class PageErrorBoundary<T = Error> extends React.Component<PageErrorBoundaryProps<T>> {
|
|
9
|
+
state: {
|
|
10
|
+
error: T | null;
|
|
11
|
+
};
|
|
12
|
+
errorPage: PageErrorBoundaryProps<T>["errorPage"];
|
|
13
|
+
constructor(props: PageErrorBoundaryProps<T>);
|
|
14
|
+
componentDidCatch(error: Error): void;
|
|
15
|
+
render(): React.ReactNode;
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RouteInfo } from "../contexts/RouterContext";
|
|
3
|
+
import { PageComponent } from "../types";
|
|
4
|
+
export declare class PageLoadFailedError extends Error {
|
|
5
|
+
readonly response: Response;
|
|
6
|
+
constructor(response: Response, message?: string);
|
|
7
|
+
}
|
|
8
|
+
export interface PageLoaderProps {
|
|
9
|
+
route: RouteInfo;
|
|
10
|
+
page: PageComponent | Promise<PageComponent>;
|
|
11
|
+
}
|
|
12
|
+
declare const PageLoader: React.FC<PageLoaderProps>;
|
|
13
|
+
export default PageLoader;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ApiClient } from "../api";
|
|
3
|
+
export interface ApiContextProviderProps {
|
|
4
|
+
api: ApiClient | string | URL | {
|
|
5
|
+
schema: string | URL;
|
|
6
|
+
server?: string | URL;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare const ApiContext: React.Context<ApiClient>;
|
|
10
|
+
export declare const useApi: () => ApiClient;
|
|
11
|
+
export declare const ApiContextProvider: React.FC<React.PropsWithChildren<ApiContextProviderProps>>;
|
|
12
|
+
export default ApiContext;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export declare function interpolateString(string: string, params: Record<string, string> | string[]): string;
|
|
3
|
+
interface I18nContext {
|
|
4
|
+
i18n: any;
|
|
5
|
+
t: (key: string, params?: Record<string, string> | string[]) => string;
|
|
6
|
+
}
|
|
7
|
+
declare const I18nContext: React.Context<I18nContext>;
|
|
8
|
+
export declare const useI18n: () => I18nContext;
|
|
9
|
+
export declare const I18nContextProvider: React.FC<React.PropsWithChildren<{}>>;
|
|
10
|
+
export default I18nContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface RouteInfo {
|
|
3
|
+
id: string;
|
|
4
|
+
app: string;
|
|
5
|
+
view: string;
|
|
6
|
+
action: string;
|
|
7
|
+
title: string;
|
|
8
|
+
navigation: boolean;
|
|
9
|
+
path: string;
|
|
10
|
+
page: string;
|
|
11
|
+
}
|
|
12
|
+
interface RouterContext {
|
|
13
|
+
routes: RouteInfo[];
|
|
14
|
+
getRoute(reverse: string): RouteInfo | undefined;
|
|
15
|
+
navigate(route: number | string | RouteInfo, options?: {
|
|
16
|
+
params?: Record<string, string | number | boolean>;
|
|
17
|
+
query?: URLSearchParams;
|
|
18
|
+
replace?: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
}
|
|
21
|
+
declare const RouterContext: React.Context<RouterContext>;
|
|
22
|
+
export declare const useRouter: () => RouterContext;
|
|
23
|
+
export declare const RouterContextProvider: React.FC<React.PropsWithChildren<{}>>;
|
|
24
|
+
export default RouterContext;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface User {
|
|
3
|
+
id: string;
|
|
4
|
+
email: string;
|
|
5
|
+
is_superuser: boolean;
|
|
6
|
+
groups: string[];
|
|
7
|
+
full_name: string;
|
|
8
|
+
username: string;
|
|
9
|
+
permissions: string[];
|
|
10
|
+
}
|
|
11
|
+
interface UserContext {
|
|
12
|
+
user: User | null;
|
|
13
|
+
login: (username: string, password: string) => Promise<User | null>;
|
|
14
|
+
logout: () => Promise<void>;
|
|
15
|
+
changePassword: (oldPassword: string, newPassword1: string, newPassword2: string) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
declare const UserContext: React.Context<UserContext>;
|
|
18
|
+
export declare const useUser: () => UserContext;
|
|
19
|
+
export declare const UserContextProvider: React.FC<React.PropsWithChildren<{}>>;
|
|
20
|
+
export default UserContext;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Receipt } from "./receipt";
|
|
2
|
+
export interface Purchase {
|
|
3
|
+
number: string;
|
|
4
|
+
checkout_session?: string;
|
|
5
|
+
main_payment_identifier?: string;
|
|
6
|
+
date_initiated: string;
|
|
7
|
+
date_confirmed: string;
|
|
8
|
+
currency?: string;
|
|
9
|
+
site_code: string;
|
|
10
|
+
locale: string;
|
|
11
|
+
country_code: string;
|
|
12
|
+
email: string;
|
|
13
|
+
phone?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PurchaseDetail {
|
|
16
|
+
purchase: Purchase;
|
|
17
|
+
receipts: Receipt[];
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export interface Receipt {
|
|
2
|
+
number: string;
|
|
3
|
+
total_amount: string;
|
|
4
|
+
total_discount_amount: string;
|
|
5
|
+
total_tax_amount: string;
|
|
6
|
+
date_settled?: string;
|
|
7
|
+
/**
|
|
8
|
+
* | | Intention |
|
|
9
|
+
* | - | ------------ |
|
|
10
|
+
* | 1 | payment |
|
|
11
|
+
* | 2 | cancellation |
|
|
12
|
+
* | 3 | refund |
|
|
13
|
+
*/
|
|
14
|
+
intention: 1 | 2 | 3;
|
|
15
|
+
lines: ReceiptLine[];
|
|
16
|
+
}
|
|
17
|
+
export interface ReceiptLine {
|
|
18
|
+
reference: string;
|
|
19
|
+
title: string;
|
|
20
|
+
line_number: number;
|
|
21
|
+
item_type: string;
|
|
22
|
+
quantity: number;
|
|
23
|
+
unit_price: string;
|
|
24
|
+
total_amount: string;
|
|
25
|
+
total_discount_amount: string;
|
|
26
|
+
discounts: ReceiptLineDiscount[];
|
|
27
|
+
tax_rate: string;
|
|
28
|
+
tax_code: string;
|
|
29
|
+
total_tax_amount: string;
|
|
30
|
+
}
|
|
31
|
+
export interface ReceiptLineDiscount {
|
|
32
|
+
title: string;
|
|
33
|
+
amount: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useAsyncError(): (e: any) => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { default as ProgressBar } from "./components/ProgressBar";
|
|
2
|
+
export { default as Content } from "./containers/Content";
|
|
3
|
+
export { default as Logo } from "./components/Logo";
|
|
4
|
+
export { default as Link } from "./components/Link";
|
|
5
|
+
export * from "./contexts/ApiContext";
|
|
6
|
+
export * from "./contexts/I18nContext";
|
|
7
|
+
export * from "./contexts/RouterContext";
|
|
8
|
+
export * from "./contexts/UserContext";
|
|
9
|
+
export * from "./containers/LoadingScreen";
|
|
10
|
+
export { default as Admin } from "./Admin";
|
|
11
|
+
export { default as App } from "./App";
|
|
12
|
+
export * from "./api";
|
|
13
|
+
export * from "./extensions/bananas";
|
|
14
|
+
export * from "./extensions/pos";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { RouteInfo } from "../contexts/RouterContext";
|
|
3
|
+
import { PageComponent } from "../types";
|
|
4
|
+
export interface RouterExtension {
|
|
5
|
+
app: string;
|
|
6
|
+
pages: (route: RouteInfo) => PageComponent | Promise<PageComponent>;
|
|
7
|
+
}
|
|
8
|
+
export interface RouterProps {
|
|
9
|
+
dashboard?: React.ComponentType;
|
|
10
|
+
extensions?: RouterExtension[];
|
|
11
|
+
pages: (route: RouteInfo) => PageComponent | Promise<PageComponent>;
|
|
12
|
+
}
|
|
13
|
+
export declare const Router: React.FC<RouterProps>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses an `operationId` returning app, view and action
|
|
3
|
+
*
|
|
4
|
+
* ## Examples
|
|
5
|
+
*
|
|
6
|
+
* `bananas.me:list` -> `{ app: "bananas", view: "me", action: "list" }`
|
|
7
|
+
*
|
|
8
|
+
* `bananas.login:create` -> `{ app: "bananas", view: "login", action: "create" }`
|
|
9
|
+
*
|
|
10
|
+
* `bananas.i18n:list` -> `{ app: "bananas", view: "i18n", action: "list" }`
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseOperationId(operationId: string): {
|
|
13
|
+
app: string;
|
|
14
|
+
view: string;
|
|
15
|
+
action: string;
|
|
16
|
+
} | undefined;
|
|
17
|
+
export declare function isNavigation(tags: string[]): boolean;
|
|
18
|
+
export declare function getPath(endpoint: string, method: string, action: string | undefined): string;
|
|
19
|
+
export declare function getPage(path: string, action: string | undefined): string;
|
|
20
|
+
export declare function getTitle(view: string, summary?: string): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCookie(name: string): string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function ensureTrailingSlash(path: string): string;
|
|
2
|
+
export declare function ensureLeadingHash(hash: string): string;
|
|
3
|
+
export declare function absolutePath(path: string, basename?: string): string;
|
|
4
|
+
export declare function nthIndexOf(str: string, pattern: string, n: number, start?: number): number;
|
|
5
|
+
/**
|
|
6
|
+
* Like Python’s `.capitalize()`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function capitalize(string: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
FROM node:16 as build
|
|
2
|
+
|
|
3
|
+
# Set working directory
|
|
4
|
+
WORKDIR /usr/src/app
|
|
5
|
+
|
|
6
|
+
# Install dependencies, do this first to enable caching and re-running only
|
|
7
|
+
# when dependencies change!
|
|
8
|
+
COPY package*.json .
|
|
9
|
+
RUN npm ci
|
|
10
|
+
|
|
11
|
+
# Copy the source
|
|
12
|
+
COPY . .
|
|
13
|
+
|
|
14
|
+
# Pre-build bananas-commerce-admin
|
|
15
|
+
WORKDIR /usr/src/app/node_modules/bananas-commerce-admin
|
|
16
|
+
RUN npm run build
|
|
17
|
+
|
|
18
|
+
# Return back to the correct working directory
|
|
19
|
+
WORKDIR /usr/src/app
|
|
20
|
+
|
|
21
|
+
# Build the app source
|
|
22
|
+
RUN npm run build
|
|
23
|
+
|
|
24
|
+
FROM lipanski/docker-static-website:2.1.0
|
|
25
|
+
|
|
26
|
+
# Copy the built app from the build step
|
|
27
|
+
COPY --from=build /usr/src/app/dist /home/static
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="initial-scale=1, width=device-width" />
|
|
6
|
+
<meta name="theme-color" content="#000000" />
|
|
7
|
+
<title>Bananas Commerce Admin</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
11
|
+
<div id="root"></div>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import * as Bananas from "bananas-commerce-admin";
|
|
4
|
+
|
|
5
|
+
ReactDOM.render(
|
|
6
|
+
<React.StrictMode>
|
|
7
|
+
<Bananas.App
|
|
8
|
+
api={{
|
|
9
|
+
schema: "http://localhost:8123/_/admin/api/v1/openapi.json",
|
|
10
|
+
server: "http://localhost:8123/_/admin/api/v1/",
|
|
11
|
+
}}
|
|
12
|
+
nav={{}}
|
|
13
|
+
extensions={[Bananas.bananasRouterExtension, Bananas.posRouterExtension]}
|
|
14
|
+
pages={async (route) => {
|
|
15
|
+
console.log(route);
|
|
16
|
+
return (await import(`./pages/${route.page}`)).default;
|
|
17
|
+
}}
|
|
18
|
+
/>
|
|
19
|
+
</React.StrictMode>,
|
|
20
|
+
document.getElementById("root") as HTMLElement,
|
|
21
|
+
);
|