@develemit/commerce-admin 0.6.0 → 0.8.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/CHANGELOG.md +148 -0
- package/README.md +88 -9
- package/dist/client/admin-client.d.ts +4 -2
- package/dist/client/errors.d.ts +9 -0
- package/dist/client/index.js +1 -1
- package/dist/client-ClTCzt-p.js +190 -0
- package/dist/client-ClTCzt-p.js.map +1 -0
- package/dist/components/admin-layout/admin-layout.d.ts +6 -6
- package/dist/components/admin-layout/current-item.d.ts +1 -0
- package/dist/components/admin-layout/nav-icons.d.ts +9 -0
- package/dist/components/admin-layout/nav-items.d.ts +39 -0
- package/dist/components/admin-layout/use-current-href.d.ts +1 -0
- package/dist/components/admin-layout/use-more-sheet.d.ts +5 -0
- package/dist/components/empty-state/empty-state.d.ts +10 -0
- package/dist/components/notice/notice.d.ts +5 -1
- package/dist/components/page-header/admin-page-header.d.ts +8 -0
- package/dist/components/setup-checklist/setup-checklist.d.ts +15 -0
- package/dist/components/switch/switch.d.ts +7 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +3758 -1276
- package/dist/index.js.map +1 -1
- package/dist/lib/admin-labels.d.ts +5 -0
- package/dist/lib/currency-symbol.d.ts +1 -0
- package/dist/lib/discount-labels.d.ts +1 -0
- package/dist/lib/fill-alts.d.ts +3 -0
- package/dist/lib/order-action-labels.d.ts +2 -0
- package/dist/lib/order-labels.d.ts +1 -0
- package/dist/lib/product-draft.d.ts +14 -0
- package/dist/lib/product-flow-labels.d.ts +63 -0
- package/dist/lib/product-labels.d.ts +61 -0
- package/dist/lib/product-missing.d.ts +4 -0
- package/dist/lib/product-sheet-actions.d.ts +13 -0
- package/dist/lib/provider.d.ts +2 -0
- package/dist/lib/shipping-labels.d.ts +2 -0
- package/dist/lib/stock-labels.d.ts +43 -0
- package/dist/lib/use-batch-upload.d.ts +39 -0
- package/dist/lib/use-focus-trap.d.ts +2 -0
- package/dist/lib/use-image-upload.d.ts +3 -2
- package/dist/lib/use-product-autosave.d.ts +99 -0
- package/dist/lib/use-product-pages.d.ts +3 -2
- package/dist/styles.css +1743 -57
- package/dist/views/orders/admin-order-detail.d.ts +2 -1
- package/dist/views/orders/order-actions.d.ts +2 -1
- package/dist/views/orders/resolve-button.d.ts +3 -1
- package/dist/views/orders/ship-form.d.ts +4 -1
- package/dist/views/products/add-several/admin-add-several.d.ts +5 -0
- package/dist/views/products/add-several/photo-picker.d.ts +9 -0
- package/dist/views/products/admin-product-editor.d.ts +3 -1
- package/dist/views/products/admin-product-images.d.ts +2 -0
- package/dist/views/products/admin-product-list.d.ts +13 -1
- package/dist/views/products/finish-drafts/admin-finish-drafts.d.ts +7 -0
- package/dist/views/products/finish-drafts/piece-card.d.ts +10 -0
- package/dist/views/products/finish-drafts/piece-fields.d.ts +7 -0
- package/dist/views/products/finish-drafts/piece-summary.d.ts +11 -0
- package/dist/views/products/finish-drafts/use-publish-pieces.d.ts +54 -0
- package/dist/views/products/product-card.d.ts +6 -0
- package/dist/views/products/product-flow/admin-product-flow.d.ts +15 -0
- package/dist/views/products/product-flow/basics-section.d.ts +6 -0
- package/dist/views/products/product-flow/flow-actions.d.ts +13 -0
- package/dist/views/products/product-flow/flow-frame.d.ts +30 -0
- package/dist/views/products/product-flow/flow-images.d.ts +7 -0
- package/dist/views/products/product-flow/flow-section-props.d.ts +5 -0
- package/dist/views/products/product-flow/flow-success.d.ts +8 -0
- package/dist/views/products/product-flow/flow-test-helpers.d.ts +12 -0
- package/dist/views/products/product-flow/materials-field.d.ts +6 -0
- package/dist/views/products/product-flow/photos-section.d.ts +9 -0
- package/dist/views/products/product-flow/preview-section.d.ts +10 -0
- package/dist/views/products/product-flow/story-section.d.ts +8 -0
- package/dist/views/products/product-flow/use-product-flow.d.ts +143 -0
- package/dist/views/products/product-sheet/admin-product-sheet.d.ts +8 -0
- package/dist/views/products/product-sheet/delete-draft-button.d.ts +9 -0
- package/dist/views/products/product-sheet/sheet-carousel.d.ts +4 -0
- package/dist/views/products/product-sheet/sheet-edit-link.d.ts +14 -0
- package/dist/views/products/product-sheet/use-product-change.d.ts +16 -0
- package/dist/views/products/product-toolbar.d.ts +10 -0
- package/dist/views/products/product-welcome.d.ts +8 -0
- package/dist/views/shipping/admin-shipping-rates.d.ts +6 -1
- package/dist/views/shipping/shipping-rate-row.d.ts +2 -1
- package/package.json +11 -3
- package/dist/client-CSjuKdIE.js +0 -178
- package/dist/client-CSjuKdIE.js.map +0 -1
|
@@ -2,9 +2,10 @@ import { ReactNode } from 'react';
|
|
|
2
2
|
import { AdminOrderDetail as OrderDetail } from '@develemit/commerce-contracts';
|
|
3
3
|
export interface AdminOrderDetailProps {
|
|
4
4
|
orderId: string;
|
|
5
|
+
requireTracking?: boolean;
|
|
5
6
|
actions?: (ctx: {
|
|
6
7
|
order: OrderDetail;
|
|
7
8
|
reload: () => void;
|
|
8
9
|
}) => ReactNode;
|
|
9
10
|
}
|
|
10
|
-
export declare function AdminOrderDetail({ orderId, actions }: AdminOrderDetailProps): import('react').JSX.Element;
|
|
11
|
+
export declare function AdminOrderDetail({ orderId, actions, requireTracking, }: AdminOrderDetailProps): import('react').JSX.Element;
|
|
@@ -2,6 +2,7 @@ import { AdminOrderDetail } from '@develemit/commerce-contracts';
|
|
|
2
2
|
interface OrderActionsProps {
|
|
3
3
|
order: AdminOrderDetail;
|
|
4
4
|
reload: () => void;
|
|
5
|
+
requireTracking?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export declare function OrderActions({ order, reload }: OrderActionsProps): import('react').JSX.Element;
|
|
7
|
+
export declare function OrderActions({ order, reload, requireTracking, }: OrderActionsProps): import('react').JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { AdminOrderDetail } from '@develemit/commerce-contracts';
|
|
2
3
|
interface ResolveButtonProps {
|
|
3
4
|
order: AdminOrderDetail;
|
|
4
5
|
onDone: (message: string) => void;
|
|
6
|
+
notice?: ReactNode;
|
|
5
7
|
}
|
|
6
|
-
export declare function ResolveButton({ order, onDone }: ResolveButtonProps): import('react').JSX.Element;
|
|
8
|
+
export declare function ResolveButton({ order, onDone, notice }: ResolveButtonProps): import('react').JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { AdminOrderDetail } from '@develemit/commerce-contracts';
|
|
2
3
|
interface ShipFormProps {
|
|
3
4
|
order: AdminOrderDetail;
|
|
4
5
|
onDone: (message: string) => void;
|
|
6
|
+
requireTracking?: boolean;
|
|
7
|
+
notice?: ReactNode;
|
|
5
8
|
}
|
|
6
|
-
export declare function ShipForm({ order, onDone }: ShipFormProps): import('react').JSX.Element;
|
|
9
|
+
export declare function ShipForm({ order, onDone, requireTracking, notice, }: ShipFormProps): import('react').JSX.Element;
|
|
7
10
|
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface PhotoPickerProps {
|
|
2
|
+
label: string;
|
|
3
|
+
onFiles: (files: File[]) => void;
|
|
4
|
+
multiple?: boolean;
|
|
5
|
+
primary?: boolean;
|
|
6
|
+
zone?: boolean;
|
|
7
|
+
hint?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function PhotoPicker({ label, onFiles, multiple, primary, zone, hint, }: PhotoPickerProps): import('react').JSX.Element;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
3
|
+
import { ProductFlowStep } from '../../lib/product-flow-labels';
|
|
3
4
|
export interface AdminProductEditorProps {
|
|
4
5
|
productId?: string;
|
|
5
6
|
onSaved?: (product: AdminProduct) => void;
|
|
6
7
|
imagesSlot?: ReactNode;
|
|
7
8
|
categories?: string[];
|
|
9
|
+
initialStep?: ProductFlowStep;
|
|
8
10
|
}
|
|
9
|
-
export declare function AdminProductEditor({ productId, onSaved, imagesSlot, categories, }: AdminProductEditorProps): import('react').JSX.Element;
|
|
11
|
+
export declare function AdminProductEditor({ productId, onSaved, imagesSlot, categories, initialStep, }: AdminProductEditorProps): import('react').JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { AdminProductImage } from './image-tile';
|
|
2
|
+
/** @deprecated Use `AdminProductFlow`, which has its own Photos step. Removed in the next major. */
|
|
2
3
|
export interface AdminProductImagesProps {
|
|
3
4
|
productId: string;
|
|
4
5
|
images: AdminProductImage[];
|
|
5
6
|
}
|
|
7
|
+
/** @deprecated Use `AdminProductFlow`, which has its own Photos step. Removed in the next major. */
|
|
6
8
|
export declare function AdminProductImages({ productId, images: initial, }: AdminProductImagesProps): import('react').JSX.Element;
|
|
@@ -1 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
3
|
+
import { SetupStep } from '../../components/setup-checklist/setup-checklist';
|
|
4
|
+
import { EditProduct } from './product-sheet/sheet-edit-link';
|
|
5
|
+
export interface AdminProductListProps {
|
|
6
|
+
welcome?: ReactNode;
|
|
7
|
+
setup?: SetupStep[];
|
|
8
|
+
onAddMany?: () => void;
|
|
9
|
+
onFinishDrafts?: () => void;
|
|
10
|
+
onOpenProduct?: (product: AdminProduct) => void;
|
|
11
|
+
onEditProduct?: EditProduct;
|
|
12
|
+
}
|
|
13
|
+
export declare function AdminProductList({ welcome, setup, onAddMany, onFinishDrafts, onOpenProduct, onEditProduct, }?: AdminProductListProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PublishOutcome } from './use-publish-pieces';
|
|
2
|
+
export interface AdminFinishDraftsProps {
|
|
3
|
+
productIds?: string[];
|
|
4
|
+
categories?: string[];
|
|
5
|
+
onDone: (result: PublishOutcome) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function AdminFinishDrafts({ productIds, categories, onDone, }: AdminFinishDraftsProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export interface PieceCardProps {
|
|
3
|
+
product: AdminProduct;
|
|
4
|
+
index: number;
|
|
5
|
+
total: number;
|
|
6
|
+
categories?: string[];
|
|
7
|
+
onAdvance: (product: AdminProduct) => void;
|
|
8
|
+
onBack?: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function PieceCard({ product, index, total, categories, onAdvance, onBack, }: PieceCardProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProductForm } from '../../../lib/product-form';
|
|
2
|
+
export interface PieceFieldsProps {
|
|
3
|
+
form: ProductForm;
|
|
4
|
+
update: <K extends 'name' | 'price' | 'category'>(field: K, value: string) => void;
|
|
5
|
+
categories?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function PieceFields({ form, update, categories }: PieceFieldsProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export interface PieceSummaryProps {
|
|
3
|
+
pieces: AdminProduct[];
|
|
4
|
+
pending: boolean;
|
|
5
|
+
failure: unknown;
|
|
6
|
+
onPublish: (ready: AdminProduct[], rest: AdminProduct[]) => void;
|
|
7
|
+
onOpenPiece: (index: number) => void;
|
|
8
|
+
onKeepDrafts: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function isReady(piece: AdminProduct): boolean;
|
|
11
|
+
export declare function PieceSummary({ pieces, pending, failure, onPublish, onOpenPiece, onKeepDrafts, }: PieceSummaryProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export interface PublishOutcome {
|
|
3
|
+
published: AdminProduct[];
|
|
4
|
+
drafts: AdminProduct[];
|
|
5
|
+
}
|
|
6
|
+
export declare function usePublishPieces(): {
|
|
7
|
+
publish: (ready: AdminProduct[], rest: AdminProduct[]) => Promise<{
|
|
8
|
+
published: {
|
|
9
|
+
id: string;
|
|
10
|
+
slug: string;
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
materials: string | null;
|
|
14
|
+
dimensions: string | null;
|
|
15
|
+
priceCents: number | null;
|
|
16
|
+
currency: string;
|
|
17
|
+
category: string | null;
|
|
18
|
+
quantity: number;
|
|
19
|
+
status: "draft" | "active" | "archived";
|
|
20
|
+
featured: boolean;
|
|
21
|
+
everPublished: boolean;
|
|
22
|
+
images: {
|
|
23
|
+
id: string;
|
|
24
|
+
url: string;
|
|
25
|
+
alt: string;
|
|
26
|
+
position: number;
|
|
27
|
+
}[];
|
|
28
|
+
}[];
|
|
29
|
+
drafts: {
|
|
30
|
+
id: string;
|
|
31
|
+
slug: string;
|
|
32
|
+
name: string;
|
|
33
|
+
description: string;
|
|
34
|
+
materials: string | null;
|
|
35
|
+
dimensions: string | null;
|
|
36
|
+
priceCents: number | null;
|
|
37
|
+
currency: string;
|
|
38
|
+
category: string | null;
|
|
39
|
+
quantity: number;
|
|
40
|
+
status: "draft" | "active" | "archived";
|
|
41
|
+
featured: boolean;
|
|
42
|
+
everPublished: boolean;
|
|
43
|
+
images: {
|
|
44
|
+
id: string;
|
|
45
|
+
url: string;
|
|
46
|
+
alt: string;
|
|
47
|
+
position: number;
|
|
48
|
+
}[];
|
|
49
|
+
}[];
|
|
50
|
+
}>;
|
|
51
|
+
pending: boolean;
|
|
52
|
+
failure: unknown;
|
|
53
|
+
outcome: PublishOutcome | null;
|
|
54
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
3
|
+
import { ProductFlowStep } from '../../../lib/product-flow-labels';
|
|
4
|
+
export type { ProductFlowStep } from '../../../lib/product-flow-labels';
|
|
5
|
+
export interface AdminProductFlowProps {
|
|
6
|
+
productId?: string;
|
|
7
|
+
initialStep?: ProductFlowStep;
|
|
8
|
+
onDone?: (product: AdminProduct) => void;
|
|
9
|
+
onClose?: (product: AdminProduct | null) => void;
|
|
10
|
+
categories?: string[];
|
|
11
|
+
materialSuggestions?: string[];
|
|
12
|
+
isFirstProduct?: boolean;
|
|
13
|
+
imagesSlot?: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function AdminProductFlow(props: AdminProductFlowProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { FlowSectionProps } from './flow-section-props';
|
|
2
|
+
export interface BasicsSectionProps extends FlowSectionProps {
|
|
3
|
+
categories?: string[];
|
|
4
|
+
currency: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function BasicsSection({ form, update, categories, currency, }: BasicsSectionProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ProductFlowStep } from '../../../lib/product-flow-labels';
|
|
2
|
+
import { ProductFlowState } from './use-product-flow';
|
|
3
|
+
export declare function nextStep(step: ProductFlowStep): ProductFlowStep;
|
|
4
|
+
export declare function previousStep(step: ProductFlowStep): ProductFlowStep | null;
|
|
5
|
+
export declare function FinishActions({ flow }: {
|
|
6
|
+
flow: ProductFlowState;
|
|
7
|
+
}): import('react').JSX.Element;
|
|
8
|
+
export declare function StepActions({ flow }: {
|
|
9
|
+
flow: ProductFlowState;
|
|
10
|
+
}): import('react').JSX.Element;
|
|
11
|
+
export declare function ContinueHint({ flow }: {
|
|
12
|
+
flow: ProductFlowState;
|
|
13
|
+
}): import('react').JSX.Element | null;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ProductFlowStep } from '../../../lib/product-flow-labels';
|
|
3
|
+
import { AutosaveState } from '../../../lib/use-product-autosave';
|
|
4
|
+
export interface FlowHeadProps {
|
|
5
|
+
title: string;
|
|
6
|
+
step: ProductFlowStep;
|
|
7
|
+
onBack: () => void;
|
|
8
|
+
canGoBack: boolean;
|
|
9
|
+
close: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function FlowHead({ title, step, onBack, canGoBack, close, }: FlowHeadProps): import('react').JSX.Element;
|
|
12
|
+
export interface StepBarProps {
|
|
13
|
+
step: ProductFlowStep;
|
|
14
|
+
allOpen: boolean;
|
|
15
|
+
onStep: (step: ProductFlowStep) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function StepBar({ step, allOpen, onStep }: StepBarProps): import('react').JSX.Element;
|
|
18
|
+
export interface SaveNoteProps {
|
|
19
|
+
state: AutosaveState;
|
|
20
|
+
isNew: boolean;
|
|
21
|
+
onRetry: () => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function SaveNote({ state, isNew, onRetry }: SaveNoteProps): import('react').JSX.Element | null;
|
|
24
|
+
export interface FlowSectionFrameProps {
|
|
25
|
+
step: ProductFlowStep;
|
|
26
|
+
active: boolean;
|
|
27
|
+
live?: boolean;
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
}
|
|
30
|
+
export declare function FlowSectionFrame({ step, active, live, children, }: FlowSectionFrameProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
import { FlowSuccess } from './use-product-flow';
|
|
3
|
+
export interface FlowSuccessViewProps {
|
|
4
|
+
success: FlowSuccess;
|
|
5
|
+
onAddAnother: () => void;
|
|
6
|
+
onDone?: (product: AdminProduct) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function FlowSuccessView({ success, onAddAnother, onDone, }: FlowSuccessViewProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export declare function draft(overrides?: Partial<AdminProduct>): AdminProduct;
|
|
3
|
+
export declare function image(id: string, position: number, alt?: string): {
|
|
4
|
+
id: string;
|
|
5
|
+
url: string;
|
|
6
|
+
alt: string;
|
|
7
|
+
position: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function type(label: string, value: string): void;
|
|
10
|
+
export declare function click(name: string | RegExp): void;
|
|
11
|
+
export declare function pickFiles(files: File[]): void;
|
|
12
|
+
export declare const png: (name?: string) => File;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
3
|
+
export interface PhotosSectionProps {
|
|
4
|
+
product: AdminProduct | null;
|
|
5
|
+
ensureProduct: () => Promise<AdminProduct>;
|
|
6
|
+
setProduct: (next: AdminProduct) => void;
|
|
7
|
+
imagesSlot?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare function PhotosSection({ product, ensureProduct, setProduct, imagesSlot, }: PhotosSectionProps): string | number | bigint | true | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import('react').JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AdminProduct, ProductIncompleteField } from '@develemit/commerce-contracts';
|
|
3
|
+
import { FlowSectionProps } from './flow-section-props';
|
|
4
|
+
export interface PreviewSectionProps extends FlowSectionProps {
|
|
5
|
+
product: AdminProduct | null;
|
|
6
|
+
currency: string;
|
|
7
|
+
missing: ProductIncompleteField[] | null;
|
|
8
|
+
actions: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare function PreviewSection({ form, update, product, currency, missing, actions, }: PreviewSectionProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
import { FlowSectionProps } from './flow-section-props';
|
|
3
|
+
export interface StorySectionProps extends FlowSectionProps {
|
|
4
|
+
product: AdminProduct | null;
|
|
5
|
+
setProduct: (next: AdminProduct) => void;
|
|
6
|
+
materialSuggestions?: string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function StorySection({ form, update, product, setProduct, materialSuggestions, }: StorySectionProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductForm } from '../../../lib/product-form';
|
|
3
|
+
import { ProductFlowStep } from '../../../lib/product-flow-labels';
|
|
4
|
+
export interface FlowOptions {
|
|
5
|
+
initial: AdminProduct | null;
|
|
6
|
+
initialStep?: ProductFlowStep;
|
|
7
|
+
isFirstProduct?: boolean;
|
|
8
|
+
onDone?: (product: AdminProduct) => void;
|
|
9
|
+
onClose?: (product: AdminProduct | null) => void;
|
|
10
|
+
}
|
|
11
|
+
export interface FlowSuccess {
|
|
12
|
+
product: AdminProduct;
|
|
13
|
+
first: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function useProductFlow({ initial, initialStep, isFirstProduct, onDone, onClose, }: FlowOptions): {
|
|
16
|
+
form: ProductForm;
|
|
17
|
+
update: <K extends keyof ProductForm>(field: K, value: ProductForm[K]) => void;
|
|
18
|
+
step: ProductFlowStep;
|
|
19
|
+
goTo: import('react').Dispatch<import('react').SetStateAction<ProductFlowStep>>;
|
|
20
|
+
product: {
|
|
21
|
+
id: string;
|
|
22
|
+
slug: string;
|
|
23
|
+
name: string;
|
|
24
|
+
description: string;
|
|
25
|
+
materials: string | null;
|
|
26
|
+
dimensions: string | null;
|
|
27
|
+
priceCents: number | null;
|
|
28
|
+
currency: string;
|
|
29
|
+
category: string | null;
|
|
30
|
+
quantity: number;
|
|
31
|
+
status: "draft" | "active" | "archived";
|
|
32
|
+
featured: boolean;
|
|
33
|
+
everPublished: boolean;
|
|
34
|
+
images: {
|
|
35
|
+
id: string;
|
|
36
|
+
url: string;
|
|
37
|
+
alt: string;
|
|
38
|
+
position: number;
|
|
39
|
+
}[];
|
|
40
|
+
} | null;
|
|
41
|
+
isNew: boolean;
|
|
42
|
+
autosave: {
|
|
43
|
+
product: {
|
|
44
|
+
id: string;
|
|
45
|
+
slug: string;
|
|
46
|
+
name: string;
|
|
47
|
+
description: string;
|
|
48
|
+
materials: string | null;
|
|
49
|
+
dimensions: string | null;
|
|
50
|
+
priceCents: number | null;
|
|
51
|
+
currency: string;
|
|
52
|
+
category: string | null;
|
|
53
|
+
quantity: number;
|
|
54
|
+
status: "draft" | "active" | "archived";
|
|
55
|
+
featured: boolean;
|
|
56
|
+
everPublished: boolean;
|
|
57
|
+
images: {
|
|
58
|
+
id: string;
|
|
59
|
+
url: string;
|
|
60
|
+
alt: string;
|
|
61
|
+
position: number;
|
|
62
|
+
}[];
|
|
63
|
+
} | null;
|
|
64
|
+
setProduct: (next: AdminProduct) => void;
|
|
65
|
+
state: import('../../../lib/use-product-autosave').AutosaveState;
|
|
66
|
+
error: unknown;
|
|
67
|
+
flush: () => Promise<{
|
|
68
|
+
id: string;
|
|
69
|
+
slug: string;
|
|
70
|
+
name: string;
|
|
71
|
+
description: string;
|
|
72
|
+
materials: string | null;
|
|
73
|
+
dimensions: string | null;
|
|
74
|
+
priceCents: number | null;
|
|
75
|
+
currency: string;
|
|
76
|
+
category: string | null;
|
|
77
|
+
quantity: number;
|
|
78
|
+
status: "draft" | "active" | "archived";
|
|
79
|
+
featured: boolean;
|
|
80
|
+
everPublished: boolean;
|
|
81
|
+
images: {
|
|
82
|
+
id: string;
|
|
83
|
+
url: string;
|
|
84
|
+
alt: string;
|
|
85
|
+
position: number;
|
|
86
|
+
}[];
|
|
87
|
+
} | null>;
|
|
88
|
+
ensureProduct: () => Promise<{
|
|
89
|
+
id: string;
|
|
90
|
+
slug: string;
|
|
91
|
+
name: string;
|
|
92
|
+
description: string;
|
|
93
|
+
materials: string | null;
|
|
94
|
+
dimensions: string | null;
|
|
95
|
+
priceCents: number | null;
|
|
96
|
+
currency: string;
|
|
97
|
+
category: string | null;
|
|
98
|
+
quantity: number;
|
|
99
|
+
status: "draft" | "active" | "archived";
|
|
100
|
+
featured: boolean;
|
|
101
|
+
everPublished: boolean;
|
|
102
|
+
images: {
|
|
103
|
+
id: string;
|
|
104
|
+
url: string;
|
|
105
|
+
alt: string;
|
|
106
|
+
position: number;
|
|
107
|
+
}[];
|
|
108
|
+
}>;
|
|
109
|
+
retry: () => Promise<{
|
|
110
|
+
id: string;
|
|
111
|
+
slug: string;
|
|
112
|
+
name: string;
|
|
113
|
+
description: string;
|
|
114
|
+
materials: string | null;
|
|
115
|
+
dimensions: string | null;
|
|
116
|
+
priceCents: number | null;
|
|
117
|
+
currency: string;
|
|
118
|
+
category: string | null;
|
|
119
|
+
quantity: number;
|
|
120
|
+
status: "draft" | "active" | "archived";
|
|
121
|
+
featured: boolean;
|
|
122
|
+
everPublished: boolean;
|
|
123
|
+
images: {
|
|
124
|
+
id: string;
|
|
125
|
+
url: string;
|
|
126
|
+
alt: string;
|
|
127
|
+
position: number;
|
|
128
|
+
}[];
|
|
129
|
+
} | null>;
|
|
130
|
+
};
|
|
131
|
+
missing: ("name" | "priceCents" | "category" | "images")[] | null;
|
|
132
|
+
failure: unknown;
|
|
133
|
+
pending: boolean;
|
|
134
|
+
success: FlowSuccess | null;
|
|
135
|
+
notice: string | null;
|
|
136
|
+
dismissNotice: () => void;
|
|
137
|
+
closing: boolean;
|
|
138
|
+
finishClosing: () => void;
|
|
139
|
+
saveDraft: () => Promise<void>;
|
|
140
|
+
publish: () => Promise<void>;
|
|
141
|
+
close: () => Promise<void>;
|
|
142
|
+
};
|
|
143
|
+
export type ProductFlowState = ReturnType<typeof useProductFlow>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EditProduct } from './sheet-edit-link';
|
|
2
|
+
export interface AdminProductSheetProps {
|
|
3
|
+
productId: string;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onEdit?: EditProduct;
|
|
6
|
+
onChanged?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function AdminProductSheet({ productId, onClose, onEdit, onChanged, }: AdminProductSheetProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export declare function canDeleteDraft(product: AdminProduct): boolean;
|
|
3
|
+
interface Props {
|
|
4
|
+
product: AdminProduct;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
onDeleted: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function DeleteDraftButton({ product, disabled, onDeleted }: Props): import('react').JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
3
|
+
import { ProductFlowStep } from '../../../lib/product-flow-labels';
|
|
4
|
+
export type EditProduct = (product: AdminProduct, step?: ProductFlowStep) => void;
|
|
5
|
+
export declare function hrefWithStep(href: string, step: ProductFlowStep): string;
|
|
6
|
+
export declare function finishStep(product: AdminProduct): ProductFlowStep;
|
|
7
|
+
export interface SheetEditLinkProps {
|
|
8
|
+
product: AdminProduct;
|
|
9
|
+
step: ProductFlowStep;
|
|
10
|
+
onEdit?: EditProduct;
|
|
11
|
+
className: string;
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare function SheetEditLink({ product, step, onEdit, className, children, }: SheetEditLinkProps): string | number | bigint | boolean | Iterable<ReactNode> | Promise<string | number | bigint | boolean | import('react').ReactPortal | import('react').ReactElement<unknown, string | import('react').JSXElementConstructor<any>> | Iterable<ReactNode> | null | undefined> | import('react').JSX.Element | null | undefined;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductChange } from '../../../lib/product-sheet-actions';
|
|
3
|
+
export interface SheetNotice {
|
|
4
|
+
text: string;
|
|
5
|
+
undo?: ProductChange['undo'];
|
|
6
|
+
}
|
|
7
|
+
export declare function useProductChange(product: AdminProduct, setProduct: (next: AdminProduct) => void, onChanged: () => void): {
|
|
8
|
+
apply: (change: ProductChange, text: string) => Promise<void>;
|
|
9
|
+
undo: () => Promise<void>;
|
|
10
|
+
notice: SheetNotice | null;
|
|
11
|
+
dismiss: () => void;
|
|
12
|
+
announce: (text: string) => void;
|
|
13
|
+
pending: boolean;
|
|
14
|
+
missing: ("name" | "priceCents" | "category" | "images")[] | null;
|
|
15
|
+
error: unknown;
|
|
16
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AdminProductCounts } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductFilter } from '../../lib/product-labels';
|
|
3
|
+
export interface ProductToolbarProps {
|
|
4
|
+
filter: ProductFilter;
|
|
5
|
+
onFilter: (filter: ProductFilter) => void;
|
|
6
|
+
search: string;
|
|
7
|
+
onSearch: (value: string) => void;
|
|
8
|
+
counts: AdminProductCounts | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function ProductToolbar({ filter, onFilter, search, onSearch, counts, }: ProductToolbarProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { SetupStep } from '../../components/setup-checklist/setup-checklist';
|
|
3
|
+
export interface ProductWelcomeProps {
|
|
4
|
+
art?: ReactNode;
|
|
5
|
+
steps?: SetupStep[];
|
|
6
|
+
onAddMany?: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function ProductWelcome({ art, steps, onAddMany }: ProductWelcomeProps): import('react').JSX.Element;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
+
export interface SuggestedRate {
|
|
2
|
+
label: string;
|
|
3
|
+
amountCents: number;
|
|
4
|
+
}
|
|
1
5
|
export interface AdminShippingRatesProps {
|
|
6
|
+
suggestedRates?: SuggestedRate[];
|
|
2
7
|
onDirtyChange?: (dirty: boolean) => void;
|
|
3
8
|
}
|
|
4
|
-
export declare function AdminShippingRates({ onDirtyChange }: AdminShippingRatesProps): import('react').JSX.Element;
|
|
9
|
+
export declare function AdminShippingRates({ onDirtyChange, suggestedRates, }: AdminShippingRatesProps): import('react').JSX.Element;
|
|
@@ -8,8 +8,9 @@ export interface ShippingRateRowProps {
|
|
|
8
8
|
errors: RateErrors;
|
|
9
9
|
disabled: boolean;
|
|
10
10
|
labels: ShippingLabels;
|
|
11
|
+
locale: string;
|
|
11
12
|
onChange: (patch: Partial<RateDraft>) => void;
|
|
12
13
|
onMove: (direction: RateMove) => void;
|
|
13
14
|
onRemove: () => void;
|
|
14
15
|
}
|
|
15
|
-
export declare function ShippingRateRow({ draft, index, total, errors, disabled, labels, onChange, onMove, onRemove, }: ShippingRateRowProps): import('react').JSX.Element;
|
|
16
|
+
export declare function ShippingRateRow({ draft, index, total, errors, disabled, labels, locale, onChange, onMove, onRemove, }: ShippingRateRowProps): import('react').JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@develemit/commerce-admin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "React admin UI for products, orders, discounts and shipping rates, backed by the commerce-server admin API.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/develemit/develemit-commerce.git",
|
|
8
|
+
"directory": "packages/commerce-admin"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/develemit/develemit-commerce/blob/main/docs/getting-started.md",
|
|
4
11
|
"type": "module",
|
|
5
12
|
"main": "./dist/index.js",
|
|
6
13
|
"module": "./dist/index.js",
|
|
@@ -21,7 +28,8 @@
|
|
|
21
28
|
},
|
|
22
29
|
"files": [
|
|
23
30
|
"dist",
|
|
24
|
-
"!**/*.tsbuildinfo"
|
|
31
|
+
"!**/*.tsbuildinfo",
|
|
32
|
+
"CHANGELOG.md"
|
|
25
33
|
],
|
|
26
34
|
"nx": {
|
|
27
35
|
"name": "commerce-admin",
|
|
@@ -39,7 +47,7 @@
|
|
|
39
47
|
"access": "public"
|
|
40
48
|
},
|
|
41
49
|
"dependencies": {
|
|
42
|
-
"@develemit/commerce-contracts": "0.
|
|
50
|
+
"@develemit/commerce-contracts": "0.8.0"
|
|
43
51
|
},
|
|
44
52
|
"devDependencies": {
|
|
45
53
|
"@testing-library/user-event": "^14.6.8"
|