@burdenoff/microfe-coolandlovely 2026.1028.1 → 2026.1028.2
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/components/ReturnRequests.d.ts +15 -0
- package/dist/coolandlovely/components/ReturnRequests.d.ts.map +1 -0
- package/dist/coolandlovely/components/ReturnRequests.js +218 -0
- package/dist/coolandlovely/components/ReturnRequests.js.map +1 -0
- package/dist/coolandlovely/components/StatusBadge.d.ts.map +1 -1
- package/dist/coolandlovely/components/StatusBadge.js +5 -1
- package/dist/coolandlovely/components/StatusBadge.js.map +1 -1
- package/dist/coolandlovely/hooks/useBrandOrdersApi.d.ts +10 -1
- package/dist/coolandlovely/hooks/useBrandOrdersApi.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useBrandOrdersApi.js +99 -30
- package/dist/coolandlovely/hooks/useBrandOrdersApi.js.map +1 -1
- package/dist/coolandlovely/hooks/useCommerceApi.d.ts +8 -1
- package/dist/coolandlovely/hooks/useCommerceApi.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useCommerceApi.js +47 -31
- package/dist/coolandlovely/hooks/useCommerceApi.js.map +1 -1
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.d.ts +3 -1
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js +129 -97
- package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js.map +1 -1
- package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts +2 -1
- package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/commerce/OrdersPage.js +124 -122
- package/dist/coolandlovely/pages/commerce/OrdersPage.js.map +1 -1
- package/dist/coolandlovely/types/commerce.d.ts +45 -0
- package/dist/coolandlovely/types/commerce.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useBrandOrdersApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useBrandOrdersApi.ts"],"sourcesContent":["/**\n * Brand order hooks (BOFF-9636)\n * @module coolandlovely/hooks\n *\n * React Query layer over the brand-side order fields of `wspace-coolandlovely-svc`: the paid\n * orders that contain a brand's pieces (only that brand's lines), counts per fulfilment state,\n * and the fulfilment mutation (confirm, ship with tracking, mark delivered).\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooBrandOrder,\n CooBrandOrderConnection,\n CooBrandOrderSummary,\n CooFulfilmentStatus,\n CooRefundBrandOrderInput,\n CooUpdateOrderFulfilmentInput,\n} from '../types';\nimport { FULFILMENT_FIELDS, REFUND_FIELDS } from './useCommerceApi';\nimport { coolQuery } from './useCoolAndLovelyApi';\n\nconst QK = 'coolandlovely';\n\nconst BRAND_ORDER_FIELDS = `\n id orderNumber status brandId currency brandSubtotal itemCount\n shippingName shippingAddress buyerNote paidAt createdAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n fulfilment { ${FULFILMENT_FIELDS} }\n refund { ${REFUND_FIELDS} }\n`;\n\nexport const useBrandOrders = (\n brandId: string | undefined,\n fulfilmentStatus?: CooFulfilmentStatus\n) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-orders', brandId, fulfilmentStatus ?? 'ALL'],\n enabled: !!brandId,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandOrders: CooBrandOrderConnection }>(\n `query CooBrandOrders($brandId: ID!, $fulfilmentStatus: CooFulfilmentStatus, $pagination: PaginationInput) {\n cooBrandOrders(brandId: $brandId, fulfilmentStatus: $fulfilmentStatus, pagination: $pagination) {\n items { ${BRAND_ORDER_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { brandId, fulfilmentStatus, pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooBrandOrders;\n },\n });\n};\n\nexport const useBrandOrderSummary = (brandId: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-order-summary', brandId],\n enabled: !!brandId,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandOrderSummary: CooBrandOrderSummary }>(\n `query CooBrandOrderSummary($brandId: ID!) {\n cooBrandOrderSummary(brandId: $brandId) {\n brandId unfulfilled confirmed shipped delivered refunded total\n }\n }`,\n { brandId },\n apiGatewayUrl\n );\n return data.cooBrandOrderSummary;\n },\n });\n};\n\nexport const useBrandOrder = (brandId: string | undefined, id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-order', brandId, id],\n enabled: !!brandId && !!id,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandOrder: CooBrandOrder | null }>(\n `query CooBrandOrder($brandId: ID!, $id: ID!) { cooBrandOrder(brandId: $brandId, id: $id) { ${BRAND_ORDER_FIELDS} } }`,\n { brandId, id },\n apiGatewayUrl\n );\n return data.cooBrandOrder;\n },\n });\n};\n\nexport const useUpdateOrderFulfilment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CooUpdateOrderFulfilmentInput) => {\n const data = await coolQuery<{ cooUpdateOrderFulfilment: CooBrandOrder }>(\n `mutation CooUpdateOrderFulfilment($input: CooUpdateOrderFulfilmentInput!) {\n cooUpdateOrderFulfilment(input: $input) { ${BRAND_ORDER_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooUpdateOrderFulfilment;\n },\n onSuccess: (order) => {\n queryClient.setQueryData([QK, 'brand-order', order.brandId, order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-orders', order.brandId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-order-summary', order.brandId] });\n },\n });\n};\n\n/**\n * Refund the brand's pieces of an order (BOFF-9702). global-billing returns the money to the\n * shopper, and the creator commissions on the refunded lines are reversed.\n */\nexport const useRefundBrandOrder = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CooRefundBrandOrderInput) => {\n const data = await coolQuery<{ cooRefundBrandOrder: CooBrandOrder }>(\n `mutation CooRefundBrandOrder($input: CooRefundBrandOrderInput!) {\n cooRefundBrandOrder(input: $input) { ${BRAND_ORDER_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooRefundBrandOrder;\n },\n onSuccess: (order) => {\n queryClient.setQueryData([QK, 'brand-order', order.brandId, order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-orders', order.brandId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-order-summary', order.brandId] });\n },\n // A failed refund is recorded on the order; refetch so the page shows why.\n onError: (_error, input) => {\n void queryClient.invalidateQueries({\n queryKey: [QK, 'brand-order', input.brandId, input.orderId],\n });\n },\n });\n};\n"],"mappings":";;;;;;AAuBA,IAAM,IAAK,iBAEL,IAAqB;;;;;;;iBAOV,EAAkB;aACtB,EAAc;GAGd,KACX,GACA,MACG;CACH,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAgB;GAAS,KAAoB;GAAM;EAClE,SAAS,CAAC,CAAC;EACX,SAAS,aACM,MAAM,EACjB;;sBAEc,EAAmB;;;YAIjC;GAAE;GAAS;GAAkB,YAAY;IAAE,OAAO;IAAI,QAAQ;IAAG;GAAE,EACnE,EACD,EACW;EAEf,CAAC;GAGS,KAAwB,MAAgC;CACnE,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAuB;GAAQ;EAC9C,SAAS,CAAC,CAAC;EACX,SAAS,aACM,MAAM,EACjB,wMAKA,EAAE,YAAS,EACX,EACD,EACW;EAEf,CAAC;GAGS,KA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AC"}
|
|
1
|
+
{"version":3,"file":"useBrandOrdersApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useBrandOrdersApi.ts"],"sourcesContent":["/**\n * Brand order hooks (BOFF-9636)\n * @module coolandlovely/hooks\n *\n * React Query layer over the brand-side order fields of `wspace-coolandlovely-svc`: the paid\n * orders that contain a brand's pieces (only that brand's lines), counts per fulfilment state,\n * and the fulfilment mutation (confirm, ship with tracking, mark delivered). Also the brand's\n * refunds (BOFF-9702) and the shopper return requests it approves or declines (BOFF-9900).\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooApproveReturnRequestInput,\n CooBrandOrder,\n CooBrandOrderConnection,\n CooBrandOrderSummary,\n CooDeclineReturnRequestInput,\n CooFulfilmentStatus,\n CooRefundBrandOrderInput,\n CooReturnRequestConnection,\n CooReturnRequestStatus,\n CooUpdateOrderFulfilmentInput,\n} from '../types';\nimport { FULFILMENT_FIELDS, REFUND_FIELDS, RETURN_REQUEST_FIELDS } from './useCommerceApi';\nimport { coolQuery } from './useCoolAndLovelyApi';\n\nconst QK = 'coolandlovely';\n\nconst BRAND_ORDER_FIELDS = `\n id orderNumber status brandId currency brandSubtotal itemCount\n shippingName shippingAddress buyerNote paidAt createdAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n fulfilment { ${FULFILMENT_FIELDS} }\n refund { ${REFUND_FIELDS} }\n returnRequest { ${RETURN_REQUEST_FIELDS} }\n`;\n\nexport const useBrandOrders = (\n brandId: string | undefined,\n fulfilmentStatus?: CooFulfilmentStatus\n) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-orders', brandId, fulfilmentStatus ?? 'ALL'],\n enabled: !!brandId,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandOrders: CooBrandOrderConnection }>(\n `query CooBrandOrders($brandId: ID!, $fulfilmentStatus: CooFulfilmentStatus, $pagination: PaginationInput) {\n cooBrandOrders(brandId: $brandId, fulfilmentStatus: $fulfilmentStatus, pagination: $pagination) {\n items { ${BRAND_ORDER_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { brandId, fulfilmentStatus, pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooBrandOrders;\n },\n });\n};\n\nexport const useBrandOrderSummary = (brandId: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-order-summary', brandId],\n enabled: !!brandId,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandOrderSummary: CooBrandOrderSummary }>(\n `query CooBrandOrderSummary($brandId: ID!) {\n cooBrandOrderSummary(brandId: $brandId) {\n brandId unfulfilled confirmed shipped delivered refunded total\n }\n }`,\n { brandId },\n apiGatewayUrl\n );\n return data.cooBrandOrderSummary;\n },\n });\n};\n\nexport const useBrandOrder = (brandId: string | undefined, id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-order', brandId, id],\n enabled: !!brandId && !!id,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandOrder: CooBrandOrder | null }>(\n `query CooBrandOrder($brandId: ID!, $id: ID!) { cooBrandOrder(brandId: $brandId, id: $id) { ${BRAND_ORDER_FIELDS} } }`,\n { brandId, id },\n apiGatewayUrl\n );\n return data.cooBrandOrder;\n },\n });\n};\n\nexport const useUpdateOrderFulfilment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CooUpdateOrderFulfilmentInput) => {\n const data = await coolQuery<{ cooUpdateOrderFulfilment: CooBrandOrder }>(\n `mutation CooUpdateOrderFulfilment($input: CooUpdateOrderFulfilmentInput!) {\n cooUpdateOrderFulfilment(input: $input) { ${BRAND_ORDER_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooUpdateOrderFulfilment;\n },\n onSuccess: (order) => {\n queryClient.setQueryData([QK, 'brand-order', order.brandId, order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-orders', order.brandId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-order-summary', order.brandId] });\n },\n });\n};\n\n/**\n * Refund the brand's pieces of an order (BOFF-9702). global-billing returns the money to the\n * shopper, and the creator commissions on the refunded lines are reversed.\n */\nexport const useRefundBrandOrder = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CooRefundBrandOrderInput) => {\n const data = await coolQuery<{ cooRefundBrandOrder: CooBrandOrder }>(\n `mutation CooRefundBrandOrder($input: CooRefundBrandOrderInput!) {\n cooRefundBrandOrder(input: $input) { ${BRAND_ORDER_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooRefundBrandOrder;\n },\n onSuccess: (order) => {\n queryClient.setQueryData([QK, 'brand-order', order.brandId, order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-orders', order.brandId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-order-summary', order.brandId] });\n },\n // A failed refund is recorded on the order; refetch so the page shows why.\n onError: (_error, input) => {\n void queryClient.invalidateQueries({\n queryKey: [QK, 'brand-order', input.brandId, input.orderId],\n });\n },\n });\n};\n\n/** The brand's return requests, newest first, optionally by status (BOFF-9900). */\nexport const useBrandReturnRequests = (\n brandId: string | undefined,\n status?: CooReturnRequestStatus\n) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'brand-return-requests', brandId, status ?? 'ALL'],\n enabled: !!brandId,\n queryFn: async () => {\n const data = await coolQuery<{ cooBrandReturnRequests: CooReturnRequestConnection }>(\n `query CooBrandReturnRequests($brandId: ID!, $status: CooReturnRequestStatus, $pagination: PaginationInput) {\n cooBrandReturnRequests(brandId: $brandId, status: $status, pagination: $pagination) {\n items { ${RETURN_REQUEST_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { brandId, status, pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooBrandReturnRequests;\n },\n });\n};\n\nconst useReturnDecisionSettled = () => {\n const queryClient = useQueryClient();\n return (brandId: string, orderId: string, order?: CooBrandOrder) => {\n if (order) queryClient.setQueryData([QK, 'brand-order', brandId, orderId], order);\n else void queryClient.invalidateQueries({ queryKey: [QK, 'brand-order', brandId, orderId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-orders', brandId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-order-summary', brandId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'brand-return-requests', brandId] });\n };\n};\n\n/**\n * Approve a shopper's return (BOFF-9900): refunds the brand's pieces through the brand refund and\n * marks the request approved. On an error the order is refetched so a failed refund shows why.\n */\nexport const useApproveReturnRequest = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useReturnDecisionSettled();\n return useMutation({\n mutationFn: async (input: CooApproveReturnRequestInput) => {\n const data = await coolQuery<{ cooApproveReturnRequest: CooBrandOrder }>(\n `mutation CooApproveReturnRequest($input: CooApproveReturnRequestInput!) {\n cooApproveReturnRequest(input: $input) { ${BRAND_ORDER_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooApproveReturnRequest;\n },\n onSuccess: (order, input) => settle(input.brandId, input.orderId, order),\n onError: (_error, input) => settle(input.brandId, input.orderId),\n });\n};\n\n/** Decline a shopper's return with a note the shopper sees (BOFF-9900). */\nexport const useDeclineReturnRequest = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useReturnDecisionSettled();\n return useMutation({\n mutationFn: async (input: CooDeclineReturnRequestInput) => {\n const data = await coolQuery<{ cooDeclineReturnRequest: CooBrandOrder }>(\n `mutation CooDeclineReturnRequest($input: CooDeclineReturnRequestInput!) {\n cooDeclineReturnRequest(input: $input) { ${BRAND_ORDER_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooDeclineReturnRequest;\n },\n onSuccess: (order, input) => settle(input.brandId, input.orderId, order),\n });\n};\n"],"mappings":";;;;;;AA4BA,IAAM,IAAK,iBAEL,IAAqB;;;;;;;iBAOV,EAAkB;aACtB,EAAc;oBACP,EAAsB;GAG7B,KACX,GACA,MACG;CACH,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAgB;GAAS,KAAoB;GAAM;EAClE,SAAS,CAAC,CAAC;EACX,SAAS,aACM,MAAM,EACjB;;sBAEc,EAAmB;;;YAIjC;GAAE;GAAS;GAAkB,YAAY;IAAE,OAAO;IAAI,QAAQ;IAAG;GAAE,EACnE,EACD,EACW;EAEf,CAAC;GAGS,KAAwB,MAAgC;CACnE,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAuB;GAAQ;EAC9C,SAAS,CAAC,CAAC;EACX,SAAS,aACM,MAAM,EACjB,wMAKA,EAAE,YAAS,EACX,EACD,EACW;EAEf,CAAC;GAGS,KAAiB,GAA6B,MAA2B;CACpF,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAe;GAAS;GAAG;EAC1C,SAAS,CAAC,CAAC,KAAW,CAAC,CAAC;EACxB,SAAS,aACM,MAAM,EACjB,8FAA8F,EAAmB,OACjH;GAAE;GAAS;GAAI,EACf,EACD,EACW;EAEf,CAAC;GAGS,UAAiC;CAC5C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAc,GAAgB;AACpC,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;sDAC8C,EAAmB;YAEjE,EAAE,UAAO,EACT,EACD,EACW;EAEd,YAAY,MAAU;AAGf,GAFL,EAAY,aAAa;IAAC;IAAI;IAAe,EAAM;IAAS,EAAM;IAAG,EAAE,EAAM,EACxE,EAAY,kBAAk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AAE,UAAU;GAAC;GAAI;GAAgB;GAAQ,EAAE,CAAC,EAC1E,EAAY,kBAAkB,EAAE,UAAU;GAAC;GAAI;GAAuB;GAAQ,EAAE,CAAC,EACjF,EAAY,kBAAkB,EAAE,UAAU;GAAC;GAAI;GAAyB;GAAQ,EAAE,CAAC;;GAQ/E,UAAgC;CAC3C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAS,GAA0B;AACzC,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;qDAC6C,EAAmB;YAEhE,EAAE,UAAO,EACT,EACD,EACW;EAEd,YAAY,GAAO,MAAU,EAAO,EAAM,SAAS,EAAM,SAAS,EAAM;EACxE,UAAU,GAAQ,MAAU,EAAO,EAAM,SAAS,EAAM,QAAQ;EACjE,CAAC;GAIS,UAAgC;CAC3C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAS,GAA0B;AACzC,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;qDAC6C,EAAmB;YAEhE,EAAE,UAAO,EACT,EACD,EACW;EAEd,YAAY,GAAO,MAAU,EAAO,EAAM,SAAS,EAAM,SAAS,EAAM;EACzE,CAAC"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { CooAddToCartInput, CooCart, CooCheckoutInput, CooCollaborationPaymentCheckout, CooCollaborationPayout, CooCollaborationPayoutConnection, CooCreatorEarningConnection, CooCreatorEarningsSummary, CooCreatorPayout, CooOrder, CooOrderCheckout, CooOrderConnection, CooOrderStatus } from '../types';
|
|
1
|
+
import { CooAddToCartInput, CooCart, CooCheckoutInput, CooCollaborationPaymentCheckout, CooCollaborationPayout, CooCollaborationPayoutConnection, CooCreatorEarningConnection, CooCreatorEarningsSummary, CooCreatorPayout, CooOrder, CooOrderCheckout, CooOrderConnection, CooOrderStatus, CooRequestReturnInput, CooReturnRequest } from '../types';
|
|
2
2
|
|
|
3
3
|
/** Per-brand fulfilment (BOFF-9636): shared by the shopper's order detail and the brand view. */
|
|
4
4
|
export declare const FULFILMENT_FIELDS = "\n id orderId brandId brandName status refunded carrier trackingNumber trackingUrl note\n confirmedAt shippedAt deliveredAt updatedAt\n";
|
|
5
5
|
/** A brand's refund of its pieces (BOFF-9702): the shopper's order detail and the brand view. */
|
|
6
6
|
export declare const REFUND_FIELDS = "\n id orderId brandId brandName amount currency reason status failureReason refundedAt createdAt\n";
|
|
7
|
+
/** A shopper's return request (BOFF-9900): the shopper's order detail and the brand view. */
|
|
8
|
+
export declare const RETURN_REQUEST_FIELDS = "\n id orderId orderNumber brandId brandName reason status decisionNote decidedAt refundId\n createdAt updatedAt\n";
|
|
7
9
|
export declare const useMyCart: () => import('@tanstack/react-query').UseQueryResult<NoInfer<CooCart>, Error>;
|
|
8
10
|
export declare const useAddToCart: () => import('@tanstack/react-query').UseMutationResult<CooCart, Error, {
|
|
9
11
|
input: CooAddToCartInput;
|
|
@@ -21,6 +23,11 @@ export declare const useCheckout: () => import('@tanstack/react-query').UseMutat
|
|
|
21
23
|
export declare const useResumeOrderPayment: () => import('@tanstack/react-query').UseMutationResult<CooOrderCheckout, Error, string, unknown>;
|
|
22
24
|
export declare const useSyncOrderPayment: () => import('@tanstack/react-query').UseMutationResult<CooOrder, Error, string, unknown>;
|
|
23
25
|
export declare const useCancelOrder: () => import('@tanstack/react-query').UseMutationResult<CooOrder, Error, string, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Ask a brand to take back its pieces of one of the caller's paid orders (BOFF-9900). The brand
|
|
28
|
+
* approves (which refunds them) or declines; the order detail is refetched to show the request.
|
|
29
|
+
*/
|
|
30
|
+
export declare const useRequestReturn: () => import('@tanstack/react-query').UseMutationResult<CooReturnRequest, Error, CooRequestReturnInput, unknown>;
|
|
24
31
|
export declare const useMyCreatorEarnings: () => import('@tanstack/react-query').UseQueryResult<NoInfer<CooCreatorEarningConnection>, Error>;
|
|
25
32
|
export declare const useMyCreatorEarningsSummary: () => import('@tanstack/react-query').UseQueryResult<NoInfer<CooCreatorEarningsSummary>, Error>;
|
|
26
33
|
export declare const useRequestCreatorPayout: () => import('@tanstack/react-query').UseMutationResult<CooCreatorPayout, Error, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCommerceApi.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCommerceApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EACV,iBAAiB,EACjB,OAAO,EACP,gBAAgB,EAChB,+BAA+B,EAC/B,sBAAsB,EACtB,gCAAgC,EAChC,2BAA2B,EAC3B,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,
|
|
1
|
+
{"version":3,"file":"useCommerceApi.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCommerceApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,KAAK,EACV,iBAAiB,EACjB,OAAO,EACP,gBAAgB,EAChB,+BAA+B,EAC/B,sBAAsB,EACtB,gCAAgC,EAChC,2BAA2B,EAC3B,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAwBlB,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,8IAG7B,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,aAAa,wGAEzB,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,qBAAqB,wHAGjC,CAAC;AAoBF,eAAO,MAAM,SAAS,+EAarB,CAAC;AAuBF,eAAO,MAAM,YAAY;WACE,iBAAiB;WAGzC,CAAC;AAEJ,eAAO,MAAM,iBAAiB;QACN,MAAM;cAAY,MAAM;WAK7C,CAAC;AAEJ,eAAO,MAAM,iBAAiB;QACN,MAAM;WAG3B,CAAC;AAMJ,eAAO,MAAM,WAAW,GAAI,SAAS,cAAc,uFAkBlD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,IAAI,MAAM,GAAG,SAAS,oFAchD,CAAC;AAWF,eAAO,MAAM,WAAW,6GAcvB,CAAC;AAEF,eAAO,MAAM,qBAAqB,mGAcjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,2FAc/B,CAAC;AAEF,eAAO,MAAM,cAAc,2FAc1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,kHAkB5B,CAAC;AAMF,eAAO,MAAM,oBAAoB,mGAqBhC,CAAC;AAEF,eAAO,MAAM,2BAA2B,iGAkBvC,CAAC;AAEF,eAAO,MAAM,uBAAuB;YAII,MAAM;cAAY,MAAM;YAAU,MAAM,GAAG,IAAI;WActF,CAAC;AAWF,uFAAuF;AACvF,eAAO,MAAM,yBAAyB,wGAkBrC,CAAC;AAWF,2EAA2E;AAC3E,eAAO,MAAM,sBAAsB,kHAgBlC,CAAC;AAEF,6FAA6F;AAC7F,eAAO,MAAM,2BAA2B,yGAgBvC,CAAC"}
|
|
@@ -3,21 +3,23 @@ import "../context/index.js";
|
|
|
3
3
|
import { COLLABORATION_PAYOUT_FIELDS as t, coolQuery as n } from "./useCoolAndLovelyApi.js";
|
|
4
4
|
import { useMutation as r, useQuery as i, useQueryClient as a } from "@tanstack/react-query";
|
|
5
5
|
//#region src/coolandlovely/hooks/useCommerceApi.ts
|
|
6
|
-
var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colour lookId unitPrice currency lineTotal isPurchasable\n availableQuantity\n styleItem { id name status image { id } brand { id name } }\n }\n itemCount subtotal currency canCheckout blockedReason\n", c = "\n id orderNumber status currency subtotal taxAmount total itemCount\n shippingName shippingAddress buyerNote paymentProvider paidAt cancelledAt refundedAmount refundedAt\n createdAt updatedAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n", l = "\n id orderId brandId brandName status refunded carrier trackingNumber trackingUrl note\n confirmedAt shippedAt deliveredAt updatedAt\n", u = "\n id orderId brandId brandName amount currency reason status failureReason refundedAt createdAt\n", d = `
|
|
6
|
+
var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colour lookId unitPrice currency lineTotal isPurchasable\n availableQuantity\n styleItem { id name status image { id } brand { id name } }\n }\n itemCount subtotal currency canCheckout blockedReason\n", c = "\n id orderNumber status currency subtotal taxAmount total itemCount\n shippingName shippingAddress buyerNote paymentProvider paidAt cancelledAt refundedAmount refundedAt\n createdAt updatedAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n", l = "\n id orderId brandId brandName status refunded carrier trackingNumber trackingUrl note\n confirmedAt shippedAt deliveredAt updatedAt\n", u = "\n id orderId brandId brandName amount currency reason status failureReason refundedAt createdAt\n", d = "\n id orderId orderNumber brandId brandName reason status decisionNote decidedAt refundId\n createdAt updatedAt\n", f = `
|
|
7
7
|
${c}
|
|
8
8
|
fulfilmentStatus
|
|
9
9
|
fulfilments { ${l} }
|
|
10
10
|
refunds { ${u} }
|
|
11
|
-
|
|
11
|
+
returnRequests { ${d} }
|
|
12
|
+
returnWindowEndsAt
|
|
13
|
+
`, p = `
|
|
12
14
|
order { ${c} }
|
|
13
15
|
provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency
|
|
14
|
-
`,
|
|
16
|
+
`, m = () => {
|
|
15
17
|
let { apiGatewayUrl: t } = e();
|
|
16
18
|
return i({
|
|
17
19
|
queryKey: [o, "cart"],
|
|
18
20
|
queryFn: async () => (await n(`query CooMyCart { cooMyCart { ${s} } }`, {}, t)).cooMyCart
|
|
19
21
|
});
|
|
20
|
-
},
|
|
22
|
+
}, h = (t, i) => {
|
|
21
23
|
let { apiGatewayUrl: s } = e(), c = a();
|
|
22
24
|
return r({
|
|
23
25
|
mutationFn: async (e) => {
|
|
@@ -29,9 +31,9 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
29
31
|
c.setQueryData([o, "cart"], e);
|
|
30
32
|
}
|
|
31
33
|
});
|
|
32
|
-
},
|
|
34
|
+
}, g = () => h(`mutation CooAddToCart($input: CooAddToCartInput!) { cooAddToCart(input: $input) { ${s} } }`, "cooAddToCart"), _ = () => h(`mutation CooUpdateCartItem($id: ID!, $quantity: Int!) {
|
|
33
35
|
cooUpdateCartItem(id: $id, quantity: $quantity) { ${s} }
|
|
34
|
-
}`, "cooUpdateCartItem"),
|
|
36
|
+
}`, "cooUpdateCartItem"), v = () => h(`mutation CooRemoveCartItem($id: ID!) { cooRemoveCartItem(id: $id) { ${s} } }`, "cooRemoveCartItem"), y = (t) => {
|
|
35
37
|
let { apiGatewayUrl: r } = e();
|
|
36
38
|
return i({
|
|
37
39
|
queryKey: [
|
|
@@ -52,7 +54,7 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
52
54
|
}
|
|
53
55
|
}, r)).cooMyOrders
|
|
54
56
|
});
|
|
55
|
-
},
|
|
57
|
+
}, b = (t) => {
|
|
56
58
|
let { apiGatewayUrl: r } = e();
|
|
57
59
|
return i({
|
|
58
60
|
queryKey: [
|
|
@@ -61,9 +63,9 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
61
63
|
t
|
|
62
64
|
],
|
|
63
65
|
enabled: !!t,
|
|
64
|
-
queryFn: async () => (await n(`query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${
|
|
66
|
+
queryFn: async () => (await n(`query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${f} } }`, { id: t }, r)).cooMyOrder
|
|
65
67
|
});
|
|
66
|
-
},
|
|
68
|
+
}, x = () => {
|
|
67
69
|
let e = a();
|
|
68
70
|
return (t) => {
|
|
69
71
|
e.setQueryData([
|
|
@@ -72,31 +74,45 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
72
74
|
t.id
|
|
73
75
|
], t), e.invalidateQueries({ queryKey: [o, "orders"] }), e.invalidateQueries({ queryKey: [o, "cart"] });
|
|
74
76
|
};
|
|
75
|
-
},
|
|
76
|
-
let { apiGatewayUrl: t } = e(), i =
|
|
77
|
+
}, S = () => {
|
|
78
|
+
let { apiGatewayUrl: t } = e(), i = x();
|
|
77
79
|
return r({
|
|
78
|
-
mutationFn: async (e) => (await n(`mutation CooCheckout($input: CooCheckoutInput!) { cooCheckout(input: $input) { ${
|
|
80
|
+
mutationFn: async (e) => (await n(`mutation CooCheckout($input: CooCheckoutInput!) { cooCheckout(input: $input) { ${p} } }`, { input: e }, t)).cooCheckout,
|
|
79
81
|
onSuccess: (e) => i(e.order)
|
|
80
82
|
});
|
|
81
|
-
},
|
|
82
|
-
let { apiGatewayUrl: t } = e(), i =
|
|
83
|
+
}, C = () => {
|
|
84
|
+
let { apiGatewayUrl: t } = e(), i = x();
|
|
83
85
|
return r({
|
|
84
|
-
mutationFn: async (e) => (await n(`mutation CooResumeOrderPayment($id: ID!) { cooResumeOrderPayment(id: $id) { ${
|
|
86
|
+
mutationFn: async (e) => (await n(`mutation CooResumeOrderPayment($id: ID!) { cooResumeOrderPayment(id: $id) { ${p} } }`, { id: e }, t)).cooResumeOrderPayment,
|
|
85
87
|
onSuccess: (e) => i(e.order)
|
|
86
88
|
});
|
|
87
|
-
},
|
|
89
|
+
}, w = () => {
|
|
88
90
|
let { apiGatewayUrl: t } = e();
|
|
89
91
|
return r({
|
|
90
92
|
mutationFn: async (e) => (await n(`mutation CooSyncOrderPayment($id: ID!) { cooSyncOrderPayment(id: $id) { ${c} } }`, { id: e }, t)).cooSyncOrderPayment,
|
|
91
|
-
onSuccess:
|
|
93
|
+
onSuccess: x()
|
|
92
94
|
});
|
|
93
|
-
},
|
|
95
|
+
}, T = () => {
|
|
94
96
|
let { apiGatewayUrl: t } = e();
|
|
95
97
|
return r({
|
|
96
98
|
mutationFn: async (e) => (await n(`mutation CooCancelOrder($id: ID!) { cooCancelOrder(id: $id) { ${c} } }`, { id: e }, t)).cooCancelOrder,
|
|
97
|
-
onSuccess:
|
|
99
|
+
onSuccess: x()
|
|
98
100
|
});
|
|
99
|
-
},
|
|
101
|
+
}, E = () => {
|
|
102
|
+
let { apiGatewayUrl: t } = e(), i = a();
|
|
103
|
+
return r({
|
|
104
|
+
mutationFn: async (e) => (await n(`mutation CooRequestReturn($input: CooRequestReturnInput!) {
|
|
105
|
+
cooRequestReturn(input: $input) { ${d} }
|
|
106
|
+
}`, { input: e }, t)).cooRequestReturn,
|
|
107
|
+
onSettled: (e, t, n) => {
|
|
108
|
+
i.invalidateQueries({ queryKey: [
|
|
109
|
+
o,
|
|
110
|
+
"order",
|
|
111
|
+
n.orderId
|
|
112
|
+
] });
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
}, D = () => {
|
|
100
116
|
let { apiGatewayUrl: t } = e();
|
|
101
117
|
return i({
|
|
102
118
|
queryKey: [o, "creator-earnings"],
|
|
@@ -105,13 +121,13 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
105
121
|
offset: 0
|
|
106
122
|
} }, t)).cooMyCreatorEarnings
|
|
107
123
|
});
|
|
108
|
-
},
|
|
124
|
+
}, O = () => {
|
|
109
125
|
let { apiGatewayUrl: t } = e();
|
|
110
126
|
return i({
|
|
111
127
|
queryKey: [o, "creator-earnings-summary"],
|
|
112
128
|
queryFn: async () => (await n("query CooMyCreatorEarningsSummary {\n cooMyCreatorEarningsSummary {\n commissionRate holdDays currency totalLifetimeAmount availableAmount pendingAmount\n reservedAmount paidAmount pendingPayoutCount unsyncedCount billingAvailable\n }\n }", {}, t)).cooMyCreatorEarningsSummary
|
|
113
129
|
});
|
|
114
|
-
},
|
|
130
|
+
}, k = () => {
|
|
115
131
|
let { apiGatewayUrl: t } = e(), i = a();
|
|
116
132
|
return r({
|
|
117
133
|
mutationFn: async (e) => (await n("mutation CooRequestCreatorPayout($input: CooRequestCreatorPayoutInput!) {\n cooRequestCreatorPayout(input: $input) { id status requestedAmount currency createdAt }\n }", { input: e }, t)).cooRequestCreatorPayout,
|
|
@@ -119,10 +135,10 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
119
135
|
i.invalidateQueries({ queryKey: [o, "creator-earnings-summary"] });
|
|
120
136
|
}
|
|
121
137
|
});
|
|
122
|
-
},
|
|
138
|
+
}, A = `
|
|
123
139
|
payout { ${t} }
|
|
124
140
|
provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency
|
|
125
|
-
`,
|
|
141
|
+
`, j = () => {
|
|
126
142
|
let { apiGatewayUrl: r } = e();
|
|
127
143
|
return i({
|
|
128
144
|
queryKey: [o, "collaboration-payouts"],
|
|
@@ -136,7 +152,7 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
136
152
|
offset: 0
|
|
137
153
|
} }, r)).cooMyCollaborationPayouts
|
|
138
154
|
});
|
|
139
|
-
},
|
|
155
|
+
}, M = () => {
|
|
140
156
|
let e = a();
|
|
141
157
|
return (t) => {
|
|
142
158
|
e.invalidateQueries({ queryKey: [
|
|
@@ -145,16 +161,16 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
145
161
|
t
|
|
146
162
|
] }), e.invalidateQueries({ queryKey: [o, "collaboration-payouts"] }), e.invalidateQueries({ queryKey: [o, "creator-earnings-summary"] });
|
|
147
163
|
};
|
|
148
|
-
},
|
|
149
|
-
let { apiGatewayUrl: t } = e(), i =
|
|
164
|
+
}, N = () => {
|
|
165
|
+
let { apiGatewayUrl: t } = e(), i = M();
|
|
150
166
|
return r({
|
|
151
167
|
mutationFn: async (e) => (await n(`mutation CooPayCollaborationFee($id: ID!) {
|
|
152
|
-
cooPayCollaborationFee(id: $id) { ${
|
|
168
|
+
cooPayCollaborationFee(id: $id) { ${A} }
|
|
153
169
|
}`, { id: e }, t)).cooPayCollaborationFee,
|
|
154
170
|
onSuccess: (e) => i(e.payout.collaborationId)
|
|
155
171
|
});
|
|
156
|
-
},
|
|
157
|
-
let { apiGatewayUrl: i } = e(), a =
|
|
172
|
+
}, P = () => {
|
|
173
|
+
let { apiGatewayUrl: i } = e(), a = M();
|
|
158
174
|
return r({
|
|
159
175
|
mutationFn: async (e) => (await n(`mutation CooSyncCollaborationPayment($id: ID!) {
|
|
160
176
|
cooSyncCollaborationPayment(id: $id) { ${t} }
|
|
@@ -163,6 +179,6 @@ var o = "coolandlovely", s = "\n items {\n id styleItemId quantity size colo
|
|
|
163
179
|
});
|
|
164
180
|
};
|
|
165
181
|
//#endregion
|
|
166
|
-
export { l as FULFILMENT_FIELDS, u as REFUND_FIELDS,
|
|
182
|
+
export { l as FULFILMENT_FIELDS, u as REFUND_FIELDS, d as RETURN_REQUEST_FIELDS, g as useAddToCart, T as useCancelOrder, S as useCheckout, m as useMyCart, j as useMyCollaborationPayouts, D as useMyCreatorEarnings, O as useMyCreatorEarningsSummary, b as useMyOrder, y as useMyOrders, N as usePayCollaborationFee, v as useRemoveCartItem, k as useRequestCreatorPayout, E as useRequestReturn, C as useResumeOrderPayment, P as useSyncCollaborationPayment, w as useSyncOrderPayment, _ as useUpdateCartItem };
|
|
167
183
|
|
|
168
184
|
//# sourceMappingURL=useCommerceApi.js.map
|
|
@@ -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 CooCollaborationPaymentCheckout,\n CooCollaborationPayout,\n CooCollaborationPayoutConnection,\n CooCreatorEarningConnection,\n CooCreatorEarningsSummary,\n CooCreatorPayout,\n CooOrder,\n CooOrderCheckout,\n CooOrderConnection,\n CooOrderStatus,\n} from '../types';\nimport { COLLABORATION_PAYOUT_FIELDS, 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 availableQuantity\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 refundedAmount refundedAt\n 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 refunded carrier trackingNumber trackingUrl note\n confirmedAt shippedAt deliveredAt updatedAt\n`;\n\n/** A brand's refund of its pieces (BOFF-9702): the shopper's order detail and the brand view. */\nexport const REFUND_FIELDS = `\n id orderId brandId brandName amount currency reason status failureReason refundedAt createdAt\n`;\n\nconst ORDER_DETAIL_FIELDS = `\n ${ORDER_FIELDS}\n fulfilmentStatus\n fulfilments { ${FULFILMENT_FIELDS} }\n refunds { ${REFUND_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 reversalStatus reversedAt 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\n// ---------------------------------------------------------------------------\n// Collaboration fees (BOFF-9637)\n// ---------------------------------------------------------------------------\n\nconst COLLABORATION_PAYMENT_FIELDS = `\n payout { ${COLLABORATION_PAYOUT_FIELDS} }\n provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency\n`;\n\n/** The calling creator's collaboration fees: awaiting the brand's payment, or paid. */\nexport const useMyCollaborationPayouts = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaboration-payouts'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCollaborationPayouts: CooCollaborationPayoutConnection }>(\n `query CooMyCollaborationPayouts($pagination: PaginationInput) {\n cooMyCollaborationPayouts(pagination: $pagination) {\n items { ${COLLABORATION_PAYOUT_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyCollaborationPayouts;\n },\n });\n};\n\nconst useCollaborationPayoutInvalidation = () => {\n const queryClient = useQueryClient();\n return (collaborationId: string) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration', collaborationId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration-payouts'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'creator-earnings-summary'] });\n };\n};\n\n/** Start (or re-open) the brand owner's payment of a collaboration fee. */\nexport const usePayCollaborationFee = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const refresh = useCollaborationPayoutInvalidation();\n return useMutation({\n mutationFn: async (collaborationId: string) => {\n const data = await coolQuery<{ cooPayCollaborationFee: CooCollaborationPaymentCheckout }>(\n `mutation CooPayCollaborationFee($id: ID!) {\n cooPayCollaborationFee(id: $id) { ${COLLABORATION_PAYMENT_FIELDS} }\n }`,\n { id: collaborationId },\n apiGatewayUrl\n );\n return data.cooPayCollaborationFee;\n },\n onSuccess: (checkout) => refresh(checkout.payout.collaborationId),\n });\n};\n\n/** Ask the backend to settle a collaboration fee against global-billing's payment record. */\nexport const useSyncCollaborationPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const refresh = useCollaborationPayoutInvalidation();\n return useMutation({\n mutationFn: async (collaborationId: string) => {\n const data = await coolQuery<{ cooSyncCollaborationPayment: CooCollaborationPayout }>(\n `mutation CooSyncCollaborationPayment($id: ID!) {\n cooSyncCollaborationPayment(id: $id) { ${COLLABORATION_PAYOUT_FIELDS} }\n }`,\n { id: collaborationId },\n apiGatewayUrl\n );\n return data.cooSyncCollaborationPayment;\n },\n onSuccess: (payout) => refresh(payout.collaborationId),\n });\n};\n"],"mappings":";;;;;AA8BA,IAAM,IAAK,iBAEL,IAAc,kQASd,IAAe,oVAWR,IAAoB,6IAMpB,IAAgB,uGAIvB,IAAsB;IACxB,EAAa;;kBAEC,EAAkB;cACtB,EAAc;GAGtB,IAAkB;YACZ,EAAa;;GAQZ,UAAkB;CAC7B,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,OAAO;EACtB,SAAS,aACM,MAAM,EACjB,iCAAiC,EAAY,OAC7C,EAAE,EACF,EACD,EACW;EAEf,CAAC;GAIE,KAA0B,GAAkB,MAAkB;CAClE,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAc,GAAgB;AACpC,QAAO,EAAY;EACjB,YAAY,OAAO,MAAqB;GAMtC,IAAM,KALO,MAAM,EACjB,GACA,GACA,EACD,EACiB;A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AM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,wBAAwB;EACvC,SAAS,aACM,MAAM,EACjB;;sBAEc,EAA4B;;;YAI1C,EAAE,YAAY;GAAE,OAAO;GAAI,QAAQ;GAAG,EAAE,EACxC,EACD,EACW;EAEf,CAAC;GAGE,UAA2C;CAC/C,IAAM,IAAc,GAAgB;AACpC,SAAQ,MAA4B;AAG7B,EAFA,EAAY,kBAAkB,EAAE,UAAU;GAAC;GAAI;GAAiB;GAAgB,EAAE,CAAC,EACnF,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,wBAAwB,EAAE,CAAC,EAC1E,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,2BAA2B,EAAE,CAAC;;GAKzE,UAA+B;CAC1C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAU,GAAoC;AACpD,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;8CACsC,EAA6B;YAEnE,EAAE,IAAI,GAAiB,EACvB,EACD,EACW;EAEd,YAAY,MAAa,EAAQ,EAAS,OAAO,gBAAgB;EAClE,CAAC;GAIS,UAAoC;CAC/C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAU,GAAoC;AACpD,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;mDAC2C,EAA4B;YAEvE,EAAE,IAAI,GAAiB,EACvB,EACD,EACW;EAEd,YAAY,MAAW,EAAQ,EAAO,gBAAgB;EACvD,CAAC"}
|
|
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 CooCollaborationPaymentCheckout,\n CooCollaborationPayout,\n CooCollaborationPayoutConnection,\n CooCreatorEarningConnection,\n CooCreatorEarningsSummary,\n CooCreatorPayout,\n CooOrder,\n CooOrderCheckout,\n CooOrderConnection,\n CooOrderStatus,\n CooRequestReturnInput,\n CooReturnRequest,\n} from '../types';\nimport { COLLABORATION_PAYOUT_FIELDS, 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 availableQuantity\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 refundedAmount refundedAt\n 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 refunded carrier trackingNumber trackingUrl note\n confirmedAt shippedAt deliveredAt updatedAt\n`;\n\n/** A brand's refund of its pieces (BOFF-9702): the shopper's order detail and the brand view. */\nexport const REFUND_FIELDS = `\n id orderId brandId brandName amount currency reason status failureReason refundedAt createdAt\n`;\n\n/** A shopper's return request (BOFF-9900): the shopper's order detail and the brand view. */\nexport const RETURN_REQUEST_FIELDS = `\n id orderId orderNumber brandId brandName reason status decisionNote decidedAt refundId\n createdAt updatedAt\n`;\n\nconst ORDER_DETAIL_FIELDS = `\n ${ORDER_FIELDS}\n fulfilmentStatus\n fulfilments { ${FULFILMENT_FIELDS} }\n refunds { ${REFUND_FIELDS} }\n returnRequests { ${RETURN_REQUEST_FIELDS} }\n returnWindowEndsAt\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 * Ask a brand to take back its pieces of one of the caller's paid orders (BOFF-9900). The brand\n * approves (which refunds them) or declines; the order detail is refetched to show the request.\n */\nexport const useRequestReturn = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: CooRequestReturnInput) => {\n const data = await coolQuery<{ cooRequestReturn: CooReturnRequest }>(\n `mutation CooRequestReturn($input: CooRequestReturnInput!) {\n cooRequestReturn(input: $input) { ${RETURN_REQUEST_FIELDS} }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooRequestReturn;\n },\n onSettled: (_request, _error, input) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'order', input.orderId] });\n },\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 reversalStatus reversedAt 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\n// ---------------------------------------------------------------------------\n// Collaboration fees (BOFF-9637)\n// ---------------------------------------------------------------------------\n\nconst COLLABORATION_PAYMENT_FIELDS = `\n payout { ${COLLABORATION_PAYOUT_FIELDS} }\n provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency\n`;\n\n/** The calling creator's collaboration fees: awaiting the brand's payment, or paid. */\nexport const useMyCollaborationPayouts = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'collaboration-payouts'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCollaborationPayouts: CooCollaborationPayoutConnection }>(\n `query CooMyCollaborationPayouts($pagination: PaginationInput) {\n cooMyCollaborationPayouts(pagination: $pagination) {\n items { ${COLLABORATION_PAYOUT_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyCollaborationPayouts;\n },\n });\n};\n\nconst useCollaborationPayoutInvalidation = () => {\n const queryClient = useQueryClient();\n return (collaborationId: string) => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration', collaborationId] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collaboration-payouts'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'creator-earnings-summary'] });\n };\n};\n\n/** Start (or re-open) the brand owner's payment of a collaboration fee. */\nexport const usePayCollaborationFee = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const refresh = useCollaborationPayoutInvalidation();\n return useMutation({\n mutationFn: async (collaborationId: string) => {\n const data = await coolQuery<{ cooPayCollaborationFee: CooCollaborationPaymentCheckout }>(\n `mutation CooPayCollaborationFee($id: ID!) {\n cooPayCollaborationFee(id: $id) { ${COLLABORATION_PAYMENT_FIELDS} }\n }`,\n { id: collaborationId },\n apiGatewayUrl\n );\n return data.cooPayCollaborationFee;\n },\n onSuccess: (checkout) => refresh(checkout.payout.collaborationId),\n });\n};\n\n/** Ask the backend to settle a collaboration fee against global-billing's payment record. */\nexport const useSyncCollaborationPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const refresh = useCollaborationPayoutInvalidation();\n return useMutation({\n mutationFn: async (collaborationId: string) => {\n const data = await coolQuery<{ cooSyncCollaborationPayment: CooCollaborationPayout }>(\n `mutation CooSyncCollaborationPayment($id: ID!) {\n cooSyncCollaborationPayment(id: $id) { ${COLLABORATION_PAYOUT_FIELDS} }\n }`,\n { id: collaborationId },\n apiGatewayUrl\n );\n return data.cooSyncCollaborationPayment;\n },\n onSuccess: (payout) => refresh(payout.collaborationId),\n });\n};\n"],"mappings":";;;;;AAgCA,IAAM,IAAK,iBAEL,IAAc,kQASd,IAAe,oVAWR,IAAoB,6IAMpB,IAAgB,uGAKhB,IAAwB,uHAK/B,IAAsB;IACxB,EAAa;;kBAEC,EAAkB;cACtB,EAAc;qBACP,EAAsB;;GAIrC,IAAkB;YACZ,EAAa;;GAQZ,UAAkB;CAC7B,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,OAAO;EACtB,SAAS,aACM,MAAM,EACjB,iCAAiC,EAAY,OAC7C,EAAE,EACF,EACD,EACW;EAEf,CAAC;GAIE,KAA0B,GAAkB,MAAkB;CAClE,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAc,GAAgB;AACpC,QAAO,EAAY;EACjB,YAAY,OAAO,MAAqB;GAMtC,IAAM,KALO,MAAM,EACjB,GACA,GACA,EACD,EACiB;AAClB,OAAI,CAAC,EAAM,OAAU,MAAM,gCAAgC;AAC3D,UAAO;;EAET,YAAY,MAAS;AACnB,KAAY,aAAa,CAAC,GAAI,OAAO,EAAE,EAAK;;EAE/C,CAAC;GAGS,UACX,EACE,qFAAqF,EAAY,OACjG,eACD,EAEU,UACX,EACE;0DACsD,EAAY;QAElE,oBACD,EAEU,UACX,EACE,uEAAuE,EAAY,OACnF,oBACD,EAMU,KAAe,MAA4B;CACtD,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU;GAAC;GAAI;GAAU,KAAU;G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C,SAAS,aACM,MAAM,EACjB;;sBAEc,EAA4B;;;YAI1C,EAAE,YAAY;GAAE,OAAO;GAAI,QAAQ;GAAG,EAAE,EACxC,EACD,EACW;EAEf,CAAC;GAGE,UAA2C;CAC/C,IAAM,IAAc,GAAgB;AACpC,SAAQ,MAA4B;AAG7B,EAFA,EAAY,kBAAkB,EAAE,UAAU;GAAC;GAAI;GAAiB;GAAgB,EAAE,CAAC,EACnF,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,wBAAwB,EAAE,CAAC,EAC1E,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,2BAA2B,EAAE,CAAC;;GAKzE,UAA+B;CAC1C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAU,GAAoC;AACpD,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;8CACsC,EAA6B;YAEnE,EAAE,IAAI,GAAiB,EACvB,EACD,EACW;EAEd,YAAY,MAAa,EAAQ,EAAS,OAAO,gBAAgB;EAClE,CAAC;GAIS,UAAoC;CAC/C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAU,GAAoC;AACpD,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;mDAC2C,EAA4B;YAEvE,EAAE,IAAI,GAAiB,EACvB,EACD,EACW;EAEd,YAAY,MAAW,EAAQ,EAAO,gBAAgB;EACvD,CAAC"}
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
* (`cooBrandOrderSummary`), and one order's fulfilment — confirm it, ship it with tracking,
|
|
8
8
|
* mark it delivered (`cooUpdateOrderFulfilment`). Fulfilment only moves forward, and the
|
|
9
9
|
* buyer is notified of every change. A brand can also refund all of its pieces of an order
|
|
10
|
-
* (`cooRefundBrandOrder`, BOFF-9702); refunded pieces are no longer fulfilled.
|
|
10
|
+
* (`cooRefundBrandOrder`, BOFF-9702); refunded pieces are no longer fulfilled. Shoppers' return
|
|
11
|
+
* requests (BOFF-9900) are listed while pending, and the brand approves (which refunds) or
|
|
12
|
+
* declines each one on the order detail.
|
|
11
13
|
*/
|
|
12
14
|
export declare function BrandOrdersPage(): import("react").JSX.Element;
|
|
13
15
|
export declare function BrandOrderDetailPage(): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BrandOrdersPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/commerce/BrandOrdersPage.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BrandOrdersPage.d.ts","sourceRoot":"","sources":["../../../../src/coolandlovely/pages/commerce/BrandOrdersPage.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAgFH,wBAAgB,eAAe,gCA8J9B;AA6HD,wBAAgB,oBAAoB,gCAiHnC"}
|