@mohasinac/appkit 4.7.2 → 4.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/dist/_internal/client/features/layout/DashboardLayoutClient.js +25 -5
- package/dist/_internal/shared/features/cart/schema.d.ts +6 -6
- package/dist/_internal/shared/features/orders/schema.d.ts +2 -2
- package/dist/_internal/shared/features/products/schema.d.ts +8 -8
- package/dist/features/account/schemas/index.d.ts +12 -12
- package/dist/features/admin/components/AdminArtView.js +1 -0
- package/dist/features/admin/components/AdminBlogView.js +1 -0
- package/dist/features/admin/components/AdminClassifiedView.js +1 -0
- package/dist/features/admin/components/AdminDigitalCodesView.js +1 -0
- package/dist/features/admin/components/AdminLiveView.js +1 -0
- package/dist/features/admin/components/AdminPrizeDrawsView.js +1 -0
- package/dist/features/admin/components/AdminProductsView.js +1 -0
- package/dist/features/admin/components/AdminStickersView.js +1 -0
- package/dist/features/admin/components/AdminStoresView.js +1 -0
- package/dist/features/admin/components/AdminUsersView.js +1 -0
- package/dist/features/admin/components/AdminViewCards.d.ts +3 -1
- package/dist/features/admin/components/AdminViewCards.js +21 -7
- package/dist/features/admin/components/DataListingView.d.ts +2 -0
- package/dist/features/admin/components/DataListingView.js +4 -2
- package/dist/features/admin/components/DataTable.d.ts +3 -1
- package/dist/features/admin/components/DataTable.js +36 -21
- package/dist/features/collections/schemas/index.d.ts +3 -3
- package/dist/features/homepage/schemas/index.d.ts +4 -4
- package/dist/features/orders/schemas/index.d.ts +22 -22
- package/dist/features/pre-orders/schemas/index.d.ts +2 -2
- package/dist/features/products/schemas/index.d.ts +8 -8
- package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
- package/dist/features/reviews/schemas/index.d.ts +4 -4
- package/dist/features/scams/schemas/index.d.ts +4 -4
- package/dist/features/seller/components/SellerAuctionsView.js +1 -0
- package/dist/features/seller/components/SellerPreOrdersView.js +1 -0
- package/dist/features/seller/components/SellerPrizeDrawsView.js +1 -0
- package/dist/features/seller/components/SellerProductsView.js +1 -0
- package/dist/features/shipments/schemas/validation.d.ts +6 -6
- package/dist/features/support/schemas/index.d.ts +2 -2
- package/dist/features/wishlist/hooks/useWishlistWithGuest.d.ts +1 -1
- package/dist/schemas/registry.d.ts +70 -70
- package/dist/schemas/webhooks/razorpay.d.ts +50 -50
- package/dist/ui/columns/column-renderers.d.ts +5 -0
- package/dist/ui/columns/column-renderers.js +135 -0
- package/dist/ui/columns/index.d.ts +2 -2
- package/dist/ui/columns/index.js +1 -1
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +1 -1
- package/package.json +1 -1
|
@@ -45,6 +45,141 @@ export function renderNullable(value, format, fallback = "—") {
|
|
|
45
45
|
return fallback;
|
|
46
46
|
return format ? format(value) : String(value);
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Normalizes the wide variety of status-string values used across
|
|
50
|
+
* collections (order status, product status, payout status, ban status,
|
|
51
|
+
* etc.) into one of 5 semantic tones, so a single badge component can
|
|
52
|
+
* color-code every dashboard table consistently instead of every status
|
|
53
|
+
* pill rendering the same flat color regardless of meaning.
|
|
54
|
+
*/
|
|
55
|
+
const STATUS_TONE_MAP = {
|
|
56
|
+
// success
|
|
57
|
+
published: "success",
|
|
58
|
+
active: "success",
|
|
59
|
+
paid: "success",
|
|
60
|
+
delivered: "success",
|
|
61
|
+
won: "success",
|
|
62
|
+
approved: "success",
|
|
63
|
+
confirmed: "success",
|
|
64
|
+
completed: "success",
|
|
65
|
+
verified: "success",
|
|
66
|
+
in_stock: "success",
|
|
67
|
+
resolved: "success",
|
|
68
|
+
shipped: "success",
|
|
69
|
+
yes: "success",
|
|
70
|
+
true: "success",
|
|
71
|
+
done: "success",
|
|
72
|
+
success: "success",
|
|
73
|
+
// warning
|
|
74
|
+
pending: "warning",
|
|
75
|
+
processing: "warning",
|
|
76
|
+
draft: "warning",
|
|
77
|
+
low_stock: "warning",
|
|
78
|
+
waitlisted: "warning",
|
|
79
|
+
in_review: "warning",
|
|
80
|
+
open: "warning",
|
|
81
|
+
return_requested: "warning",
|
|
82
|
+
soft_bans: "warning",
|
|
83
|
+
// error
|
|
84
|
+
failed: "error",
|
|
85
|
+
cancelled: "error",
|
|
86
|
+
canceled: "error",
|
|
87
|
+
rejected: "error",
|
|
88
|
+
banned: "error",
|
|
89
|
+
hard_banned: "error",
|
|
90
|
+
disabled: "error",
|
|
91
|
+
refunded: "error",
|
|
92
|
+
out_of_stock: "error",
|
|
93
|
+
expired: "error",
|
|
94
|
+
declined: "error",
|
|
95
|
+
removed: "error",
|
|
96
|
+
suspended: "error",
|
|
97
|
+
no: "error",
|
|
98
|
+
false: "error",
|
|
99
|
+
// info
|
|
100
|
+
scheduled: "info",
|
|
101
|
+
closed: "info",
|
|
102
|
+
};
|
|
103
|
+
/** Map a raw status string to a semantic tone for badge coloring. */
|
|
104
|
+
export function getStatusTone(status) {
|
|
105
|
+
if (!status)
|
|
106
|
+
return "neutral";
|
|
107
|
+
const normalized = status
|
|
108
|
+
.toLowerCase()
|
|
109
|
+
.trim()
|
|
110
|
+
.replace(/[\s-]+/g, "_")
|
|
111
|
+
.replace(/\(.*\)$/, "")
|
|
112
|
+
.trim();
|
|
113
|
+
return STATUS_TONE_MAP[normalized] ?? "neutral";
|
|
114
|
+
}
|
|
115
|
+
// --- Resource icon --------------------------------------------------------------
|
|
116
|
+
/**
|
|
117
|
+
* One emoji per dashboard resource type, keyed by the 2nd segment of a
|
|
118
|
+
* `ListingViewConfig.queryKey` (e.g. `["admin","users","listing"]` -> "users").
|
|
119
|
+
* Used as the row-avatar fallback for tables/cards whose rows have no
|
|
120
|
+
* per-row photo/thumbnail — gives every dashboard table a visual anchor
|
|
121
|
+
* instead of plain text on a white/black background.
|
|
122
|
+
*/
|
|
123
|
+
const RESOURCE_ICON_MAP = {
|
|
124
|
+
users: "👤",
|
|
125
|
+
team: "🧑💼",
|
|
126
|
+
stores: "🏪",
|
|
127
|
+
products: "📦",
|
|
128
|
+
art: "🎨",
|
|
129
|
+
stickers: "🏷️",
|
|
130
|
+
"live-items": "🔴",
|
|
131
|
+
"digital-codes": "🔑",
|
|
132
|
+
classified: "📋",
|
|
133
|
+
"pre-orders": "🕓",
|
|
134
|
+
"prize-draws": "🎁",
|
|
135
|
+
auctions: "🔨",
|
|
136
|
+
bundles: "🎀",
|
|
137
|
+
bids: "🔨",
|
|
138
|
+
orders: "🧾",
|
|
139
|
+
payouts: "💰",
|
|
140
|
+
"payout-methods": "💳",
|
|
141
|
+
coupons: "🎟️",
|
|
142
|
+
reviews: "⭐",
|
|
143
|
+
blog: "📝",
|
|
144
|
+
events: "🎉",
|
|
145
|
+
"event-entries": "🎫",
|
|
146
|
+
notifications: "🔔",
|
|
147
|
+
carts: "🛒",
|
|
148
|
+
wishlists: "💝",
|
|
149
|
+
history: "🕐",
|
|
150
|
+
categories: "🏷️",
|
|
151
|
+
brands: "🏷️",
|
|
152
|
+
faqs: "❓",
|
|
153
|
+
carousel: "🖼️",
|
|
154
|
+
addresses: "📍",
|
|
155
|
+
"address-clusters": "📍",
|
|
156
|
+
"store-addresses": "📍",
|
|
157
|
+
sessions: "💻",
|
|
158
|
+
scammers: "🚫",
|
|
159
|
+
"support-tickets": "🎫",
|
|
160
|
+
"return-requests": "↩️",
|
|
161
|
+
contact: "✉️",
|
|
162
|
+
newsletter: "📰",
|
|
163
|
+
"grouped-listings": "🧷",
|
|
164
|
+
shipments: "🚚",
|
|
165
|
+
features: "🧩",
|
|
166
|
+
"payment-methods": "💳",
|
|
167
|
+
"shipping-configs": "🚚",
|
|
168
|
+
"store-categories": "🏷️",
|
|
169
|
+
"sublisting-categories": "🏷️",
|
|
170
|
+
"tester-checklist-items": "✅",
|
|
171
|
+
"tester-feedback": "💬",
|
|
172
|
+
"catalogue-approvals": "📚",
|
|
173
|
+
offers: "🤝",
|
|
174
|
+
};
|
|
175
|
+
/** Fallback icon for any resource not in the map. */
|
|
176
|
+
const RESOURCE_ICON_FALLBACK = "📄";
|
|
177
|
+
/** Resolve a resource-type icon from a `queryKey[1]`-style resource name. */
|
|
178
|
+
export function getResourceIcon(resourceKey) {
|
|
179
|
+
if (!resourceKey)
|
|
180
|
+
return RESOURCE_ICON_FALLBACK;
|
|
181
|
+
return RESOURCE_ICON_MAP[resourceKey] ?? RESOURCE_ICON_FALLBACK;
|
|
182
|
+
}
|
|
48
183
|
/** Render a rating value as "4.2 (31)" or "★★★★☆". */
|
|
49
184
|
export function renderRating(rating, reviewCount, opts) {
|
|
50
185
|
if (rating == null)
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Barrel for shared column utilities.
|
|
3
3
|
*/
|
|
4
4
|
export { buildColumns, createColumnBuilder } from "./build-columns";
|
|
5
|
-
export { renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, } from "./column-renderers";
|
|
6
|
-
export type { BooleanRenderOpts, RatingMode, RatingRenderOpts, } from "./column-renderers";
|
|
5
|
+
export { renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, getStatusTone, getResourceIcon, } from "./column-renderers";
|
|
6
|
+
export type { BooleanRenderOpts, RatingMode, RatingRenderOpts, StatusTone, } from "./column-renderers";
|
package/dist/ui/columns/index.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
* Barrel for shared column utilities.
|
|
3
3
|
*/
|
|
4
4
|
export { buildColumns, createColumnBuilder } from "./build-columns";
|
|
5
|
-
export { renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, } from "./column-renderers";
|
|
5
|
+
export { renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, getStatusTone, getResourceIcon, } from "./column-renderers";
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export type { FieldCheckboxProps } from "./forms";
|
|
|
10
10
|
export { FieldCheckbox } from "./forms";
|
|
11
11
|
export type { FieldTextareaProps } from "./forms";
|
|
12
12
|
export { FieldTextarea } from "./forms";
|
|
13
|
-
export { buildColumns, createColumnBuilder, renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, } from "./columns";
|
|
14
|
-
export type { BooleanRenderOpts, RatingMode, RatingRenderOpts, } from "./columns";
|
|
13
|
+
export { buildColumns, createColumnBuilder, renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, getStatusTone, getResourceIcon, } from "./columns";
|
|
14
|
+
export type { BooleanRenderOpts, RatingMode, RatingRenderOpts, StatusTone, } from "./columns";
|
|
15
15
|
export type { SectionProps, SectionBackgroundConfig, ArticleProps, MainProps, AsideProps, NavProps, BlockHeaderProps, BlockFooterProps, UlProps, OlProps, LiProps, TableProps, TheadProps, TbodyProps, TrProps, ThProps, TdProps, CodeProps, PreProps, BlockquoteProps, FigureProps, FigcaptionProps, DlProps, DtProps, DdProps, } from "./components/Semantic";
|
|
16
16
|
export { Section, sectionBackgroundStyle, Article, Main, Aside, Nav, BlockHeader, BlockFooter, Ul, Ol, Li, Table, Thead, Tbody, Tr, Th, Td, Code, Pre, Blockquote, Figure, Figcaption, Dl, Dt, Dd, } from "./components/Semantic";
|
|
17
17
|
export type { DivProps } from "./components/Div";
|
package/dist/ui/index.js
CHANGED
|
@@ -6,7 +6,7 @@ export { FieldSelect } from "./forms";
|
|
|
6
6
|
export { FieldCheckbox } from "./forms";
|
|
7
7
|
export { FieldTextarea } from "./forms";
|
|
8
8
|
// --- Column utilities ---------------------------------------------------------
|
|
9
|
-
export { buildColumns, createColumnBuilder, renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, } from "./columns";
|
|
9
|
+
export { buildColumns, createColumnBuilder, renderBoolean, renderCurrency, renderCurrencyCompact, renderCount, renderNullable, renderRating, getStatusTone, getResourceIcon, } from "./columns";
|
|
10
10
|
export { Section, sectionBackgroundStyle, Article, Main, Aside, Nav, BlockHeader, BlockFooter, Ul, Ol, Li, Table, Thead, Tbody, Tr, Th, Td, Code, Pre, Blockquote, Figure, Figcaption, Dl, Dt, Dd, } from "./components/Semantic";
|
|
11
11
|
export { Div } from "./components/Div";
|
|
12
12
|
export { Heading, Text, Label, Caption, Span } from "./components/Typography";
|