@mohasinac/appkit 3.3.3 → 3.3.4

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.
Files changed (41) hide show
  1. package/dist/_internal/client/features/lottery/LotteryAdminSlotView.js +1 -1
  2. package/dist/_internal/server/features/cart/actions.js +1 -1
  3. package/dist/_internal/server/features/lottery/data.d.ts +2 -3
  4. package/dist/_internal/server/features/products/actions.js +1 -1
  5. package/dist/features/admin/components/AdminSectionsView.js +7 -4
  6. package/dist/features/admin/constants/filter-tabs.js +11 -0
  7. package/dist/features/auctions/columns/index.js +1 -1
  8. package/dist/features/auctions/schemas/index.d.ts +2 -2
  9. package/dist/features/auth/hooks/useRBAC.js +6 -1
  10. package/dist/features/blog/columns/index.js +1 -1
  11. package/dist/features/categories/schemas/firestore.d.ts +1 -1
  12. package/dist/features/contact/email.js +0 -1
  13. package/dist/features/forms/Slider.js +4 -1
  14. package/dist/features/forms/Toggle.js +4 -1
  15. package/dist/features/homepage/components/NewsletterBanner.js +1 -1
  16. package/dist/features/layout/BottomActions.js +27 -0
  17. package/dist/features/layout/BottomActionsContext.d.ts +36 -0
  18. package/dist/features/layout/BottomActionsContext.js +36 -0
  19. package/dist/features/orders/schemas/index.d.ts +2 -2
  20. package/dist/features/payments/schemas/index.d.ts +4 -4
  21. package/dist/features/products/repository/products.repository.js +1 -1
  22. package/dist/features/products/schemas/product-features.validators.d.ts +6 -6
  23. package/dist/features/promotions/repository/claimed-coupons.repository.js +1 -1
  24. package/dist/features/reviews/columns/index.js +1 -1
  25. package/dist/features/search/schemas/index.d.ts +2 -2
  26. package/dist/features/seller/actions/seller-actions.d.ts +2 -2
  27. package/dist/features/seller/components/SellerOrdersView.js +4 -1
  28. package/dist/features/seller/components/SellerProductsView.js +35 -31
  29. package/dist/features/seller/components/SellerReviewsView.js +1 -1
  30. package/dist/features/seller/schemas/index.d.ts +2 -2
  31. package/dist/features/stores/columns/index.js +1 -1
  32. package/dist/features/stores/components/StoresIndexListing.js +20 -15
  33. package/dist/features/wishlist/actions/wishlist-actions.js +1 -1
  34. package/dist/next/components/NotFoundView.js +17 -0
  35. package/dist/next/components/UnauthorizedView.js +13 -0
  36. package/dist/schemas/registry.d.ts +93 -94
  37. package/dist/schemas/webhooks/razorpay.d.ts +86 -86
  38. package/dist/ui/columns/column-renderers.js +1 -1
  39. package/dist/ui/components/Accordion.js +10 -6
  40. package/dist/ui/components/ListingLayout.js +6 -2
  41. package/package.json +1 -1
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
3
3
  import { normalizeError } from "../../../errors/normalize";
4
4
  import { useCallback, useEffect, useMemo, useState } from "react";
5
- import { Alert, Badge, BulkActionBar, Button, Checkbox, Div, Modal, Row, Select, SideDrawer, Span, Stack, Text, Textarea, } from "../../../ui";
5
+ import { Alert, Badge, BulkActionBar, Button, Checkbox, Div, Modal, Row, Select, SideDrawer, Span, Stack, Text, Textarea } from "../../../ui";
6
6
  import { StackedViewShell } from "../../../ui";
7
7
  import { useBottomActions } from "../../layout";
8
8
  import { ACTIONS } from "../../../_internal/shared/actions/action-registry";
