@mohasinac/appkit 2.7.9 → 2.7.10

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 (35) hide show
  1. package/dist/_internal/shared/config/index.d.ts +1 -1
  2. package/dist/_internal/shared/config/schema.d.ts +95 -1
  3. package/dist/client-entry.d.ts +1 -1
  4. package/dist/client.d.ts +3 -0
  5. package/dist/client.js +5 -0
  6. package/dist/features/account/components/UserOffersPanel.js +17 -5
  7. package/dist/features/auctions/components/AuctionDetailPageView.js +17 -1
  8. package/dist/features/auctions/components/PlaceBidFormClient.js +10 -5
  9. package/dist/features/categories/components/BundleBuyNowCta.js +13 -6
  10. package/dist/features/events/components/EventPollWidget.js +7 -1
  11. package/dist/features/events/components/SpinWheelView.js +12 -5
  12. package/dist/features/pre-orders/components/PreOrderActionsClient.js +10 -3
  13. package/dist/features/products/components/MakeOfferButton.js +16 -8
  14. package/dist/features/products/components/PrizeRevealModal.js +18 -5
  15. package/dist/features/products/components/ProductDetailPageView.js +23 -1
  16. package/dist/features/seller/components/SellerOffersPanel.js +17 -5
  17. package/dist/features/wishlist/components/WishlistToggleButton.js +26 -12
  18. package/dist/http/api-handler.js +7 -1
  19. package/dist/index.d.ts +3 -0
  20. package/dist/index.js +2 -0
  21. package/dist/server.d.ts +1 -0
  22. package/dist/server.js +2 -0
  23. package/dist/tailwind-utilities.css +1 -1
  24. package/dist/ui/components/BaseListingCard.js +8 -6
  25. package/dist/ui/components/Button.style.css +8 -5
  26. package/dist/ui/components/ListingLayout.style.css +19 -9
  27. package/dist/ui/components/LoginRequiredModal.d.ts +9 -0
  28. package/dist/ui/components/LoginRequiredModal.js +11 -0
  29. package/dist/ui/index.d.ts +2 -0
  30. package/dist/ui/index.js +1 -0
  31. package/dist/utils/auth-error.d.ts +8 -0
  32. package/dist/utils/auth-error.js +20 -0
  33. package/dist/utils/index.d.ts +1 -0
  34. package/dist/utils/index.js +1 -0
  35. package/package.json +1 -1
