@develemit/commerce-admin 0.4.0 → 0.7.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 +87 -0
- package/README.md +85 -9
- package/dist/client/admin-client.d.ts +3 -2
- package/dist/client/errors.d.ts +8 -0
- package/dist/client/index.js +1 -1
- package/dist/client/transport.d.ts +3 -1
- package/dist/client-DCL5DSHP.js +184 -0
- package/dist/client-DCL5DSHP.js.map +1 -0
- package/dist/components/admin-layout/admin-layout.d.ts +5 -6
- package/dist/components/admin-layout/nav-icons.d.ts +9 -0
- package/dist/components/admin-layout/nav-items.d.ts +36 -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 +3325 -1211
- package/dist/index.js.map +1 -1
- package/dist/lib/admin-labels.d.ts +2 -0
- package/dist/lib/discount-labels.d.ts +1 -0
- package/dist/lib/fill-alts.d.ts +3 -0
- package/dist/lib/order-labels.d.ts +1 -0
- package/dist/lib/product-draft.d.ts +11 -0
- package/dist/lib/product-flow-labels.d.ts +54 -0
- package/dist/lib/product-labels.d.ts +53 -0
- package/dist/lib/product-missing.d.ts +4 -0
- package/dist/lib/product-sheet-actions.d.ts +13 -0
- package/dist/lib/shipping-labels.d.ts +2 -0
- package/dist/lib/stock-labels.d.ts +41 -0
- package/dist/lib/use-batch-upload.d.ts +38 -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-order-pages.d.ts +2 -0
- package/dist/lib/use-paged-list.d.ts +15 -0
- package/dist/lib/use-product-autosave.d.ts +95 -0
- package/dist/lib/use-product-pages.d.ts +2 -2
- package/dist/styles.css +1300 -55
- package/dist/views/products/add-several/admin-add-several.d.ts +5 -0
- package/dist/views/products/add-several/photo-picker.d.ts +7 -0
- package/dist/views/products/admin-product-editor.d.ts +3 -1
- 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 +10 -0
- package/dist/views/products/finish-drafts/use-publish-pieces.d.ts +52 -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 +10 -0
- package/dist/views/products/product-flow/flow-frame.d.ts +28 -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/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 +138 -0
- package/dist/views/products/product-sheet/admin-product-sheet.d.ts +8 -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/package.json +11 -3
- package/dist/client--_j5r8ag.js +0 -168
- package/dist/client--_j5r8ag.js.map +0 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AdminProduct, AdminProductInput, AdminProductPatch } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductForm } from './product-form';
|
|
3
|
+
export declare function hasDraftContent(form: ProductForm): boolean;
|
|
4
|
+
export declare function draftInput(form: ProductForm, currency?: string): AdminProductInput;
|
|
5
|
+
export declare function draftPatch(base: AdminProduct, form: ProductForm): AdminProductPatch;
|
|
6
|
+
export declare function basicsReady(form: ProductForm): boolean;
|
|
7
|
+
export declare function splitMaterials(value: string): string[];
|
|
8
|
+
export declare function toggleMaterial(value: string, material: string): string;
|
|
9
|
+
export declare function appendPrompt(description: string, prompt: string): string;
|
|
10
|
+
export declare function currencySymbol(locale: string, currency: string): string;
|
|
11
|
+
export declare function fillText(template: string, values: Record<string, string>): string;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export type ProductFlowStep = 'photos' | 'basics' | 'story' | 'preview';
|
|
2
|
+
export declare const PRODUCT_FLOW_STEPS: ProductFlowStep[];
|
|
3
|
+
export interface ProductFlowLabels {
|
|
4
|
+
newTitle: string;
|
|
5
|
+
editTitle: string;
|
|
6
|
+
back: string;
|
|
7
|
+
close: string;
|
|
8
|
+
stepsLabel: string;
|
|
9
|
+
steps: Record<ProductFlowStep, string>;
|
|
10
|
+
headings: Record<ProductFlowStep, string>;
|
|
11
|
+
ledes: Record<ProductFlowStep, string>;
|
|
12
|
+
addPhotos: string;
|
|
13
|
+
addMorePhotos: string;
|
|
14
|
+
photoHint: string;
|
|
15
|
+
photoTip: string;
|
|
16
|
+
photoN: string;
|
|
17
|
+
cover: string;
|
|
18
|
+
makeCover: string;
|
|
19
|
+
removePhoto: string;
|
|
20
|
+
uploading: string;
|
|
21
|
+
pricePlaceholder: string;
|
|
22
|
+
otherCategory: string;
|
|
23
|
+
newCategory: string;
|
|
24
|
+
oneOfAKind: string;
|
|
25
|
+
howMany: string;
|
|
26
|
+
descriptionPrompts: string[];
|
|
27
|
+
materialsOther: string;
|
|
28
|
+
size: string;
|
|
29
|
+
altTitle: string;
|
|
30
|
+
altHelp: string;
|
|
31
|
+
altFallback: string;
|
|
32
|
+
inTheShop: string;
|
|
33
|
+
untitled: string;
|
|
34
|
+
noPhoto: string;
|
|
35
|
+
needs: string;
|
|
36
|
+
featured: string;
|
|
37
|
+
continue: string;
|
|
38
|
+
photosLater: string;
|
|
39
|
+
skip: string;
|
|
40
|
+
saveDraft: string;
|
|
41
|
+
publish: string;
|
|
42
|
+
done: string;
|
|
43
|
+
saving: string;
|
|
44
|
+
savedNew: string;
|
|
45
|
+
savedEdit: string;
|
|
46
|
+
saveFailed: string;
|
|
47
|
+
retry: string;
|
|
48
|
+
savedAsDraft: string;
|
|
49
|
+
success: string;
|
|
50
|
+
successFirst: string;
|
|
51
|
+
addAnother: string;
|
|
52
|
+
backToList: string;
|
|
53
|
+
}
|
|
54
|
+
export declare const defaultProductFlowLabels: ProductFlowLabels;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { StockLabels } from './stock-labels';
|
|
1
2
|
import { ImageLabels } from './image-labels';
|
|
3
|
+
import { ProductFlowLabels } from './product-flow-labels';
|
|
2
4
|
export type ProductFilter = 'all' | 'live' | 'sold' | 'draft' | 'archived';
|
|
3
5
|
export interface ProductLabels {
|
|
4
6
|
title: string;
|
|
@@ -9,6 +11,55 @@ export interface ProductLabels {
|
|
|
9
11
|
empty: Record<ProductFilter, string>;
|
|
10
12
|
noMatches: string;
|
|
11
13
|
loadMore: string;
|
|
14
|
+
welcome: {
|
|
15
|
+
title: string;
|
|
16
|
+
body: string;
|
|
17
|
+
addFirst: string;
|
|
18
|
+
addMany: string;
|
|
19
|
+
};
|
|
20
|
+
card: {
|
|
21
|
+
needsPrice: string;
|
|
22
|
+
needsCategory: string;
|
|
23
|
+
needsPhoto: string;
|
|
24
|
+
featured: string;
|
|
25
|
+
noPhoto: string;
|
|
26
|
+
};
|
|
27
|
+
draftsBanner: {
|
|
28
|
+
one: string;
|
|
29
|
+
many: string;
|
|
30
|
+
finish: string;
|
|
31
|
+
};
|
|
32
|
+
sheet: {
|
|
33
|
+
close: string;
|
|
34
|
+
photoOf: string;
|
|
35
|
+
previousPhoto: string;
|
|
36
|
+
nextPhoto: string;
|
|
37
|
+
noPhoto: string;
|
|
38
|
+
category: string;
|
|
39
|
+
noCategory: string;
|
|
40
|
+
primary: Record<'finish' | 'publish' | 'sold' | 'restock' | 'restore', string>;
|
|
41
|
+
edit: string;
|
|
42
|
+
photos: string;
|
|
43
|
+
featureOn: string;
|
|
44
|
+
featureOff: string;
|
|
45
|
+
hide: string;
|
|
46
|
+
copyLink: string;
|
|
47
|
+
linkCopied: string;
|
|
48
|
+
archive: string;
|
|
49
|
+
undo: string;
|
|
50
|
+
missingTitle: string;
|
|
51
|
+
missing: Record<string, string>;
|
|
52
|
+
done: Record<'publish' | 'sold' | 'restock' | 'restore' | 'hide' | 'archive' | 'feature', string>;
|
|
53
|
+
};
|
|
54
|
+
openSearch: string;
|
|
55
|
+
closeSearch: string;
|
|
56
|
+
setup: {
|
|
57
|
+
title: string;
|
|
58
|
+
progress: string;
|
|
59
|
+
show: string;
|
|
60
|
+
hide: string;
|
|
61
|
+
locked: string;
|
|
62
|
+
};
|
|
12
63
|
columns: {
|
|
13
64
|
image: string;
|
|
14
65
|
name: string;
|
|
@@ -41,6 +92,8 @@ export interface ProductLabels {
|
|
|
41
92
|
featured: string;
|
|
42
93
|
};
|
|
43
94
|
images: ImageLabels;
|
|
95
|
+
flow: ProductFlowLabels;
|
|
96
|
+
stock: StockLabels;
|
|
44
97
|
statusHelp: string;
|
|
45
98
|
priceHelp: string;
|
|
46
99
|
validation: {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductLabels } from './product-labels';
|
|
3
|
+
export declare function missingDetail(product: AdminProduct, copy: ProductLabels['card']): string | null;
|
|
4
|
+
export declare function fillCount(template: string, values: Record<string, number>): string;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { AdminProduct, AdminProductPatch } from '@develemit/commerce-contracts';
|
|
2
|
+
export type PrimaryKind = 'finish' | 'publish' | 'sold' | 'restock' | 'restore';
|
|
3
|
+
export interface ProductChange {
|
|
4
|
+
patch: AdminProductPatch;
|
|
5
|
+
undo: AdminProductPatch;
|
|
6
|
+
}
|
|
7
|
+
export declare function isDraftComplete(product: AdminProduct): boolean;
|
|
8
|
+
export declare function primaryKind(product: AdminProduct): PrimaryKind;
|
|
9
|
+
export declare function primaryChange(product: AdminProduct, kind: PrimaryKind): ProductChange | null;
|
|
10
|
+
export declare const hideChange: ProductChange;
|
|
11
|
+
export declare function archiveChange(product: AdminProduct): ProductChange;
|
|
12
|
+
export declare function featureChange(product: AdminProduct): ProductChange;
|
|
13
|
+
export declare const canFeature: (product: AdminProduct) => boolean;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export interface StockLabels {
|
|
2
|
+
addSeveral: {
|
|
3
|
+
title: string;
|
|
4
|
+
introTitle: string;
|
|
5
|
+
introBody: string;
|
|
6
|
+
choose: string;
|
|
7
|
+
progress: string;
|
|
8
|
+
failedTitle: string;
|
|
9
|
+
retry: string;
|
|
10
|
+
continueWithout: string;
|
|
11
|
+
doneTitle: string;
|
|
12
|
+
doneBody: string;
|
|
13
|
+
next: string;
|
|
14
|
+
};
|
|
15
|
+
queue: {
|
|
16
|
+
title: string;
|
|
17
|
+
pieceOf: string;
|
|
18
|
+
addPhoto: string;
|
|
19
|
+
coverAlt: string;
|
|
20
|
+
skip: string;
|
|
21
|
+
next: string;
|
|
22
|
+
review: string;
|
|
23
|
+
back: string;
|
|
24
|
+
loading: string;
|
|
25
|
+
nothingToFinish: string;
|
|
26
|
+
done: string;
|
|
27
|
+
};
|
|
28
|
+
summary: {
|
|
29
|
+
title: string;
|
|
30
|
+
lede: string;
|
|
31
|
+
needsDetails: string;
|
|
32
|
+
untitled: string;
|
|
33
|
+
publish: string;
|
|
34
|
+
keepDrafts: string;
|
|
35
|
+
stillIncomplete: string;
|
|
36
|
+
publishedTitle: string;
|
|
37
|
+
publishedBody: string;
|
|
38
|
+
allSkipped: string;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export declare const defaultStockLabels: StockLabels;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export interface BatchItem {
|
|
3
|
+
id: number;
|
|
4
|
+
file: File;
|
|
5
|
+
status: 'queued' | 'uploading' | 'done' | 'error';
|
|
6
|
+
productId?: string;
|
|
7
|
+
product?: AdminProduct;
|
|
8
|
+
reason?: string;
|
|
9
|
+
error?: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function useBatchUpload(): {
|
|
12
|
+
items: BatchItem[];
|
|
13
|
+
add: (files: File[]) => void;
|
|
14
|
+
retry: () => void;
|
|
15
|
+
done: BatchItem[];
|
|
16
|
+
failed: BatchItem[];
|
|
17
|
+
settled: boolean;
|
|
18
|
+
products: {
|
|
19
|
+
id: string;
|
|
20
|
+
slug: string;
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
materials: string | null;
|
|
24
|
+
dimensions: string | null;
|
|
25
|
+
priceCents: number | null;
|
|
26
|
+
currency: string;
|
|
27
|
+
category: string | null;
|
|
28
|
+
quantity: number;
|
|
29
|
+
status: "draft" | "active" | "archived";
|
|
30
|
+
featured: boolean;
|
|
31
|
+
images: {
|
|
32
|
+
id: string;
|
|
33
|
+
url: string;
|
|
34
|
+
alt: string;
|
|
35
|
+
position: number;
|
|
36
|
+
}[];
|
|
37
|
+
}[];
|
|
38
|
+
};
|
|
@@ -7,10 +7,11 @@ export interface UploadEntry {
|
|
|
7
7
|
error?: unknown;
|
|
8
8
|
}
|
|
9
9
|
interface Options {
|
|
10
|
-
productId
|
|
10
|
+
productId?: string;
|
|
11
|
+
resolveProductId?: () => Promise<string>;
|
|
11
12
|
onUploaded: (product: AdminProduct) => void;
|
|
12
13
|
}
|
|
13
|
-
export declare function useImageUpload({ productId, onUploaded }: Options): {
|
|
14
|
+
export declare function useImageUpload({ productId, resolveProductId, onUploaded, }: Options): {
|
|
14
15
|
entries: UploadEntry[];
|
|
15
16
|
upload: (files: File[], alt: string) => void;
|
|
16
17
|
dismiss: (id: number) => void;
|
|
@@ -9,9 +9,11 @@ export declare function useOrderPages(query: Omit<AdminOrderQuery, 'cursor'>): {
|
|
|
9
9
|
itemCount: number;
|
|
10
10
|
createdAt: string;
|
|
11
11
|
}[];
|
|
12
|
+
loaded: boolean;
|
|
12
13
|
loading: boolean;
|
|
13
14
|
error: unknown;
|
|
14
15
|
hasMore: boolean;
|
|
15
16
|
loadingMore: boolean;
|
|
17
|
+
reload: () => void;
|
|
16
18
|
loadMore: () => void;
|
|
17
19
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface CursorPage<Item> {
|
|
2
|
+
items: Item[];
|
|
3
|
+
nextCursor: string | null;
|
|
4
|
+
}
|
|
5
|
+
export declare function usePagedList<Item, Page extends CursorPage<Item>>(key: readonly unknown[], fetchPage: (cursor?: string) => Promise<Page>): {
|
|
6
|
+
items: Item[];
|
|
7
|
+
loaded: boolean;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
error: unknown;
|
|
10
|
+
hasMore: boolean;
|
|
11
|
+
loadingMore: boolean;
|
|
12
|
+
reload: () => void;
|
|
13
|
+
loadMore: () => void;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductForm } from './product-form';
|
|
3
|
+
export type AutosaveState = 'idle' | 'saving' | 'saved' | 'error';
|
|
4
|
+
interface Options {
|
|
5
|
+
initial: AdminProduct | null;
|
|
6
|
+
form: ProductForm;
|
|
7
|
+
currency?: string;
|
|
8
|
+
delayMs?: number;
|
|
9
|
+
}
|
|
10
|
+
export declare function useProductAutosave({ initial, form, currency, delayMs, }: Options): {
|
|
11
|
+
product: {
|
|
12
|
+
id: string;
|
|
13
|
+
slug: string;
|
|
14
|
+
name: string;
|
|
15
|
+
description: string;
|
|
16
|
+
materials: string | null;
|
|
17
|
+
dimensions: string | null;
|
|
18
|
+
priceCents: number | null;
|
|
19
|
+
currency: string;
|
|
20
|
+
category: string | null;
|
|
21
|
+
quantity: number;
|
|
22
|
+
status: "draft" | "active" | "archived";
|
|
23
|
+
featured: boolean;
|
|
24
|
+
images: {
|
|
25
|
+
id: string;
|
|
26
|
+
url: string;
|
|
27
|
+
alt: string;
|
|
28
|
+
position: number;
|
|
29
|
+
}[];
|
|
30
|
+
} | null;
|
|
31
|
+
setProduct: (next: AdminProduct) => void;
|
|
32
|
+
state: AutosaveState;
|
|
33
|
+
error: unknown;
|
|
34
|
+
flush: () => Promise<{
|
|
35
|
+
id: string;
|
|
36
|
+
slug: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
materials: string | null;
|
|
40
|
+
dimensions: string | null;
|
|
41
|
+
priceCents: number | null;
|
|
42
|
+
currency: string;
|
|
43
|
+
category: string | null;
|
|
44
|
+
quantity: number;
|
|
45
|
+
status: "draft" | "active" | "archived";
|
|
46
|
+
featured: boolean;
|
|
47
|
+
images: {
|
|
48
|
+
id: string;
|
|
49
|
+
url: string;
|
|
50
|
+
alt: string;
|
|
51
|
+
position: number;
|
|
52
|
+
}[];
|
|
53
|
+
} | null>;
|
|
54
|
+
ensureProduct: () => Promise<{
|
|
55
|
+
id: string;
|
|
56
|
+
slug: string;
|
|
57
|
+
name: string;
|
|
58
|
+
description: string;
|
|
59
|
+
materials: string | null;
|
|
60
|
+
dimensions: string | null;
|
|
61
|
+
priceCents: number | null;
|
|
62
|
+
currency: string;
|
|
63
|
+
category: string | null;
|
|
64
|
+
quantity: number;
|
|
65
|
+
status: "draft" | "active" | "archived";
|
|
66
|
+
featured: boolean;
|
|
67
|
+
images: {
|
|
68
|
+
id: string;
|
|
69
|
+
url: string;
|
|
70
|
+
alt: string;
|
|
71
|
+
position: number;
|
|
72
|
+
}[];
|
|
73
|
+
}>;
|
|
74
|
+
retry: () => Promise<{
|
|
75
|
+
id: string;
|
|
76
|
+
slug: string;
|
|
77
|
+
name: string;
|
|
78
|
+
description: string;
|
|
79
|
+
materials: string | null;
|
|
80
|
+
dimensions: string | null;
|
|
81
|
+
priceCents: number | null;
|
|
82
|
+
currency: string;
|
|
83
|
+
category: string | null;
|
|
84
|
+
quantity: number;
|
|
85
|
+
status: "draft" | "active" | "archived";
|
|
86
|
+
featured: boolean;
|
|
87
|
+
images: {
|
|
88
|
+
id: string;
|
|
89
|
+
url: string;
|
|
90
|
+
alt: string;
|
|
91
|
+
position: number;
|
|
92
|
+
}[];
|
|
93
|
+
} | null>;
|
|
94
|
+
};
|
|
95
|
+
export {};
|
|
@@ -7,9 +7,9 @@ export declare function useProductPages(query: Omit<AdminProductQuery, 'cursor'>
|
|
|
7
7
|
description: string;
|
|
8
8
|
materials: string | null;
|
|
9
9
|
dimensions: string | null;
|
|
10
|
-
priceCents: number;
|
|
10
|
+
priceCents: number | null;
|
|
11
11
|
currency: string;
|
|
12
|
-
category: string;
|
|
12
|
+
category: string | null;
|
|
13
13
|
quantity: number;
|
|
14
14
|
status: "draft" | "active" | "archived";
|
|
15
15
|
featured: boolean;
|