@develemit/commerce-admin 0.0.0-stage → 0.4.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 +147 -2
- package/dist/client/admin-client.d.ts +37 -0
- package/dist/client/errors.d.ts +47 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +1 -0
- package/dist/client/map-error.d.ts +2 -0
- package/dist/client/transport.d.ts +19 -0
- package/dist/client--_j5r8ag.js +168 -0
- package/dist/client--_j5r8ag.js.map +1 -0
- package/dist/components/admin-layout/admin-layout.d.ts +13 -0
- package/dist/components/admin-table/admin-table.d.ts +13 -0
- package/dist/components/confirm-dialog/confirm-dialog.d.ts +12 -0
- package/dist/components/error-message/error-message.d.ts +5 -0
- package/dist/components/money/money.d.ts +5 -0
- package/dist/components/notice/notice.d.ts +9 -0
- package/dist/components/status-badge/status-badge.d.ts +3 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +2977 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/admin-labels.d.ts +26 -0
- package/dist/lib/discount-form.d.ts +28 -0
- package/dist/lib/discount-labels.d.ts +56 -0
- package/dist/lib/discount-status.d.ts +5 -0
- package/dist/lib/image-labels.d.ts +27 -0
- package/dist/lib/image-rules.d.ts +4 -0
- package/dist/lib/merge-labels.d.ts +19 -0
- package/dist/lib/money-input.d.ts +2 -0
- package/dist/lib/order-action-labels.d.ts +28 -0
- package/dist/lib/order-labels.d.ts +66 -0
- package/dist/lib/product-filter.d.ts +6 -0
- package/dist/lib/product-form.d.ts +29 -0
- package/dist/lib/product-labels.d.ts +52 -0
- package/dist/lib/provider.d.ts +45 -0
- package/dist/lib/refund-rules.d.ts +7 -0
- package/dist/lib/shipping-labels.d.ts +33 -0
- package/dist/lib/shipping-rates.d.ts +31 -0
- package/dist/lib/use-admin-mutation.d.ts +7 -0
- package/dist/lib/use-admin-query.d.ts +7 -0
- package/dist/lib/use-debounced.d.ts +1 -0
- package/dist/lib/use-discount-pages.d.ts +26 -0
- package/dist/lib/use-image-upload.d.ts +18 -0
- package/dist/lib/use-order-pages.d.ts +17 -0
- package/dist/lib/use-product-pages.d.ts +30 -0
- package/dist/styles.css +418 -0
- package/dist/views/discounts/admin-discount-editor.d.ts +6 -0
- package/dist/views/discounts/admin-discount-list.d.ts +1 -0
- package/dist/views/discounts/discount-fields.d.ts +10 -0
- package/dist/views/discounts/discount-value.d.ts +4 -0
- package/dist/views/orders/admin-order-detail.d.ts +10 -0
- package/dist/views/orders/admin-order-list.d.ts +1 -0
- package/dist/views/orders/order-actions.d.ts +7 -0
- package/dist/views/orders/order-fulfillment.d.ts +4 -0
- package/dist/views/orders/order-items.d.ts +4 -0
- package/dist/views/orders/order-refunds.d.ts +4 -0
- package/dist/views/orders/refund-dialog.d.ts +8 -0
- package/dist/views/orders/resolve-button.d.ts +7 -0
- package/dist/views/orders/ship-form.d.ts +7 -0
- package/dist/views/products/admin-product-editor.d.ts +9 -0
- package/dist/views/products/admin-product-images.d.ts +6 -0
- package/dist/views/products/admin-product-list.d.ts +1 -0
- package/dist/views/products/image-alt-editor.d.ts +9 -0
- package/dist/views/products/image-tile.d.ts +15 -0
- package/dist/views/products/product-fields.d.ts +12 -0
- package/dist/views/products/test-helpers.d.ts +6 -0
- package/dist/views/products/upload-picker.d.ts +7 -0
- package/dist/views/shipping/admin-shipping-rates.d.ts +4 -0
- package/dist/views/shipping/shipping-rate-row.d.ts +15 -0
- package/package.json +44 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Discount, DiscountInput, DiscountPatch, DiscountType } from '@develemit/commerce-contracts';
|
|
2
|
+
import { DiscountLabels } from './discount-labels';
|
|
3
|
+
export interface DiscountForm {
|
|
4
|
+
code: string;
|
|
5
|
+
type: DiscountType;
|
|
6
|
+
percentOff: string;
|
|
7
|
+
amountOff: string;
|
|
8
|
+
minSubtotal: string;
|
|
9
|
+
startsAt: string;
|
|
10
|
+
endsAt: string;
|
|
11
|
+
maxRedemptions: string;
|
|
12
|
+
}
|
|
13
|
+
export type DiscountFieldName = keyof DiscountForm;
|
|
14
|
+
export type DiscountFieldErrors = Partial<Record<DiscountFieldName, string>>;
|
|
15
|
+
export declare const emptyDiscountForm: DiscountForm;
|
|
16
|
+
export declare function isoToLocalInput(iso: string | null | undefined): string;
|
|
17
|
+
export declare function formFromDiscount(discount: Discount): DiscountForm;
|
|
18
|
+
export declare function isDiscountUsed(discount: Discount | undefined): boolean;
|
|
19
|
+
export type DiscountValidation = {
|
|
20
|
+
ok: true;
|
|
21
|
+
input: DiscountInput;
|
|
22
|
+
} | {
|
|
23
|
+
ok: false;
|
|
24
|
+
errors: DiscountFieldErrors;
|
|
25
|
+
};
|
|
26
|
+
export declare function validateDiscountForm(form: DiscountForm, labels: DiscountLabels, currency: string, usedCount?: number): DiscountValidation;
|
|
27
|
+
export declare function buildDiscountPatch(original: Discount, input: DiscountInput, locked: boolean): DiscountPatch;
|
|
28
|
+
export declare function mapDiscountIssues(issues: unknown[], message: string): DiscountFieldErrors;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type DiscountTab = 'active' | 'scheduled' | 'expired' | 'inactive';
|
|
2
|
+
export interface DiscountLabels {
|
|
3
|
+
title: string;
|
|
4
|
+
newDiscount: string;
|
|
5
|
+
searchLabel: string;
|
|
6
|
+
searchPlaceholder: string;
|
|
7
|
+
tabs: Record<DiscountTab, string>;
|
|
8
|
+
empty: Record<DiscountTab, string>;
|
|
9
|
+
noMatches: string;
|
|
10
|
+
loadMore: string;
|
|
11
|
+
columns: {
|
|
12
|
+
code: string;
|
|
13
|
+
value: string;
|
|
14
|
+
status: string;
|
|
15
|
+
usage: string;
|
|
16
|
+
};
|
|
17
|
+
usage: string;
|
|
18
|
+
usageUnlimited: string;
|
|
19
|
+
createTitle: string;
|
|
20
|
+
editTitle: string;
|
|
21
|
+
saved: string;
|
|
22
|
+
fields: {
|
|
23
|
+
code: string;
|
|
24
|
+
type: string;
|
|
25
|
+
percentOff: string;
|
|
26
|
+
amountOff: string;
|
|
27
|
+
minSubtotal: string;
|
|
28
|
+
startsAt: string;
|
|
29
|
+
endsAt: string;
|
|
30
|
+
maxRedemptions: string;
|
|
31
|
+
};
|
|
32
|
+
types: {
|
|
33
|
+
percent: string;
|
|
34
|
+
fixed: string;
|
|
35
|
+
};
|
|
36
|
+
optionalHelp: string;
|
|
37
|
+
lockedHelp: string;
|
|
38
|
+
deactivate: string;
|
|
39
|
+
deactivateTitle: string;
|
|
40
|
+
deactivateBody: string;
|
|
41
|
+
reactivate: string;
|
|
42
|
+
validation: {
|
|
43
|
+
code: string;
|
|
44
|
+
percentOff: string;
|
|
45
|
+
amountOff: string;
|
|
46
|
+
minSubtotal: string;
|
|
47
|
+
maxRedemptions: string;
|
|
48
|
+
maxRedemptionsBelowUsage: string;
|
|
49
|
+
endsBeforeStart: string;
|
|
50
|
+
date: string;
|
|
51
|
+
codeTaken: string;
|
|
52
|
+
invalid: string;
|
|
53
|
+
};
|
|
54
|
+
orderRow: string;
|
|
55
|
+
}
|
|
56
|
+
export declare const defaultDiscountLabels: DiscountLabels;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Discount, DiscountStatus } from '@develemit/commerce-contracts';
|
|
2
|
+
type StatusFields = Pick<Discount, 'active' | 'startsAt' | 'endsAt'>;
|
|
3
|
+
export declare function displayDiscountStatus(discount: StatusFields, now?: Date): DiscountStatus;
|
|
4
|
+
export declare function fillTemplate(template: string, values: Record<string, string | number>): string;
|
|
5
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ImageLabels {
|
|
2
|
+
title: string;
|
|
3
|
+
empty: string;
|
|
4
|
+
add: string;
|
|
5
|
+
takePhoto: string;
|
|
6
|
+
dropHint: string;
|
|
7
|
+
altLabel: string;
|
|
8
|
+
altHelp: string;
|
|
9
|
+
altWarning: string;
|
|
10
|
+
cover: string;
|
|
11
|
+
photoName: string;
|
|
12
|
+
editAlt: string;
|
|
13
|
+
saveAlt: string;
|
|
14
|
+
cancelAlt: string;
|
|
15
|
+
moveEarlier: string;
|
|
16
|
+
moveLater: string;
|
|
17
|
+
remove: string;
|
|
18
|
+
removeTitle: string;
|
|
19
|
+
removeBody: string;
|
|
20
|
+
uploading: string;
|
|
21
|
+
working: string;
|
|
22
|
+
tooLarge: string;
|
|
23
|
+
wrongType: string;
|
|
24
|
+
reorderFailed: string;
|
|
25
|
+
dismiss: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const defaultImageLabels: ImageLabels;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ImageLabels } from './image-labels';
|
|
2
|
+
export declare const MAX_IMAGE_BYTES: number;
|
|
3
|
+
export declare function fill(template: string, values: Record<string, string>): string;
|
|
4
|
+
export declare function imageFileProblem(file: File, labels: ImageLabels): string | null;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AdminLabels } from './admin-labels';
|
|
2
|
+
import { OrderLabels } from './order-labels';
|
|
3
|
+
import { ShippingLabels } from './shipping-labels';
|
|
4
|
+
import { DiscountLabels } from './discount-labels';
|
|
5
|
+
import { ProductLabels } from './product-labels';
|
|
6
|
+
type DeepPartial<T> = {
|
|
7
|
+
[K in keyof T]?: T[K] extends object ? Partial<T[K]> : T[K];
|
|
8
|
+
};
|
|
9
|
+
export type AdminLabelOverrides = Partial<Omit<AdminLabels, 'nav' | 'statuses' | 'errors' | 'products' | 'orders' | 'shipping' | 'discounts'> & {
|
|
10
|
+
nav: Partial<AdminLabels['nav']>;
|
|
11
|
+
statuses: Partial<AdminLabels['statuses']>;
|
|
12
|
+
errors: Partial<AdminLabels['errors']>;
|
|
13
|
+
products: DeepPartial<ProductLabels>;
|
|
14
|
+
orders: DeepPartial<OrderLabels>;
|
|
15
|
+
shipping: Partial<ShippingLabels>;
|
|
16
|
+
discounts: DeepPartial<DiscountLabels>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare function mergeAdminLabels(labels: AdminLabelOverrides | undefined): AdminLabels;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface OrderActionLabels {
|
|
2
|
+
ship: string;
|
|
3
|
+
reship: string;
|
|
4
|
+
shipHeading: string;
|
|
5
|
+
carrier: string;
|
|
6
|
+
trackingNumber: string;
|
|
7
|
+
trackingUrl: string;
|
|
8
|
+
trackingUrlInvalid: string;
|
|
9
|
+
shipped: string;
|
|
10
|
+
refund: string;
|
|
11
|
+
refundTitle: string;
|
|
12
|
+
refundAmount: string;
|
|
13
|
+
refundAmountInvalid: string;
|
|
14
|
+
refundReason: string;
|
|
15
|
+
refundSubmit: string;
|
|
16
|
+
refundRetry: string;
|
|
17
|
+
restock: string;
|
|
18
|
+
restockWarning: string;
|
|
19
|
+
refundPending: string;
|
|
20
|
+
refundUnknown: string;
|
|
21
|
+
refundGateway: string;
|
|
22
|
+
refundDone: string;
|
|
23
|
+
resolve: string;
|
|
24
|
+
resolveHelp: string;
|
|
25
|
+
resolved: string;
|
|
26
|
+
restockThenResolve: string;
|
|
27
|
+
}
|
|
28
|
+
export declare const defaultOrderActionLabels: OrderActionLabels;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { OrderActionLabels } from './order-action-labels';
|
|
2
|
+
export type OrderTab = 'paid' | 'shipped' | 'needs_attention' | 'pending_refund' | 'all';
|
|
3
|
+
export interface OrderLabels {
|
|
4
|
+
title: string;
|
|
5
|
+
searchLabel: string;
|
|
6
|
+
searchPlaceholder: string;
|
|
7
|
+
tabs: Record<OrderTab, string>;
|
|
8
|
+
empty: Record<OrderTab, string>;
|
|
9
|
+
noMatches: string;
|
|
10
|
+
loadMore: string;
|
|
11
|
+
columns: {
|
|
12
|
+
order: string;
|
|
13
|
+
status: string;
|
|
14
|
+
email: string;
|
|
15
|
+
items: string;
|
|
16
|
+
total: string;
|
|
17
|
+
date: string;
|
|
18
|
+
};
|
|
19
|
+
noEmail: string;
|
|
20
|
+
detailTitle: string;
|
|
21
|
+
back: string;
|
|
22
|
+
placed: string;
|
|
23
|
+
buyer: string;
|
|
24
|
+
itemsHeading: string;
|
|
25
|
+
itemColumns: {
|
|
26
|
+
name: string;
|
|
27
|
+
price: string;
|
|
28
|
+
quantity: string;
|
|
29
|
+
line: string;
|
|
30
|
+
};
|
|
31
|
+
subtotal: string;
|
|
32
|
+
shipping: string;
|
|
33
|
+
total: string;
|
|
34
|
+
shippingAddress: string;
|
|
35
|
+
noAddress: string;
|
|
36
|
+
fulfillment: string;
|
|
37
|
+
notShipped: string;
|
|
38
|
+
shippedOn: string;
|
|
39
|
+
carrier: string;
|
|
40
|
+
tracking: string;
|
|
41
|
+
trackShipment: string;
|
|
42
|
+
refunds: string;
|
|
43
|
+
noRefunds: string;
|
|
44
|
+
refundColumns: {
|
|
45
|
+
amount: string;
|
|
46
|
+
reason: string;
|
|
47
|
+
source: string;
|
|
48
|
+
status: string;
|
|
49
|
+
restocked: string;
|
|
50
|
+
date: string;
|
|
51
|
+
};
|
|
52
|
+
refundSources: {
|
|
53
|
+
admin: string;
|
|
54
|
+
gateway: string;
|
|
55
|
+
};
|
|
56
|
+
refundStatuses: {
|
|
57
|
+
pending: string;
|
|
58
|
+
succeeded: string;
|
|
59
|
+
};
|
|
60
|
+
yes: string;
|
|
61
|
+
no: string;
|
|
62
|
+
refunded: string;
|
|
63
|
+
remaining: string;
|
|
64
|
+
actions: OrderActionLabels;
|
|
65
|
+
}
|
|
66
|
+
export declare const defaultOrderLabels: OrderLabels;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AdminProduct, ProductStatus } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductFilter } from './product-labels';
|
|
3
|
+
export declare function isSold(product: AdminProduct): boolean;
|
|
4
|
+
export declare function displayStatus(product: AdminProduct): string;
|
|
5
|
+
export declare function serverStatus(filter: ProductFilter): ProductStatus | undefined;
|
|
6
|
+
export declare function serverStock(filter: ProductFilter): 'in' | 'sold' | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AdminProduct, AdminProductInput, AdminProductPatch, ProductStatus } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ProductLabels } from './product-labels';
|
|
3
|
+
export declare const FIELD_ORDER: readonly ["name", "category", "description", "materials", "dimensions", "price", "quantity", "status", "featured"];
|
|
4
|
+
export type FieldName = (typeof FIELD_ORDER)[number];
|
|
5
|
+
export type FieldErrors = Partial<Record<FieldName, string>>;
|
|
6
|
+
export interface ProductForm {
|
|
7
|
+
name: string;
|
|
8
|
+
category: string;
|
|
9
|
+
description: string;
|
|
10
|
+
materials: string;
|
|
11
|
+
dimensions: string;
|
|
12
|
+
price: string;
|
|
13
|
+
quantity: string;
|
|
14
|
+
status: ProductStatus;
|
|
15
|
+
featured: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare const emptyForm: ProductForm;
|
|
18
|
+
export declare function formFromProduct(product: AdminProduct): ProductForm;
|
|
19
|
+
export declare function mapServerIssues(issues: unknown[]): FieldErrors;
|
|
20
|
+
export declare function firstInvalidField(errors: FieldErrors): FieldName | undefined;
|
|
21
|
+
export type ValidationResult = {
|
|
22
|
+
ok: true;
|
|
23
|
+
input: AdminProductInput;
|
|
24
|
+
} | {
|
|
25
|
+
ok: false;
|
|
26
|
+
errors: FieldErrors;
|
|
27
|
+
};
|
|
28
|
+
export declare function validateForm(form: ProductForm, labels: ProductLabels, currency?: string): ValidationResult;
|
|
29
|
+
export declare function buildPatch(original: AdminProduct, input: AdminProductInput): AdminProductPatch;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ImageLabels } from './image-labels';
|
|
2
|
+
export type ProductFilter = 'all' | 'live' | 'sold' | 'draft' | 'archived';
|
|
3
|
+
export interface ProductLabels {
|
|
4
|
+
title: string;
|
|
5
|
+
newProduct: string;
|
|
6
|
+
searchLabel: string;
|
|
7
|
+
searchPlaceholder: string;
|
|
8
|
+
filters: Record<ProductFilter, string>;
|
|
9
|
+
empty: Record<ProductFilter, string>;
|
|
10
|
+
noMatches: string;
|
|
11
|
+
loadMore: string;
|
|
12
|
+
columns: {
|
|
13
|
+
image: string;
|
|
14
|
+
name: string;
|
|
15
|
+
price: string;
|
|
16
|
+
status: string;
|
|
17
|
+
quantity: string;
|
|
18
|
+
actions: string;
|
|
19
|
+
};
|
|
20
|
+
noImage: string;
|
|
21
|
+
viewInShop: string;
|
|
22
|
+
markSold: string;
|
|
23
|
+
archive: string;
|
|
24
|
+
markSoldTitle: string;
|
|
25
|
+
markSoldBody: string;
|
|
26
|
+
archiveTitle: string;
|
|
27
|
+
archiveBody: string;
|
|
28
|
+
updated: string;
|
|
29
|
+
createTitle: string;
|
|
30
|
+
editTitle: string;
|
|
31
|
+
saved: string;
|
|
32
|
+
fields: {
|
|
33
|
+
name: string;
|
|
34
|
+
category: string;
|
|
35
|
+
description: string;
|
|
36
|
+
materials: string;
|
|
37
|
+
dimensions: string;
|
|
38
|
+
price: string;
|
|
39
|
+
quantity: string;
|
|
40
|
+
status: string;
|
|
41
|
+
featured: string;
|
|
42
|
+
};
|
|
43
|
+
images: ImageLabels;
|
|
44
|
+
statusHelp: string;
|
|
45
|
+
priceHelp: string;
|
|
46
|
+
validation: {
|
|
47
|
+
required: string;
|
|
48
|
+
price: string;
|
|
49
|
+
quantity: string;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export declare const defaultProductLabels: ProductLabels;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AdminClient } from '../client';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { AdminLabels } from './admin-labels';
|
|
4
|
+
import { AdminLabelOverrides } from './merge-labels';
|
|
5
|
+
export type { AdminErrorKey, AdminLabels } from './admin-labels';
|
|
6
|
+
export interface LinkProps {
|
|
7
|
+
href: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface AdminImageProps {
|
|
12
|
+
src: string;
|
|
13
|
+
alt: string;
|
|
14
|
+
sizes?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
priority?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface AdminConfig {
|
|
19
|
+
renderLink: (props: LinkProps) => ReactNode;
|
|
20
|
+
renderImage: (props: AdminImageProps) => ReactNode;
|
|
21
|
+
locale: string;
|
|
22
|
+
currency: string;
|
|
23
|
+
hrefs: {
|
|
24
|
+
products: string;
|
|
25
|
+
product: (id: string) => string;
|
|
26
|
+
newProduct: string;
|
|
27
|
+
orders: string;
|
|
28
|
+
order: (id: string) => string;
|
|
29
|
+
shippingRates: string;
|
|
30
|
+
discounts: string;
|
|
31
|
+
discount: (id: string) => string;
|
|
32
|
+
newDiscount: string;
|
|
33
|
+
storefrontProduct?: (slug: string) => string;
|
|
34
|
+
};
|
|
35
|
+
client: AdminClient | null;
|
|
36
|
+
labels: AdminLabels;
|
|
37
|
+
}
|
|
38
|
+
export interface AdminProviderProps extends Partial<Omit<AdminConfig, 'hrefs' | 'labels'>> {
|
|
39
|
+
hrefs?: Partial<AdminConfig['hrefs']>;
|
|
40
|
+
labels?: AdminLabelOverrides;
|
|
41
|
+
children: ReactNode;
|
|
42
|
+
}
|
|
43
|
+
export declare function AdminProvider({ children, hrefs, labels, ...overrides }: AdminProviderProps): import('react').JSX.Element;
|
|
44
|
+
export declare function useAdmin(): AdminConfig;
|
|
45
|
+
export declare function useAdminClient(): AdminClient;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AdminOrderDetail } from '@develemit/commerce-contracts';
|
|
2
|
+
export declare function pendingRefundCents(order: AdminOrderDetail): number;
|
|
3
|
+
export declare function remainingRefundCents(order: AdminOrderDetail): number;
|
|
4
|
+
export declare function hasPendingRefund(order: AdminOrderDetail): boolean;
|
|
5
|
+
export declare function canRestock(order: AdminOrderDetail, amountCents: number | null): boolean;
|
|
6
|
+
export declare function canShip(order: AdminOrderDetail): boolean;
|
|
7
|
+
export declare function canRefund(order: AdminOrderDetail): boolean;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface ShippingLabels {
|
|
2
|
+
title: string;
|
|
3
|
+
loading: string;
|
|
4
|
+
empty: string;
|
|
5
|
+
add: string;
|
|
6
|
+
save: string;
|
|
7
|
+
saved: string;
|
|
8
|
+
label: string;
|
|
9
|
+
amount: string;
|
|
10
|
+
currency: string;
|
|
11
|
+
mixedCurrency: string;
|
|
12
|
+
minDays: string;
|
|
13
|
+
maxDays: string;
|
|
14
|
+
active: string;
|
|
15
|
+
rowName: string;
|
|
16
|
+
moveEarlier: string;
|
|
17
|
+
moveLater: string;
|
|
18
|
+
remove: string;
|
|
19
|
+
removeTitle: string;
|
|
20
|
+
removeBody: string;
|
|
21
|
+
newRateLabel: string;
|
|
22
|
+
removalWarning: string;
|
|
23
|
+
unsaved: string;
|
|
24
|
+
noActive: string;
|
|
25
|
+
labelRequired: string;
|
|
26
|
+
labelDuplicate: string;
|
|
27
|
+
amountInvalid: string;
|
|
28
|
+
currencyInvalid: string;
|
|
29
|
+
daysInvalid: string;
|
|
30
|
+
daysOrder: string;
|
|
31
|
+
rowInvalid: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const defaultShippingLabels: ShippingLabels;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ShippingRate, ShippingRateInput } from '@develemit/commerce-contracts';
|
|
2
|
+
import { ShippingLabels } from './shipping-labels';
|
|
3
|
+
export interface RateDraft {
|
|
4
|
+
key: string;
|
|
5
|
+
label: string;
|
|
6
|
+
amount: string;
|
|
7
|
+
currency: string;
|
|
8
|
+
minDays: string;
|
|
9
|
+
maxDays: string;
|
|
10
|
+
active: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface RateErrors {
|
|
13
|
+
label?: string;
|
|
14
|
+
amount?: string;
|
|
15
|
+
minDays?: string;
|
|
16
|
+
maxDays?: string;
|
|
17
|
+
currency?: string;
|
|
18
|
+
row?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface DraftCheck {
|
|
21
|
+
rates: ShippingRateInput[];
|
|
22
|
+
rowErrors: Record<string, RateErrors>;
|
|
23
|
+
noActive: boolean;
|
|
24
|
+
valid: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare const newKey: () => string;
|
|
27
|
+
export declare function toDrafts(rates: ShippingRate[]): RateDraft[];
|
|
28
|
+
export declare function blankDraft(currency: string, label: string): RateDraft;
|
|
29
|
+
export declare const snapshot: (drafts: RateDraft[]) => string;
|
|
30
|
+
export declare function checkDrafts(drafts: RateDraft[], copy: ShippingLabels): DraftCheck;
|
|
31
|
+
export declare function serverRowErrors(issues: unknown[], drafts: RateDraft[], copy: ShippingLabels): Record<string, RateErrors>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface AdminMutation<A extends unknown[], R> {
|
|
2
|
+
run: (...args: A) => Promise<R | undefined>;
|
|
3
|
+
pending: boolean;
|
|
4
|
+
error: unknown;
|
|
5
|
+
reset: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare function useAdminMutation<A extends unknown[], R>(fn: (...args: A) => Promise<R>): AdminMutation<A, R>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebounced<T>(value: T, delayMs: number): T;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AdminDiscountQuery } from '../client/admin-client';
|
|
2
|
+
export declare function useDiscountPages(query: Omit<AdminDiscountQuery, 'cursor'>): {
|
|
3
|
+
items: {
|
|
4
|
+
redeemedCount: number;
|
|
5
|
+
reservedCount: number;
|
|
6
|
+
createdAt: string;
|
|
7
|
+
active: boolean;
|
|
8
|
+
type: "percent" | "fixed";
|
|
9
|
+
id: string;
|
|
10
|
+
code: string;
|
|
11
|
+
minSubtotalCents?: number | null | undefined;
|
|
12
|
+
startsAt?: string | null | undefined;
|
|
13
|
+
endsAt?: string | null | undefined;
|
|
14
|
+
maxRedemptions?: number | null | undefined;
|
|
15
|
+
percentOff?: number | null | undefined;
|
|
16
|
+
amountOffCents?: number | null | undefined;
|
|
17
|
+
currency?: string | null | undefined;
|
|
18
|
+
}[];
|
|
19
|
+
loaded: boolean;
|
|
20
|
+
loading: boolean;
|
|
21
|
+
error: unknown;
|
|
22
|
+
hasMore: boolean;
|
|
23
|
+
loadingMore: boolean;
|
|
24
|
+
reload: () => void;
|
|
25
|
+
loadMore: () => void;
|
|
26
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AdminProduct } from '@develemit/commerce-contracts';
|
|
2
|
+
export interface UploadEntry {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
status: 'queued' | 'uploading' | 'error';
|
|
6
|
+
reason?: string;
|
|
7
|
+
error?: unknown;
|
|
8
|
+
}
|
|
9
|
+
interface Options {
|
|
10
|
+
productId: string;
|
|
11
|
+
onUploaded: (product: AdminProduct) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function useImageUpload({ productId, onUploaded }: Options): {
|
|
14
|
+
entries: UploadEntry[];
|
|
15
|
+
upload: (files: File[], alt: string) => void;
|
|
16
|
+
dismiss: (id: number) => void;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { AdminOrderQuery } from '../client/admin-client';
|
|
2
|
+
export declare function useOrderPages(query: Omit<AdminOrderQuery, 'cursor'>): {
|
|
3
|
+
items: {
|
|
4
|
+
id: string;
|
|
5
|
+
status: "pending" | "paid" | "shipped" | "cancelled" | "expired" | "needs_attention" | "refunded";
|
|
6
|
+
email: string | null;
|
|
7
|
+
totalCents: number;
|
|
8
|
+
currency: string;
|
|
9
|
+
itemCount: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
}[];
|
|
12
|
+
loading: boolean;
|
|
13
|
+
error: unknown;
|
|
14
|
+
hasMore: boolean;
|
|
15
|
+
loadingMore: boolean;
|
|
16
|
+
loadMore: () => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { AdminProductQuery } from '../client/admin-client';
|
|
2
|
+
export declare function useProductPages(query: Omit<AdminProductQuery, 'cursor'>): {
|
|
3
|
+
items: {
|
|
4
|
+
id: string;
|
|
5
|
+
slug: string;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
materials: string | null;
|
|
9
|
+
dimensions: string | null;
|
|
10
|
+
priceCents: number;
|
|
11
|
+
currency: string;
|
|
12
|
+
category: string;
|
|
13
|
+
quantity: number;
|
|
14
|
+
status: "draft" | "active" | "archived";
|
|
15
|
+
featured: boolean;
|
|
16
|
+
images: {
|
|
17
|
+
id: string;
|
|
18
|
+
url: string;
|
|
19
|
+
alt: string;
|
|
20
|
+
position: number;
|
|
21
|
+
}[];
|
|
22
|
+
}[];
|
|
23
|
+
loaded: boolean;
|
|
24
|
+
loading: boolean;
|
|
25
|
+
error: unknown;
|
|
26
|
+
hasMore: boolean;
|
|
27
|
+
loadingMore: boolean;
|
|
28
|
+
reload: () => void;
|
|
29
|
+
loadMore: () => void;
|
|
30
|
+
};
|