@burdenoff/microfe-coolandlovely 2026.1024.4 → 2026.1026.1
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/coolandlovely/CoolAndLovelyRoutes.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +20 -12
- package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
- package/dist/coolandlovely/components/FulfilmentTimeline.d.ts +7 -0
- package/dist/coolandlovely/components/FulfilmentTimeline.d.ts.map +1 -0
- package/dist/coolandlovely/components/FulfilmentTimeline.js +77 -0
- package/dist/coolandlovely/components/FulfilmentTimeline.js.map +1 -0
- package/dist/coolandlovely/components/StatusBadge.d.ts.map +1 -1
- package/dist/coolandlovely/components/StatusBadge.js +9 -1
- package/dist/coolandlovely/components/StatusBadge.js.map +1 -1
- package/dist/coolandlovely/hooks/useBrandOrdersApi.d.ts +7 -0
- package/dist/coolandlovely/hooks/useBrandOrdersApi.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/useBrandOrdersApi.js +92 -0
- package/dist/coolandlovely/hooks/useBrandOrdersApi.js.map +1 -0
- package/dist/coolandlovely/hooks/useCommerceApi.d.ts +2 -0
- package/dist/coolandlovely/hooks/useCommerceApi.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useCommerceApi.js +26 -22
- package/dist/coolandlovely/hooks/useCommerceApi.js.map +1 -1
- package/dist/coolandlovely/pages/brands/BrandDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/brands/BrandDetailPage.js +157 -148
- package/dist/coolandlovely/pages/brands/BrandDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.d.ts +13 -0
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js +360 -0
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js.map +1 -0
- package/dist/coolandlovely/pages/commerce/CartPage.js +4 -4
- package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/commerce/OrdersPage.js +122 -101
- package/dist/coolandlovely/pages/commerce/OrdersPage.js.map +1 -1
- package/dist/coolandlovely/types/commerce.d.ts +61 -0
- package/dist/coolandlovely/types/commerce.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommerceApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCommerceApi.ts"],"sourcesContent":["/**\n * Commerce API hooks (BOFF-3370)\n * @module coolandlovely/hooks\n *\n * React Query layer over the self-scoped commerce fields of `wspace-coolandlovely-svc`:\n * the shopper's cart, checkout and orders, and the creator's look commissions + payouts.\n * The client never decides that an order is paid — it opens the provider's checkout that\n * global-billing prepared and then asks the backend to settle against billing's record.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooAddToCartInput,\n CooCart,\n CooCheckoutInput,\n CooCreatorEarningConnection,\n CooCreatorEarningsSummary,\n CooCreatorPayout,\n CooOrder,\n CooOrderCheckout,\n CooOrderConnection,\n CooOrderStatus,\n} from '../types';\nimport { coolQuery } from './useCoolAndLovelyApi';\n\nconst QK = 'coolandlovely';\n\nconst CART_FIELDS = `\n items {\n id styleItemId quantity size colour lookId unitPrice currency lineTotal isPurchasable\n styleItem { id name status image { id } brand { id name } }\n }\n itemCount subtotal currency canCheckout blockedReason\n`;\n\nconst ORDER_FIELDS = `\n id orderNumber status currency subtotal taxAmount total itemCount\n shippingName shippingAddress buyerNote paymentProvider paidAt cancelledAt createdAt updatedAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n`;\n\nconst CHECKOUT_FIELDS = `\n order { ${ORDER_FIELDS} }\n provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency\n`;\n\n// ---------------------------------------------------------------------------\n// Cart\n// ---------------------------------------------------------------------------\n\nexport const useMyCart = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'cart'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCart: CooCart }>(\n `query CooMyCart { cooMyCart { ${CART_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyCart;\n },\n });\n};\n\n/** Every cart mutation answers with the fresh cart, which is written straight into the cache. */\nconst useCartMutation = <TVars>(document: string, field: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables: TVars) => {\n const data = await coolQuery<Record<string, CooCart>>(\n document,\n variables as Record<string, unknown>,\n apiGatewayUrl\n );\n const cart = data[field];\n if (!cart) throw new Error('The cart could not be updated');\n return cart;\n },\n onSuccess: (cart) => {\n queryClient.setQueryData([QK, 'cart'], cart);\n },\n });\n};\n\nexport const useAddToCart = () =>\n useCartMutation<{ input: CooAddToCartInput }>(\n `mutation CooAddToCart($input: CooAddToCartInput!) { cooAddToCart(input: $input) { ${CART_FIELDS} } }`,\n 'cooAddToCart'\n );\n\nexport const useUpdateCartItem = () =>\n useCartMutation<{ id: string; quantity: number }>(\n `mutation CooUpdateCartItem($id: ID!, $quantity: Int!) {\n cooUpdateCartItem(id: $id, quantity: $quantity) { ${CART_FIELDS} }\n }`,\n 'cooUpdateCartItem'\n );\n\nexport const useRemoveCartItem = () =>\n useCartMutation<{ id: string }>(\n `mutation CooRemoveCartItem($id: ID!) { cooRemoveCartItem(id: $id) { ${CART_FIELDS} } }`,\n 'cooRemoveCartItem'\n );\n\n// ---------------------------------------------------------------------------\n// Orders + checkout\n// ---------------------------------------------------------------------------\n\nexport const useMyOrders = (status?: CooOrderStatus) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'orders', status ?? 'ALL'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyOrders: CooOrderConnection }>(\n `query CooMyOrders($status: CooOrderStatus, $pagination: PaginationInput) {\n cooMyOrders(status: $status, pagination: $pagination) {\n items { ${ORDER_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { status, pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyOrders;\n },\n });\n};\n\nexport const useMyOrder = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'order', id],\n enabled: !!id,\n queryFn: async () => {\n const data = await coolQuery<{ cooMyOrder: CooOrder | null }>(\n `query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooMyOrder;\n },\n });\n};\n\nconst useOrderInvalidation = () => {\n const queryClient = useQueryClient();\n return (order: CooOrder) => {\n queryClient.setQueryData([QK, 'order', order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'orders'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'cart'] });\n };\n};\n\nexport const useCheckout = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (input: CooCheckoutInput) => {\n const data = await coolQuery<{ cooCheckout: CooOrderCheckout }>(\n `mutation CooCheckout($input: CooCheckoutInput!) { cooCheckout(input: $input) { ${CHECKOUT_FIELDS} } }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCheckout;\n },\n onSuccess: (checkout) => settle(checkout.order),\n });\n};\n\nexport const useResumeOrderPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooResumeOrderPayment: CooOrderCheckout }>(\n `mutation CooResumeOrderPayment($id: ID!) { cooResumeOrderPayment(id: $id) { ${CHECKOUT_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooResumeOrderPayment;\n },\n onSuccess: (checkout) => settle(checkout.order),\n });\n};\n\nexport const useSyncOrderPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooSyncOrderPayment: CooOrder }>(\n `mutation CooSyncOrderPayment($id: ID!) { cooSyncOrderPayment(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooSyncOrderPayment;\n },\n onSuccess: settle,\n });\n};\n\nexport const useCancelOrder = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooCancelOrder: CooOrder }>(\n `mutation CooCancelOrder($id: ID!) { cooCancelOrder(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCancelOrder;\n },\n onSuccess: settle,\n });\n};\n\n// ---------------------------------------------------------------------------\n// Creator earnings + payouts\n// ---------------------------------------------------------------------------\n\nexport const useMyCreatorEarnings = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'creator-earnings'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCreatorEarnings: CooCreatorEarningConnection }>(\n `query CooMyCreatorEarnings($pagination: PaginationInput) {\n cooMyCreatorEarnings(pagination: $pagination) {\n items {\n id orderId orderNumber lookId collaborationId commissionRate saleAmount amount currency\n availableAt billingSyncStatus createdAt\n }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyCreatorEarnings;\n },\n });\n};\n\nexport const useMyCreatorEarningsSummary = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'creator-earnings-summary'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCreatorEarningsSummary: CooCreatorEarningsSummary }>(\n `query CooMyCreatorEarningsSummary {\n cooMyCreatorEarningsSummary {\n commissionRate holdDays currency totalLifetimeAmount availableAmount pendingAmount\n reservedAmount paidAmount pendingPayoutCount unsyncedCount billingAvailable\n }\n }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyCreatorEarningsSummary;\n },\n });\n};\n\nexport const useRequestCreatorPayout = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: { amount: number; currency: string; notes?: string | null }) => {\n const data = await coolQuery<{ cooRequestCreatorPayout: CooCreatorPayout }>(\n `mutation CooRequestCreatorPayout($input: CooRequestCreatorPayoutInput!) {\n cooRequestCreatorPayout(input: $input) { id status requestedAmount currency createdAt }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooRequestCreatorPayout;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'creator-earnings-summary'] });\n },\n });\n};\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"useCommerceApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCommerceApi.ts"],"sourcesContent":["/**\n * Commerce API hooks (BOFF-3370)\n * @module coolandlovely/hooks\n *\n * React Query layer over the self-scoped commerce fields of `wspace-coolandlovely-svc`:\n * the shopper's cart, checkout and orders, and the creator's look commissions + payouts.\n * The client never decides that an order is paid — it opens the provider's checkout that\n * global-billing prepared and then asks the backend to settle against billing's record.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooAddToCartInput,\n CooCart,\n CooCheckoutInput,\n CooCreatorEarningConnection,\n CooCreatorEarningsSummary,\n CooCreatorPayout,\n CooOrder,\n CooOrderCheckout,\n CooOrderConnection,\n CooOrderStatus,\n} from '../types';\nimport { coolQuery } from './useCoolAndLovelyApi';\n\nconst QK = 'coolandlovely';\n\nconst CART_FIELDS = `\n items {\n id styleItemId quantity size colour lookId unitPrice currency lineTotal isPurchasable\n styleItem { id name status image { id } brand { id name } }\n }\n itemCount subtotal currency canCheckout blockedReason\n`;\n\nconst ORDER_FIELDS = `\n id orderNumber status currency subtotal taxAmount total itemCount\n shippingName shippingAddress buyerNote paymentProvider paidAt cancelledAt createdAt updatedAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n`;\n\n/** Per-brand fulfilment (BOFF-9636): shared by the shopper's order detail and the brand view. */\nexport const FULFILMENT_FIELDS = `\n id orderId brandId brandName status carrier trackingNumber trackingUrl note\n confirmedAt shippedAt deliveredAt updatedAt\n`;\n\nconst ORDER_DETAIL_FIELDS = `\n ${ORDER_FIELDS}\n fulfilmentStatus\n fulfilments { ${FULFILMENT_FIELDS} }\n`;\n\nconst CHECKOUT_FIELDS = `\n order { ${ORDER_FIELDS} }\n provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency\n`;\n\n// ---------------------------------------------------------------------------\n// Cart\n// ---------------------------------------------------------------------------\n\nexport const useMyCart = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'cart'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCart: CooCart }>(\n `query CooMyCart { cooMyCart { ${CART_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyCart;\n },\n });\n};\n\n/** Every cart mutation answers with the fresh cart, which is written straight into the cache. */\nconst useCartMutation = <TVars>(document: string, field: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables: TVars) => {\n const data = await coolQuery<Record<string, CooCart>>(\n document,\n variables as Record<string, unknown>,\n apiGatewayUrl\n );\n const cart = data[field];\n if (!cart) throw new Error('The cart could not be updated');\n return cart;\n },\n onSuccess: (cart) => {\n queryClient.setQueryData([QK, 'cart'], cart);\n },\n });\n};\n\nexport const useAddToCart = () =>\n useCartMutation<{ input: CooAddToCartInput }>(\n `mutation CooAddToCart($input: CooAddToCartInput!) { cooAddToCart(input: $input) { ${CART_FIELDS} } }`,\n 'cooAddToCart'\n );\n\nexport const useUpdateCartItem = () =>\n useCartMutation<{ id: string; quantity: number }>(\n `mutation CooUpdateCartItem($id: ID!, $quantity: Int!) {\n cooUpdateCartItem(id: $id, quantity: $quantity) { ${CART_FIELDS} }\n }`,\n 'cooUpdateCartItem'\n );\n\nexport const useRemoveCartItem = () =>\n useCartMutation<{ id: string }>(\n `mutation CooRemoveCartItem($id: ID!) { cooRemoveCartItem(id: $id) { ${CART_FIELDS} } }`,\n 'cooRemoveCartItem'\n );\n\n// ---------------------------------------------------------------------------\n// Orders + checkout\n// ---------------------------------------------------------------------------\n\nexport const useMyOrders = (status?: CooOrderStatus) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'orders', status ?? 'ALL'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyOrders: CooOrderConnection }>(\n `query CooMyOrders($status: CooOrderStatus, $pagination: PaginationInput) {\n cooMyOrders(status: $status, pagination: $pagination) {\n items { ${ORDER_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { status, pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyOrders;\n },\n });\n};\n\nexport const useMyOrder = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'order', id],\n enabled: !!id,\n queryFn: async () => {\n const data = await coolQuery<{ cooMyOrder: CooOrder | null }>(\n `query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${ORDER_DETAIL_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooMyOrder;\n },\n });\n};\n\nconst useOrderInvalidation = () => {\n const queryClient = useQueryClient();\n return (order: CooOrder) => {\n queryClient.setQueryData([QK, 'order', order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'orders'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'cart'] });\n };\n};\n\nexport const useCheckout = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (input: CooCheckoutInput) => {\n const data = await coolQuery<{ cooCheckout: CooOrderCheckout }>(\n `mutation CooCheckout($input: CooCheckoutInput!) { cooCheckout(input: $input) { ${CHECKOUT_FIELDS} } }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCheckout;\n },\n onSuccess: (checkout) => settle(checkout.order),\n });\n};\n\nexport const useResumeOrderPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooResumeOrderPayment: CooOrderCheckout }>(\n `mutation CooResumeOrderPayment($id: ID!) { cooResumeOrderPayment(id: $id) { ${CHECKOUT_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooResumeOrderPayment;\n },\n onSuccess: (checkout) => settle(checkout.order),\n });\n};\n\nexport const useSyncOrderPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooSyncOrderPayment: CooOrder }>(\n `mutation CooSyncOrderPayment($id: ID!) { cooSyncOrderPayment(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooSyncOrderPayment;\n },\n onSuccess: settle,\n });\n};\n\nexport const useCancelOrder = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooCancelOrder: CooOrder }>(\n `mutation CooCancelOrder($id: ID!) { cooCancelOrder(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCancelOrder;\n },\n onSuccess: settle,\n });\n};\n\n// ---------------------------------------------------------------------------\n// Creator earnings + payouts\n// ---------------------------------------------------------------------------\n\nexport const useMyCreatorEarnings = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'creator-earnings'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCreatorEarnings: CooCreatorEarningConnection }>(\n `query CooMyCreatorEarnings($pagination: PaginationInput) {\n cooMyCreatorEarnings(pagination: $pagination) {\n items {\n id orderId orderNumber lookId collaborationId commissionRate saleAmount amount currency\n availableAt billingSyncStatus createdAt\n }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyCreatorEarnings;\n },\n });\n};\n\nexport const useMyCreatorEarningsSummary = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'creator-earnings-summary'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCreatorEarningsSummary: CooCreatorEarningsSummary }>(\n `query CooMyCreatorEarningsSummary {\n cooMyCreatorEarningsSummary {\n commissionRate holdDays currency totalLifetimeAmount availableAmount pendingAmount\n reservedAmount paidAmount pendingPayoutCount unsyncedCount billingAvailable\n }\n }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyCreatorEarningsSummary;\n },\n });\n};\n\nexport const useRequestCreatorPayout = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: { amount: number; currency: string; notes?: string | null }) => {\n const data = await coolQuery<{ cooRequestCreatorPayout: CooCreatorPayout }>(\n `mutation CooRequestCreatorPayout($input: CooRequestCreatorPayoutInput!) {\n cooRequestCreatorPayout(input: $input) { id status requestedAmount currency createdAt }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooRequestCreatorPayout;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'creator-earnings-summary'] });\n },\n });\n};\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/brands/BrandDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"BrandDetailPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/brands/BrandDetailPage.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyDH,wBAAgB,eAAe,gCAyT9B"}
|
|
@@ -14,12 +14,12 @@ import { Comments as g } from "../../components/Comments.js";
|
|
|
14
14
|
import { ActivityTrail as _ } from "../../components/ActivityTrail.js";
|
|
15
15
|
import { BrandCover as v } from "../../components/BrandCover.js";
|
|
16
16
|
import { StepTracker as y } from "../../components/StepTracker.js";
|
|
17
|
-
import { ArrowLeft as b, ExternalLink as x, Loader2 as S,
|
|
18
|
-
import { useParams as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { GlassCard as
|
|
17
|
+
import { ArrowLeft as b, ExternalLink as x, Loader2 as S, Package as C, Pencil as w, Plus as T, Shapes as E, Shirt as D, Store as O } from "lucide-react";
|
|
18
|
+
import { useParams as k } from "react-router";
|
|
19
|
+
import { Fragment as A, jsx as j, jsxs as M } from "react/jsx-runtime";
|
|
20
|
+
import { GlassCard as N } from "@burdenoff/fe-libs/ui";
|
|
21
21
|
//#region src/coolandlovely/pages/brands/BrandDetailPage.tsx
|
|
22
|
-
var
|
|
22
|
+
var P = {
|
|
23
23
|
DRAFT: ["PENDING_REVIEW", "ARCHIVED"],
|
|
24
24
|
PENDING_REVIEW: [
|
|
25
25
|
"PUBLISHED",
|
|
@@ -29,202 +29,211 @@ var N = {
|
|
|
29
29
|
PUBLISHED: ["SUSPENDED", "ARCHIVED"],
|
|
30
30
|
SUSPENDED: ["PUBLISHED", "ARCHIVED"],
|
|
31
31
|
ARCHIVED: []
|
|
32
|
-
},
|
|
32
|
+
}, F = [
|
|
33
33
|
"DRAFT",
|
|
34
34
|
"PENDING_REVIEW",
|
|
35
35
|
"PUBLISHED"
|
|
36
36
|
];
|
|
37
|
-
function
|
|
37
|
+
function I(e) {
|
|
38
38
|
let t = e instanceof Error ? e.message : "Transition failed";
|
|
39
39
|
return /forbidden|permission|not allowed|unauthori[sz]ed/i.test(t) ? "Your role does not permit this action." : t;
|
|
40
40
|
}
|
|
41
|
-
function
|
|
42
|
-
let { brandId:
|
|
43
|
-
if (o(
|
|
41
|
+
function L() {
|
|
42
|
+
let { brandId: L } = k(), { navigateTo: R } = e(), z = r(L), B = i(), V = a();
|
|
43
|
+
if (o(L, z.data?.name), z.isLoading) return /* @__PURE__ */ j(n, {
|
|
44
44
|
title: "Brand",
|
|
45
|
-
children: /* @__PURE__ */
|
|
45
|
+
children: /* @__PURE__ */ j(l, { label: "Loading brand…" })
|
|
46
46
|
});
|
|
47
|
-
if (
|
|
47
|
+
if (z.isError || !z.data) return /* @__PURE__ */ j(n, {
|
|
48
48
|
title: "Brand",
|
|
49
|
-
children: /* @__PURE__ */
|
|
49
|
+
children: /* @__PURE__ */ j(c, {
|
|
50
50
|
title: "Brand not found",
|
|
51
51
|
message: "This storefront could not be loaded or does not exist.",
|
|
52
|
-
onRetry: () => void
|
|
52
|
+
onRetry: () => void z.refetch()
|
|
53
53
|
})
|
|
54
54
|
});
|
|
55
|
-
let
|
|
56
|
-
return /* @__PURE__ */
|
|
57
|
-
title:
|
|
58
|
-
description: `@${
|
|
59
|
-
children: /* @__PURE__ */
|
|
55
|
+
let H = z.data, U = H.collections ?? [], W = H.items ?? [], G = P[H.status], K = F.includes(H.status) ? F : [...F.slice(0, 1), H.status], q = H.websiteUrl && /^https?:\/\//i.test(H.websiteUrl) ? H.websiteUrl : void 0;
|
|
56
|
+
return /* @__PURE__ */ j(n, {
|
|
57
|
+
title: H.name,
|
|
58
|
+
description: `@${H.handle}`,
|
|
59
|
+
children: /* @__PURE__ */ M("div", {
|
|
60
60
|
className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
|
|
61
|
-
children: [/* @__PURE__ */
|
|
61
|
+
children: [/* @__PURE__ */ M("div", {
|
|
62
62
|
className: "space-y-6 lg:col-span-2",
|
|
63
63
|
children: [
|
|
64
|
-
/* @__PURE__ */
|
|
65
|
-
coverFileId:
|
|
66
|
-
logoFileId:
|
|
67
|
-
name:
|
|
68
|
-
seed:
|
|
64
|
+
/* @__PURE__ */ j(v, {
|
|
65
|
+
coverFileId: H.cover?.id,
|
|
66
|
+
logoFileId: H.logo?.id,
|
|
67
|
+
name: H.name,
|
|
68
|
+
seed: H.id,
|
|
69
69
|
className: "overflow-hidden rounded-xl border border-border-seam shadow-sm",
|
|
70
|
-
overlay: /* @__PURE__ */
|
|
70
|
+
overlay: /* @__PURE__ */ M(A, { children: [/* @__PURE__ */ M("div", {
|
|
71
71
|
className: "absolute right-3 top-3 flex flex-wrap items-center justify-end gap-2",
|
|
72
|
-
children: [
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ M("button", {
|
|
74
|
+
type: "button",
|
|
75
|
+
onClick: () => R("/brands"),
|
|
76
|
+
className: "inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/80 px-3 py-2 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface",
|
|
77
|
+
children: [/* @__PURE__ */ j(b, { className: "h-4 w-4" }), " Back"]
|
|
78
|
+
}),
|
|
79
|
+
/* @__PURE__ */ M("button", {
|
|
80
|
+
type: "button",
|
|
81
|
+
onClick: () => R(`/brand-orders?brand=${H.id}`),
|
|
82
|
+
className: "inline-flex items-center gap-1.5 rounded-lg bg-bg-surface/80 px-3 py-2 text-sm font-medium text-text-primary shadow-sm backdrop-blur transition-colors hover:bg-bg-surface",
|
|
83
|
+
children: [/* @__PURE__ */ j(C, { className: "h-4 w-4" }), " Orders"]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ M("button", {
|
|
86
|
+
type: "button",
|
|
87
|
+
onClick: () => R(`/brands/${H.id}/edit`),
|
|
88
|
+
className: "inline-flex items-center gap-1.5 rounded-lg bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text shadow-sm transition-colors hover:bg-action-primary-bg/90",
|
|
89
|
+
children: [/* @__PURE__ */ j(w, { className: "h-4 w-4" }), " Edit"]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}), /* @__PURE__ */ M("div", {
|
|
84
93
|
className: "absolute inset-x-0 bottom-0 flex items-end gap-3 p-4 sm:gap-4 sm:p-5",
|
|
85
|
-
children: [/* @__PURE__ */
|
|
86
|
-
icon: /* @__PURE__ */
|
|
87
|
-
seed:
|
|
88
|
-
fileId:
|
|
89
|
-
alt: `${
|
|
94
|
+
children: [/* @__PURE__ */ j(u, {
|
|
95
|
+
icon: /* @__PURE__ */ j(O, { className: "h-7 w-7" }),
|
|
96
|
+
seed: H.id,
|
|
97
|
+
fileId: H.logo?.id,
|
|
98
|
+
alt: `${H.name} logo`,
|
|
90
99
|
className: "h-16 w-16 shrink-0 rounded-full shadow-md ring-2 ring-bg-surface"
|
|
91
|
-
}), /* @__PURE__ */
|
|
100
|
+
}), /* @__PURE__ */ M("div", {
|
|
92
101
|
className: "min-w-0 pb-1",
|
|
93
|
-
children: [/* @__PURE__ */
|
|
102
|
+
children: [/* @__PURE__ */ M("div", {
|
|
94
103
|
className: "flex flex-wrap items-center gap-x-2 gap-y-0.5",
|
|
95
|
-
children: [/* @__PURE__ */
|
|
104
|
+
children: [/* @__PURE__ */ j("h2", {
|
|
96
105
|
className: "truncate text-xl font-semibold text-text-primary sm:text-2xl",
|
|
97
|
-
children:
|
|
98
|
-
}), /* @__PURE__ */
|
|
106
|
+
children: H.name
|
|
107
|
+
}), /* @__PURE__ */ M("span", {
|
|
99
108
|
className: "text-sm text-text-secondary",
|
|
100
|
-
children: ["@",
|
|
109
|
+
children: ["@", H.handle]
|
|
101
110
|
})]
|
|
102
|
-
}),
|
|
111
|
+
}), H.tagline && /* @__PURE__ */ j("p", {
|
|
103
112
|
className: "mt-1 line-clamp-2 text-sm text-text-primary",
|
|
104
|
-
children:
|
|
113
|
+
children: H.tagline
|
|
105
114
|
})]
|
|
106
115
|
})]
|
|
107
116
|
})] })
|
|
108
117
|
}),
|
|
109
|
-
/* @__PURE__ */
|
|
118
|
+
/* @__PURE__ */ M("section", {
|
|
110
119
|
className: "space-y-3",
|
|
111
120
|
children: [
|
|
112
|
-
/* @__PURE__ */
|
|
121
|
+
/* @__PURE__ */ M("div", {
|
|
113
122
|
className: "flex flex-wrap items-center justify-between gap-3",
|
|
114
|
-
children: [
|
|
115
|
-
tags:
|
|
123
|
+
children: [H.aesthetics.length > 0 ? /* @__PURE__ */ j(h, {
|
|
124
|
+
tags: H.aesthetics.map(p),
|
|
116
125
|
tone: "accent",
|
|
117
126
|
max: 12
|
|
118
|
-
}) : /* @__PURE__ */
|
|
127
|
+
}) : /* @__PURE__ */ j("span", {}), /* @__PURE__ */ j(s, { status: H.status })]
|
|
119
128
|
}),
|
|
120
|
-
|
|
129
|
+
H.bio && /* @__PURE__ */ j("p", {
|
|
121
130
|
className: "text-sm text-text-secondary",
|
|
122
|
-
children:
|
|
131
|
+
children: H.bio
|
|
123
132
|
}),
|
|
124
|
-
|
|
125
|
-
tags:
|
|
133
|
+
H.tags.length > 0 && /* @__PURE__ */ j(h, {
|
|
134
|
+
tags: H.tags,
|
|
126
135
|
max: 12
|
|
127
136
|
}),
|
|
128
|
-
|
|
129
|
-
href:
|
|
137
|
+
q ? /* @__PURE__ */ M("a", {
|
|
138
|
+
href: q,
|
|
130
139
|
target: "_blank",
|
|
131
140
|
rel: "noopener noreferrer",
|
|
132
141
|
className: "inline-flex max-w-full items-center gap-1.5 text-sm font-medium text-action-primary-bg hover:underline",
|
|
133
142
|
children: [
|
|
134
|
-
/* @__PURE__ */
|
|
143
|
+
/* @__PURE__ */ j(x, { className: "h-4 w-4 shrink-0" }),
|
|
135
144
|
" ",
|
|
136
|
-
/* @__PURE__ */
|
|
145
|
+
/* @__PURE__ */ j("span", {
|
|
137
146
|
className: "break-all",
|
|
138
|
-
children:
|
|
147
|
+
children: q
|
|
139
148
|
})
|
|
140
149
|
]
|
|
141
|
-
}) :
|
|
150
|
+
}) : H.websiteUrl ? /* @__PURE__ */ j("p", {
|
|
142
151
|
className: "break-all text-sm text-text-secondary",
|
|
143
|
-
children:
|
|
152
|
+
children: H.websiteUrl
|
|
144
153
|
}) : null
|
|
145
154
|
]
|
|
146
155
|
}),
|
|
147
|
-
/* @__PURE__ */
|
|
156
|
+
/* @__PURE__ */ M("section", {
|
|
148
157
|
className: "mt-6",
|
|
149
|
-
children: [/* @__PURE__ */
|
|
158
|
+
children: [/* @__PURE__ */ M("div", {
|
|
150
159
|
className: "mb-3 flex items-center justify-between gap-2",
|
|
151
|
-
children: [/* @__PURE__ */
|
|
160
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
152
161
|
className: "flex items-center gap-2 text-lg font-semibold text-text-primary",
|
|
153
162
|
children: [
|
|
154
|
-
/* @__PURE__ */
|
|
163
|
+
/* @__PURE__ */ j(E, { className: "h-5 w-5" }),
|
|
155
164
|
" Collections (",
|
|
156
|
-
|
|
165
|
+
U.length,
|
|
157
166
|
")"
|
|
158
167
|
]
|
|
159
|
-
}), /* @__PURE__ */
|
|
168
|
+
}), /* @__PURE__ */ M("button", {
|
|
160
169
|
type: "button",
|
|
161
|
-
onClick: () =>
|
|
170
|
+
onClick: () => R(`/collections/new?brandId=${H.id}`),
|
|
162
171
|
className: "inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border-seam px-3 py-1.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken",
|
|
163
|
-
children: [/* @__PURE__ */
|
|
172
|
+
children: [/* @__PURE__ */ j(T, { className: "h-4 w-4" }), " Add collection"]
|
|
164
173
|
})]
|
|
165
|
-
}),
|
|
174
|
+
}), U.length === 0 ? /* @__PURE__ */ j("p", {
|
|
166
175
|
className: "rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary",
|
|
167
176
|
children: "No collections yet."
|
|
168
|
-
}) : /* @__PURE__ */
|
|
177
|
+
}) : /* @__PURE__ */ j("div", {
|
|
169
178
|
className: "grid grid-cols-1 gap-3 sm:grid-cols-2",
|
|
170
|
-
children:
|
|
179
|
+
children: U.map((e) => /* @__PURE__ */ M("button", {
|
|
171
180
|
type: "button",
|
|
172
|
-
onClick: () =>
|
|
181
|
+
onClick: () => R(`/collections/${e.id}`),
|
|
173
182
|
className: "flex items-center gap-3 rounded-lg border border-border-seam bg-bg-surface p-3 text-left transition-colors hover:bg-bg-sunken/50",
|
|
174
183
|
children: [
|
|
175
|
-
/* @__PURE__ */
|
|
176
|
-
icon: /* @__PURE__ */
|
|
184
|
+
/* @__PURE__ */ j(u, {
|
|
185
|
+
icon: /* @__PURE__ */ j(E, { className: "h-5 w-5" }),
|
|
177
186
|
seed: e.id,
|
|
178
187
|
fileId: e.cover?.id,
|
|
179
188
|
alt: e.name,
|
|
180
189
|
className: "h-11 w-11 shrink-0"
|
|
181
190
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ M("div", {
|
|
183
192
|
className: "min-w-0 flex-1",
|
|
184
|
-
children: [/* @__PURE__ */
|
|
193
|
+
children: [/* @__PURE__ */ j("p", {
|
|
185
194
|
className: "truncate text-sm font-medium text-text-primary",
|
|
186
195
|
children: e.name
|
|
187
|
-
}), /* @__PURE__ */
|
|
196
|
+
}), /* @__PURE__ */ j("p", {
|
|
188
197
|
className: "text-xs text-text-secondary",
|
|
189
198
|
children: p(e.season)
|
|
190
199
|
})]
|
|
191
200
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
201
|
+
/* @__PURE__ */ j(s, { status: e.status })
|
|
193
202
|
]
|
|
194
203
|
}, e.id))
|
|
195
204
|
})]
|
|
196
205
|
}),
|
|
197
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ M("section", {
|
|
198
207
|
className: "mt-6",
|
|
199
|
-
children: [/* @__PURE__ */
|
|
208
|
+
children: [/* @__PURE__ */ M("h3", {
|
|
200
209
|
className: "mb-3 flex items-center gap-2 text-lg font-semibold text-text-primary",
|
|
201
210
|
children: [
|
|
202
|
-
/* @__PURE__ */
|
|
211
|
+
/* @__PURE__ */ j(D, { className: "h-5 w-5" }),
|
|
203
212
|
" Style items (",
|
|
204
|
-
|
|
213
|
+
W.length,
|
|
205
214
|
")"
|
|
206
215
|
]
|
|
207
|
-
}),
|
|
216
|
+
}), W.length === 0 ? /* @__PURE__ */ j("p", {
|
|
208
217
|
className: "rounded-lg border border-border-seam bg-bg-surface p-4 text-sm text-text-secondary",
|
|
209
218
|
children: "No items yet."
|
|
210
|
-
}) : /* @__PURE__ */
|
|
219
|
+
}) : /* @__PURE__ */ j("div", {
|
|
211
220
|
className: "grid grid-cols-2 gap-3 sm:grid-cols-3",
|
|
212
|
-
children:
|
|
221
|
+
children: W.map((e) => /* @__PURE__ */ M("button", {
|
|
213
222
|
type: "button",
|
|
214
|
-
onClick: () =>
|
|
223
|
+
onClick: () => R(`/items/${e.id}`),
|
|
215
224
|
className: "overflow-hidden rounded-lg border border-border-seam bg-bg-surface text-left transition-all hover:border-accent-foreground/20 hover:shadow-md",
|
|
216
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ j(u, {
|
|
217
226
|
icon: m(e.category, 24),
|
|
218
227
|
seed: e.id,
|
|
219
228
|
fileId: e.image?.id,
|
|
220
229
|
alt: e.name,
|
|
221
230
|
className: "h-24 w-full"
|
|
222
|
-
}), /* @__PURE__ */
|
|
231
|
+
}), /* @__PURE__ */ M("div", {
|
|
223
232
|
className: "p-3",
|
|
224
|
-
children: [/* @__PURE__ */
|
|
233
|
+
children: [/* @__PURE__ */ j("p", {
|
|
225
234
|
className: "truncate text-sm font-medium text-text-primary",
|
|
226
235
|
children: e.name
|
|
227
|
-
}), /* @__PURE__ */
|
|
236
|
+
}), /* @__PURE__ */ j("p", {
|
|
228
237
|
className: "mt-0.5 text-xs text-text-secondary",
|
|
229
238
|
children: f(e.price, e.currency)
|
|
230
239
|
})]
|
|
@@ -233,117 +242,117 @@ function I() {
|
|
|
233
242
|
})]
|
|
234
243
|
})
|
|
235
244
|
]
|
|
236
|
-
}), /* @__PURE__ */
|
|
245
|
+
}), /* @__PURE__ */ M("div", {
|
|
237
246
|
className: "space-y-4",
|
|
238
247
|
children: [
|
|
239
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ M(N, {
|
|
240
249
|
treatment: "insight",
|
|
241
250
|
className: "p-5",
|
|
242
251
|
children: [
|
|
243
|
-
/* @__PURE__ */
|
|
252
|
+
/* @__PURE__ */ j("h3", {
|
|
244
253
|
className: "mb-3 text-sm font-semibold text-text-primary",
|
|
245
254
|
children: "Publish lifecycle"
|
|
246
255
|
}),
|
|
247
|
-
/* @__PURE__ */
|
|
248
|
-
steps:
|
|
249
|
-
current:
|
|
256
|
+
/* @__PURE__ */ j(y, {
|
|
257
|
+
steps: K,
|
|
258
|
+
current: H.status,
|
|
250
259
|
className: "mb-5"
|
|
251
260
|
}),
|
|
252
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ M("div", {
|
|
253
262
|
className: "mb-3 flex items-center gap-2",
|
|
254
|
-
children: [/* @__PURE__ */
|
|
263
|
+
children: [/* @__PURE__ */ j("span", {
|
|
255
264
|
className: "text-sm text-text-secondary",
|
|
256
265
|
children: "Current:"
|
|
257
|
-
}), /* @__PURE__ */
|
|
266
|
+
}), /* @__PURE__ */ j(s, { status: H.status })]
|
|
258
267
|
}),
|
|
259
|
-
|
|
268
|
+
G.length === 0 ? /* @__PURE__ */ j("p", {
|
|
260
269
|
className: "text-xs text-text-secondary",
|
|
261
270
|
children: "This brand is archived (terminal state)."
|
|
262
|
-
}) : /* @__PURE__ */
|
|
271
|
+
}) : /* @__PURE__ */ j("div", {
|
|
263
272
|
className: "flex flex-col gap-2",
|
|
264
|
-
children:
|
|
273
|
+
children: G.map((e) => /* @__PURE__ */ M("button", {
|
|
265
274
|
type: "button",
|
|
266
|
-
disabled:
|
|
267
|
-
onClick: () =>
|
|
268
|
-
id:
|
|
275
|
+
disabled: B.isPending,
|
|
276
|
+
onClick: () => B.mutate({
|
|
277
|
+
id: H.id,
|
|
269
278
|
status: e
|
|
270
279
|
}),
|
|
271
280
|
className: t("inline-flex items-center justify-center gap-2 rounded-lg border border-border-seam px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:opacity-50"),
|
|
272
281
|
children: [
|
|
273
|
-
|
|
282
|
+
B.isPending && /* @__PURE__ */ j(S, { className: "h-3.5 w-3.5 animate-spin" }),
|
|
274
283
|
"Move to ",
|
|
275
284
|
p(e)
|
|
276
285
|
]
|
|
277
286
|
}, e))
|
|
278
287
|
}),
|
|
279
|
-
|
|
288
|
+
B.isError && /* @__PURE__ */ j("p", {
|
|
280
289
|
className: "mt-2 text-xs text-status-error-text",
|
|
281
|
-
children:
|
|
290
|
+
children: I(B.error)
|
|
282
291
|
})
|
|
283
292
|
]
|
|
284
293
|
}),
|
|
285
|
-
/* @__PURE__ */
|
|
294
|
+
/* @__PURE__ */ M(N, {
|
|
286
295
|
treatment: "plain",
|
|
287
296
|
className: "p-5",
|
|
288
|
-
children: [/* @__PURE__ */
|
|
297
|
+
children: [/* @__PURE__ */ j("h3", {
|
|
289
298
|
className: "mb-3 text-sm font-semibold text-text-primary",
|
|
290
299
|
children: "Details"
|
|
291
|
-
}), /* @__PURE__ */
|
|
300
|
+
}), /* @__PURE__ */ M("dl", {
|
|
292
301
|
className: "space-y-2 text-sm",
|
|
293
302
|
children: [
|
|
294
|
-
/* @__PURE__ */
|
|
303
|
+
/* @__PURE__ */ M("div", {
|
|
295
304
|
className: "flex justify-between gap-2",
|
|
296
|
-
children: [/* @__PURE__ */
|
|
305
|
+
children: [/* @__PURE__ */ j("dt", {
|
|
297
306
|
className: "text-text-secondary",
|
|
298
307
|
children: "Handle"
|
|
299
|
-
}), /* @__PURE__ */
|
|
308
|
+
}), /* @__PURE__ */ M("dd", {
|
|
300
309
|
className: "text-text-primary",
|
|
301
|
-
children: ["@",
|
|
310
|
+
children: ["@", H.handle]
|
|
302
311
|
})]
|
|
303
312
|
}),
|
|
304
|
-
/* @__PURE__ */
|
|
313
|
+
/* @__PURE__ */ M("div", {
|
|
305
314
|
className: "flex items-center justify-between gap-2",
|
|
306
|
-
children: [/* @__PURE__ */
|
|
315
|
+
children: [/* @__PURE__ */ j("dt", {
|
|
307
316
|
className: "text-text-secondary",
|
|
308
317
|
children: "Featured"
|
|
309
|
-
}), /* @__PURE__ */
|
|
318
|
+
}), /* @__PURE__ */ M("dd", {
|
|
310
319
|
className: "flex items-center gap-2",
|
|
311
|
-
children: [/* @__PURE__ */
|
|
320
|
+
children: [/* @__PURE__ */ j("button", {
|
|
312
321
|
type: "button",
|
|
313
322
|
role: "switch",
|
|
314
|
-
"aria-checked":
|
|
315
|
-
"aria-label":
|
|
316
|
-
disabled:
|
|
317
|
-
onClick: () =>
|
|
318
|
-
id:
|
|
319
|
-
input: { isFeatured: !
|
|
323
|
+
"aria-checked": H.isFeatured,
|
|
324
|
+
"aria-label": H.isFeatured ? "Unfeature this brand" : "Feature this brand",
|
|
325
|
+
disabled: V.isPending,
|
|
326
|
+
onClick: () => V.mutate({
|
|
327
|
+
id: H.id,
|
|
328
|
+
input: { isFeatured: !H.isFeatured }
|
|
320
329
|
}),
|
|
321
|
-
className: t("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-60",
|
|
322
|
-
children: /* @__PURE__ */
|
|
323
|
-
}),
|
|
330
|
+
className: t("relative inline-flex h-5 w-9 shrink-0 items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-60", H.isFeatured ? "bg-action-primary-bg" : "bg-bg-sunken"),
|
|
331
|
+
children: /* @__PURE__ */ j("span", { className: t("inline-block h-4 w-4 rounded-full bg-bg-surface shadow transition-transform", H.isFeatured ? "translate-x-[1.125rem]" : "translate-x-0.5") })
|
|
332
|
+
}), V.isPending && /* @__PURE__ */ j(S, { className: "h-3.5 w-3.5 animate-spin text-text-secondary" })]
|
|
324
333
|
})]
|
|
325
334
|
}),
|
|
326
|
-
/* @__PURE__ */
|
|
335
|
+
/* @__PURE__ */ M("div", {
|
|
327
336
|
className: "flex justify-between gap-2",
|
|
328
|
-
children: [/* @__PURE__ */
|
|
337
|
+
children: [/* @__PURE__ */ j("dt", {
|
|
329
338
|
className: "text-text-secondary",
|
|
330
339
|
children: "Created"
|
|
331
|
-
}), /* @__PURE__ */
|
|
340
|
+
}), /* @__PURE__ */ j("dd", {
|
|
332
341
|
className: "text-text-primary",
|
|
333
|
-
children: d(
|
|
342
|
+
children: d(H.createdAt, {
|
|
334
343
|
hour: void 0,
|
|
335
344
|
minute: void 0
|
|
336
345
|
})
|
|
337
346
|
})]
|
|
338
347
|
}),
|
|
339
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ M("div", {
|
|
340
349
|
className: "flex justify-between gap-2",
|
|
341
|
-
children: [/* @__PURE__ */
|
|
350
|
+
children: [/* @__PURE__ */ j("dt", {
|
|
342
351
|
className: "text-text-secondary",
|
|
343
352
|
children: "Updated"
|
|
344
|
-
}), /* @__PURE__ */
|
|
353
|
+
}), /* @__PURE__ */ j("dd", {
|
|
345
354
|
className: "text-text-primary",
|
|
346
|
-
children: d(
|
|
355
|
+
children: d(H.updatedAt, {
|
|
347
356
|
hour: void 0,
|
|
348
357
|
minute: void 0
|
|
349
358
|
})
|
|
@@ -352,13 +361,13 @@ function I() {
|
|
|
352
361
|
]
|
|
353
362
|
})]
|
|
354
363
|
}),
|
|
355
|
-
/* @__PURE__ */
|
|
364
|
+
/* @__PURE__ */ j(_, {
|
|
356
365
|
resourceType: "coolandlovely-brand",
|
|
357
|
-
resourceId:
|
|
366
|
+
resourceId: H.id
|
|
358
367
|
}),
|
|
359
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ j(g, {
|
|
360
369
|
entityType: "CooBrand",
|
|
361
|
-
entityId:
|
|
370
|
+
entityId: H.id,
|
|
362
371
|
className: "mt-0"
|
|
363
372
|
})
|
|
364
373
|
]
|
|
@@ -367,6 +376,6 @@ function I() {
|
|
|
367
376
|
});
|
|
368
377
|
}
|
|
369
378
|
//#endregion
|
|
370
|
-
export {
|
|
379
|
+
export { L as BrandDetailPage };
|
|
371
380
|
|
|
372
381
|
//# sourceMappingURL=BrandDetailPage.js.map
|