@@ -1,6 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Button } from "./Button";
3
- import { Span } from "./Typography";
4
2
  function BaseListingCardRoot({ className = "", isSelected, isDisabled, variant = "grid", onClick, onMouseDown, onMouseUp, onMouseLeave, onTouchStart, onTouchEnd, children, }) {
5
3
  return (_jsx("div", { onClick: onClick, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onMouseLeave: onMouseLeave, onTouchStart: onTouchStart, onTouchEnd: onTouchEnd, className: [
6
4
  "group relative w-full min-w-0 overflow-hidden rounded-xl border bg-white dark:bg-zinc-900 transition-shadow",
@@ -48,17 +46,21 @@ function BaseListingCardInfo({ variant = "grid", className = "", children, }) {
48
46
  .join(" "), children: children }));
49
47
  }
50
48
  function BaseListingCardCheckbox({ selected, onSelect, label, position = "top-2 left-2", className = "", }) {
51
- return (_jsx(Button, { type: "button", "aria-label": label ?? (selected ? "Deselect" : "Select"), onClick: (e) => {
49
+ return (_jsx("button", { type: "button", "aria-label": label ?? (selected ? "Deselect" : "Select"), "aria-checked": selected, role: "checkbox", onClick: (e) => {
52
50
  e.stopPropagation();
53
51
  onSelect?.(e);
54
52
  }, className: [
55
- "absolute z-10 h-5 w-5 rounded border-2 flex items-center justify-center bg-white/90",
56
- selected ? "bg-primary border-primary" : "border-zinc-300",
53
+ "absolute z-10 h-4 w-4 rounded flex items-center justify-center",
54
+ "transition-all duration-150 cursor-pointer border focus-visible:outline-none",
55
+ "focus-visible:ring-2 focus-visible:ring-primary/50",
56
+ selected
57
+ ? "bg-primary border-primary shadow-sm"
58
+ : "bg-white/80 border-zinc-300/80 hover:border-primary/60 hover:bg-white dark:bg-zinc-800/80 dark:border-zinc-600",
57
59
  position,
58
60
  className,
59
61
  ]
60
62
  .filter(Boolean)
61
- .join(" "), children: selected && _jsx(Span, { className: "text-white text-xs leading-none", children: "\u2713" }) }));
63
+ .join(" "), children: selected && (_jsx("svg", { className: "w-2.5 h-2.5 text-white", viewBox: "0 0 10 10", fill: "none", "aria-hidden": "true", children: _jsx("path", { d: "M1.5 5L4 7.5L8.5 2.5", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) })) }));
62
64
  }
63
65
  export const BaseListingCard = Object.assign(BaseListingCardRoot, {
64
66
  Hero: BaseListingCardHero,
@@ -100,20 +100,23 @@
100
100
  }
101
101
 
102
102
  .appkit-button--secondary {
103
- background: var(--appkit-color-primary-700);
104
- color: var(--appkit-color-text-on-primary);
103
+ background: var(--appkit-color-surface);
104
+ border-color: var(--appkit-color-primary-700);
105
+ color: var(--appkit-color-primary-700);
105
106
  }
106
107
 
107
108
  .appkit-button--secondary:hover:not(:disabled) {
108
- background: var(--appkit-color-primary-600);
109
+ background: color-mix(in srgb, var(--appkit-color-primary-700) 8%, transparent);
109
110
  }
110
111
 
111
112
  .dark .appkit-button--secondary {
112
- background: var(--appkit-color-secondary-700);
113
+ background: transparent;
114
+ border-color: var(--appkit-color-secondary);
115
+ color: var(--appkit-color-secondary);
113
116
  }
114
117
 
115
118
  .dark .appkit-button--secondary:hover:not(:disabled) {
116
- background: var(--appkit-color-secondary-600);
119
+ background: color-mix(in srgb, var(--appkit-color-secondary) 12%, transparent);
117
120
  }
118
121
 
119
122
  .appkit-button--outline {
@@ -227,20 +227,30 @@
227
227
  /* -- Bulk action bar --------------------------------- */
228
228
 
229
229
  .appkit-listing-layout__bulk-bar {
230
- display: none;
230
+ display: block;
231
231
  padding-top: 0.5rem;
232
- margin-top: 0.5rem;
233
- border-top: 1px solid var(--appkit-color-zinc-100);
232
+ margin-top: 0.375rem;
233
+ border-top: 1px solid rgba(161, 161, 170, 0.25);
234
234
  }
235
235
 
236
- @media (min-width: 1024px) {
237
- .appkit-listing-layout__bulk-bar {
238
- display: block;
239
- }
236
+ .dark .appkit-listing-layout__bulk-bar {
237
+ border-top-color: rgba(30, 41, 59, 0.6);
240
238
  }
241
239
 
242
- .dark .appkit-listing-layout__bulk-bar {
243
- border-top-color: var(--appkit-color-slate-800);
240
+ /* Strip BulkActionBar card chrome when embedded in the toolbar */
241
+ .appkit-listing-layout__bulk-bar .appkit-bulk-bar {
242
+ border: none;
243
+ border-radius: 0;
244
+ animation: none;
245
+ background: transparent;
246
+ }
247
+
248
+ .appkit-listing-layout__bulk-bar .appkit-bulk-bar__stripe {
249
+ display: none;
250
+ }
251
+
252
+ .appkit-listing-layout__bulk-bar .appkit-bulk-bar__row {
253
+ padding: 0 0 0.25rem;
244
254
  }
245
255
 
246
256
  /* -- Body (sidebar + content) ------------------------ */
@@ -0,0 +1,9 @@
1
+ export interface LoginRequiredModalProps {
2
+ isOpen: boolean;
3
+ onClose: () => void;
4
+ /** Body copy shown inside the modal. */
5
+ message?: string;
6
+ /** Override the login destination (default: ROUTES.AUTH.LOGIN). */
7
+ loginHref?: string;
8
+ }
9
+ export declare function LoginRequiredModal({ isOpen, onClose, message, loginHref, }: LoginRequiredModalProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Modal } from "./Modal";
4
+ import { Button } from "./Button";
5
+ import { Div } from "./Div";
6
+ import { Text } from "./Typography";
7
+ import { ROUTES } from "../../next/routing/route-map";
8
+ export function LoginRequiredModal({ isOpen, onClose, message = "You need to be signed in to continue. Please log in or create an account.", loginHref, }) {
9
+ const href = loginHref ?? String(ROUTES.AUTH.LOGIN);
10
+ return (_jsx(Modal, { isOpen: isOpen, onClose: onClose, title: "Sign in required", size: "sm", actions: _jsxs(Div, { className: "flex gap-3 justify-end", children: [_jsx(Button, { variant: "ghost", size: "sm", onClick: onClose, children: "Cancel" }), _jsx(Button, { variant: "primary", size: "sm", onClick: () => { window.location.href = href; }, children: "Go to Login" })] }), children: _jsx(Text, { className: "text-sm text-zinc-600 dark:text-zinc-300", children: message }) }));
11
+ }
@@ -43,6 +43,8 @@ export type { ModalProps } from "./components/Modal";
43
43
  export { Modal, ModalFooter } from "./components/Modal";
44
44
  export type { UnsavedChangesModalProps, UnsavedChangesLabels, } from "./components/UnsavedChangesModal";
45
45
  export { UnsavedChangesModal } from "./components/UnsavedChangesModal";
46
+ export type { LoginRequiredModalProps } from "./components/LoginRequiredModal";
47
+ export { LoginRequiredModal } from "./components/LoginRequiredModal";
46
48
  export type { DrawerProps } from "./components/Drawer";
47
49
  export { Drawer } from "./components/Drawer";
48
50
  export type { BackgroundRendererProps, BackgroundConfig, } from "./components/BackgroundRenderer";
package/dist/ui/index.js CHANGED
@@ -25,6 +25,7 @@ export { Pagination } from "./components/Pagination";
25
25
  export { StatusBadge } from "./components/StatusBadge";
26
26
  export { Modal, ModalFooter } from "./components/Modal";
27
27
  export { UnsavedChangesModal } from "./components/UnsavedChangesModal";
28
+ export { LoginRequiredModal } from "./components/LoginRequiredModal";
28
29
  export { Drawer } from "./components/Drawer";
29
30
  export { BackgroundRenderer } from "./components/BackgroundRenderer";
30
31
  export { ResponsiveView } from "./components/ResponsiveView";
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Detects auth/authorization errors thrown by server actions or fetch responses.
3
+ *
4
+ * Pass the caught error (and optionally the HTTP status code for fetch-based
5
+ * callers) to determine whether the caller should prompt the user to log in
6
+ * rather than displaying a generic error message.
7
+ */
8
+ export declare function isAuthError(err: unknown, httpStatus?: number): boolean;
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Detects auth/authorization errors thrown by server actions or fetch responses.
3
+ *
4
+ * Pass the caught error (and optionally the HTTP status code for fetch-based
5
+ * callers) to determine whether the caller should prompt the user to log in
6
+ * rather than displaying a generic error message.
7
+ */
8
+ export function isAuthError(err, httpStatus) {
9
+ if (httpStatus === 401 || httpStatus === 403)
10
+ return true;
11
+ const msg = (err instanceof Error ? err.message : String(err)).toLowerCase();
12
+ return (msg.includes("unauthorized") ||
13
+ msg.includes("not authenticated") ||
14
+ msg.includes("unauthenticated") ||
15
+ msg.includes("authentication required") ||
16
+ msg.includes("invalid or expired session") ||
17
+ msg.includes("sign in to") ||
18
+ msg === "error 401" ||
19
+ msg === "error 403");
20
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./auth-error";
1
2
  export * from "./date.formatter";
2
3
  export * from "./number.formatter";
3
4
  export * from "./string.formatter";
@@ -1,3 +1,4 @@
1
+ export * from "./auth-error";
1
2
  export * from "./date.formatter";
2
3
  export * from "./number.formatter";
3
4
  export * from "./string.formatter";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohasinac/appkit",
3
- "version": "2.7.9",
3
+ "version": "2.7.10",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public"