@@ -167,8 +167,8 @@ export declare const payoutRecordSchema: z.ZodObject<{
167
167
  createdAt: z.ZodString;
168
168
  updatedAt: z.ZodString;
169
169
  }, "strip", z.ZodTypeAny, {
170
- status: "pending" | "paid" | "failed" | "processing";
171
170
  currency: string;
171
+ status: "pending" | "paid" | "failed" | "processing";
172
172
  createdAt: string;
173
173
  id: string;
174
174
  updatedAt: string;
@@ -184,8 +184,8 @@ export declare const payoutRecordSchema: z.ZodObject<{
184
184
  sellerId: string;
185
185
  processedAt?: string | undefined;
186
186
  }, {
187
- status: "pending" | "paid" | "failed" | "processing";
188
187
  currency: string;
188
+ status: "pending" | "paid" | "failed" | "processing";
189
189
  createdAt: string;
190
190
  id: string;
191
191
  updatedAt: string;
@@ -1,4 +1,4 @@
1
- import { buildColumns, renderBoolean, renderNullable, renderRating, } from "../../../ui/columns";
1
+ import { buildColumns, renderBoolean, renderNullable, renderRating } from "../../../ui/columns";
2
2
  /**
3
3
  * Default admin column definitions for a store table.
4
4
  *
@@ -121,6 +121,26 @@ export function StoresIndexListing({ initialData }) {
121
121
  filters: filterParts.length > 0 ? filterParts.join(",") : undefined,
122
122
  }, { initialData });
123
123
  const selection = useBulkSelection({ items: stores, keyExtractor: (s) => s.id ?? s.storeSlug });
124
+ // useBottomActions must run unconditionally on every render, once per
125
+ // component — it was previously mis-placed inside the grid view's
126
+ // `stores.map(...)` callback below, which fired it once per store in the
127
+ // list (a severe Rules-of-Hooks violation) instead of once for the whole
128
+ // bulk-selection bar.
129
+ useBottomActions(selection.selectedCount > 0 ? { bulk: { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: [
130
+ {
131
+ id: ACTION_ID.COMPARE,
132
+ label: "Compare",
133
+ variant: "secondary",
134
+ onClick: () => { selection.clearSelection(); },
135
+ },
136
+ {
137
+ id: "visit",
138
+ label: "Visit Store",
139
+ variant: "primary",
140
+ disabled: selection.selectedCount !== 1,
141
+ onClick: () => { selection.clearSelection(); },
142
+ },
143
+ ] } } : {});
124
144
  return (_jsxs(Div, { className: "min-h-screen", children: [_jsx(ListingToolbar, { filterCount: activeFilterCount, onFiltersClick: openFilters, searchValue: searchInput, searchPlaceholder: "Search stores...", onSearchChange: setSearchInput, onSearchCommit: commitSearch, sortValue: table.get(TABLE_KEYS.SORT) || DEFAULT_SORT, sortOptions: STORE_SORT_OPTIONS, onSortChange: (v) => { table.set(TABLE_KEYS.SORT, v); }, view: view, onViewChange: handleViewToggle, onResetAll: resetAll, hasActiveState: hasActiveState, bulkMode: selection.isSelecting, bulkSelectedCount: selection.selectedCount, bulkTotalCount: stores.length, onBulkSelectAll: selection.toggleAll, onBulkClear: selection.clearSelection }), _jsx(BulkActionBar, { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: [
125
145
  {
126
146
  id: ACTION_ID.COMPARE,
@@ -140,21 +160,6 @@ export function StoresIndexListing({ initialData }) {
140
160
  return (_jsx(InteractiveStoreCard, { store: store, href: String(ROUTES.PUBLIC.STORE_DETAIL(storeKey)), selectable: selection.isSelecting, isSelected: selection.isSelected(store.id ?? store.storeSlug), onSelect: (id, sel) => { void sel; selection.toggle(id); } }, storeKey));
141
161
  }) })) : (_jsx(Div, { layout: "grid", gap: "6", className: "grid-cols-1 sm:grid-cols-2 lg:grid-cols-3", children: stores.map((store) => {
142
162
  const storeKey = store.storeSlug ?? store.id;
143
- useBottomActions(selection.selectedCount > 0 ? { bulk: { selectedCount: selection.selectedCount, onClearSelection: selection.clearSelection, actions: [
144
- {
145
- id: ACTION_ID.COMPARE,
146
- label: "Compare",
147
- variant: "secondary",
148
- onClick: () => { selection.clearSelection(); },
149
- },
150
- {
151
- id: "visit",
152
- label: "Visit Store",
153
- variant: "primary",
154
- disabled: selection.selectedCount !== 1,
155
- onClick: () => { selection.clearSelection(); },
156
- },
157
- ] } } : {});
158
163
  return (_jsx(InteractiveStoreCard, { store: store, href: String(ROUTES.PUBLIC.STORE_DETAIL(storeKey)), selectable: selection.isSelecting, isSelected: selection.isSelected(store.id ?? store.storeSlug), onSelect: (id, sel) => { void sel; selection.toggle(id); } }, storeKey));
159
164
  }) })) }), _jsx(ListingFilterDrawer, { open: filterOpen, onClose: () => setFilterOpen(false), onApply: applyFilters, onClear: clearFilters, activeCount: pendingFilterCount, children: _jsx(StoreFilters, { table: pendingTable }) })] }));
160
165
  }
@@ -5,7 +5,7 @@
5
5
  * Auth, rate-limiting, and Next.js specifics are handled by the consumer.
6
6
  */
7
7
  import { ValidationError } from "../../../errors";
8
- import { wishlistRepository, } from "../repository/user-wishlist.repository";
8
+ import { wishlistRepository } from "../repository/user-wishlist.repository";
9
9
  import { productRepository } from "../../products/repository/products.repository";
10
10
  export { WishlistFullError } from "../repository/user-wishlist.repository";
11
11
  export async function addToWishlist(userSlug, productId, extras) {
@@ -1,4 +1,21 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * NotFoundView — Next.js not-found.tsx template.
4
+ *
5
+ * Rendered when `notFound()` is called inside a route segment, or when a
6
+ * route is not matched.
7
+ * @see https://nextjs.org/docs/app/api-reference/file-conventions/not-found
8
+ *
9
+ * Usage in your app:
10
+ * // app/[locale]/not-found.tsx
11
+ * export { NotFoundView as default } from "@mohasinac/appkit/next";
12
+ *
13
+ * // Or with customisation:
14
+ * import { NotFoundView } from "@mohasinac/appkit/next";
15
+ * export default function NotFound() {
16
+ * return <NotFoundView heading="Page not found" homeHref="/en" />;
17
+ * }
18
+ */
2
19
  import { Heading, Text } from "../../ui/components/Typography";
3
20
  import { TextLink } from "../../ui/components/TextLink";
4
21
  import { DEFAULT_ROUTE_MAP } from "../routing/route-map";
@@ -1,4 +1,17 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * UnauthorizedView — 401 page template.
4
+ *
5
+ * Render this when a user tries to access a resource they are not
6
+ * authenticated for. Wire up the `loginHref` prop to your sign-in route.
7
+ *
8
+ * Usage in your app:
9
+ * // app/[locale]/unauthorized/page.tsx
10
+ * import { UnauthorizedView } from "@mohasinac/appkit/next";
11
+ * export default function UnauthorizedPage() {
12
+ * return <UnauthorizedView loginHref="/en/auth/login" />;
13
+ * }
14
+ */
2
15
  import { Row } from "../../ui/components/Layout";
3
16
  import { Heading, Text } from "../../ui/components/Typography";
4
17
  import { TextLink } from "../../ui/components/TextLink";