@burdenoff/microfe-coolandlovely 2026.1027.2 → 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.
Files changed (49) hide show
  1. package/dist/coolandlovely/components/ReturnRequests.d.ts +15 -0
  2. package/dist/coolandlovely/components/ReturnRequests.d.ts.map +1 -0
  3. package/dist/coolandlovely/components/ReturnRequests.js +218 -0
  4. package/dist/coolandlovely/components/ReturnRequests.js.map +1 -0
  5. package/dist/coolandlovely/components/StatusBadge.d.ts.map +1 -1
  6. package/dist/coolandlovely/components/StatusBadge.js +5 -1
  7. package/dist/coolandlovely/components/StatusBadge.js.map +1 -1
  8. package/dist/coolandlovely/components/StoreListingCard.d.ts +9 -0
  9. package/dist/coolandlovely/components/StoreListingCard.d.ts.map +1 -0
  10. package/dist/coolandlovely/components/StoreListingCard.js +63 -0
  11. package/dist/coolandlovely/components/StoreListingCard.js.map +1 -0
  12. package/dist/coolandlovely/components/index.d.ts +1 -0
  13. package/dist/coolandlovely/components/index.d.ts.map +1 -1
  14. package/dist/coolandlovely/components/index.js +1 -0
  15. package/dist/coolandlovely/hooks/index.d.ts +1 -1
  16. package/dist/coolandlovely/hooks/index.d.ts.map +1 -1
  17. package/dist/coolandlovely/hooks/useBrandOrdersApi.d.ts +10 -1
  18. package/dist/coolandlovely/hooks/useBrandOrdersApi.d.ts.map +1 -1
  19. package/dist/coolandlovely/hooks/useBrandOrdersApi.js +99 -30
  20. package/dist/coolandlovely/hooks/useBrandOrdersApi.js.map +1 -1
  21. package/dist/coolandlovely/hooks/useCommerceApi.d.ts +8 -1
  22. package/dist/coolandlovely/hooks/useCommerceApi.d.ts.map +1 -1
  23. package/dist/coolandlovely/hooks/useCommerceApi.js +47 -31
  24. package/dist/coolandlovely/hooks/useCommerceApi.js.map +1 -1
  25. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts +8 -0
  26. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts.map +1 -1
  27. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js +109 -87
  28. package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js.map +1 -1
  29. package/dist/coolandlovely/pages/commerce/BrandOrdersPage.d.ts +3 -1
  30. package/dist/coolandlovely/pages/commerce/BrandOrdersPage.d.ts.map +1 -1
  31. package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js +129 -97
  32. package/dist/coolandlovely/pages/commerce/BrandOrdersPage.js.map +1 -1
  33. package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts +2 -1
  34. package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts.map +1 -1
  35. package/dist/coolandlovely/pages/commerce/OrdersPage.js +124 -122
  36. package/dist/coolandlovely/pages/commerce/OrdersPage.js.map +1 -1
  37. package/dist/coolandlovely/pages/items/StyleItemDetailPage.d.ts +1 -1
  38. package/dist/coolandlovely/pages/items/StyleItemDetailPage.d.ts.map +1 -1
  39. package/dist/coolandlovely/pages/items/StyleItemDetailPage.js +113 -111
  40. package/dist/coolandlovely/pages/items/StyleItemDetailPage.js.map +1 -1
  41. package/dist/coolandlovely/types/commerce.d.ts +45 -0
  42. package/dist/coolandlovely/types/commerce.d.ts.map +1 -1
  43. package/dist/coolandlovely/types/index.d.ts +9 -0
  44. package/dist/coolandlovely/types/index.d.ts.map +1 -1
  45. package/dist/generated/global-types.d.ts +4944 -1626
  46. package/dist/generated/global-types.d.ts.map +1 -1
  47. package/dist/generated/wspace-types.d.ts +98128 -34631
  48. package/dist/generated/wspace-types.d.ts.map +1 -1
  49. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
1
  import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
2
2
  import "../context/index.js";
3
3
  import { coolQuery as t } from "./useCoolAndLovelyApi.js";
4
- import { FULFILMENT_FIELDS as n, REFUND_FIELDS as r } from "./useCommerceApi.js";
5
- import { useMutation as i, useQuery as a, useQueryClient as o } from "@tanstack/react-query";
4
+ import { FULFILMENT_FIELDS as n, REFUND_FIELDS as r, RETURN_REQUEST_FIELDS as i } from "./useCommerceApi.js";
5
+ import { useMutation as a, useQuery as o, useQueryClient as s } from "@tanstack/react-query";
6
6
  //#region src/coolandlovely/hooks/useBrandOrdersApi.ts
7
- var s = "coolandlovely", c = `
7
+ var c = "coolandlovely", l = `
8
8
  id orderNumber status brandId currency brandSubtotal itemCount
9
9
  shippingName shippingAddress buyerNote paidAt createdAt
10
10
  items {
@@ -13,11 +13,12 @@ var s = "coolandlovely", c = `
13
13
  }
14
14
  fulfilment { ${n} }
15
15
  refund { ${r} }
16
- `, l = (n, r) => {
16
+ returnRequest { ${i} }
17
+ `, u = (n, r) => {
17
18
  let { apiGatewayUrl: i } = e();
18
- return a({
19
+ return o({
19
20
  queryKey: [
20
- s,
21
+ c,
21
22
  "brand-orders",
22
23
  n,
23
24
  r ?? "ALL"
@@ -25,7 +26,7 @@ var s = "coolandlovely", c = `
25
26
  enabled: !!n,
26
27
  queryFn: async () => (await t(`query CooBrandOrders($brandId: ID!, $fulfilmentStatus: CooFulfilmentStatus, $pagination: PaginationInput) {
27
28
  cooBrandOrders(brandId: $brandId, fulfilmentStatus: $fulfilmentStatus, pagination: $pagination) {
28
- items { ${c} }
29
+ items { ${l} }
29
30
  pageInfo { cursor hasMore }
30
31
  }
31
32
  }`, {
@@ -37,88 +38,156 @@ var s = "coolandlovely", c = `
37
38
  }
38
39
  }, i)).cooBrandOrders
39
40
  });
40
- }, u = (n) => {
41
+ }, d = (n) => {
41
42
  let { apiGatewayUrl: r } = e();
42
- return a({
43
+ return o({
43
44
  queryKey: [
44
- s,
45
+ c,
45
46
  "brand-order-summary",
46
47
  n
47
48
  ],
48
49
  enabled: !!n,
49
50
  queryFn: async () => (await t("query CooBrandOrderSummary($brandId: ID!) {\n cooBrandOrderSummary(brandId: $brandId) {\n brandId unfulfilled confirmed shipped delivered refunded total\n }\n }", { brandId: n }, r)).cooBrandOrderSummary
50
51
  });
51
- }, d = (n, r) => {
52
+ }, f = (n, r) => {
52
53
  let { apiGatewayUrl: i } = e();
53
- return a({
54
+ return o({
54
55
  queryKey: [
55
- s,
56
+ c,
56
57
  "brand-order",
57
58
  n,
58
59
  r
59
60
  ],
60
61
  enabled: !!n && !!r,
61
- queryFn: async () => (await t(`query CooBrandOrder($brandId: ID!, $id: ID!) { cooBrandOrder(brandId: $brandId, id: $id) { ${c} } }`, {
62
+ queryFn: async () => (await t(`query CooBrandOrder($brandId: ID!, $id: ID!) { cooBrandOrder(brandId: $brandId, id: $id) { ${l} } }`, {
62
63
  brandId: n,
63
64
  id: r
64
65
  }, i)).cooBrandOrder
65
66
  });
66
- }, f = () => {
67
- let { apiGatewayUrl: n } = e(), r = o();
68
- return i({
67
+ }, p = () => {
68
+ let { apiGatewayUrl: n } = e(), r = s();
69
+ return a({
69
70
  mutationFn: async (e) => (await t(`mutation CooUpdateOrderFulfilment($input: CooUpdateOrderFulfilmentInput!) {
70
- cooUpdateOrderFulfilment(input: $input) { ${c} }
71
+ cooUpdateOrderFulfilment(input: $input) { ${l} }
71
72
  }`, { input: e }, n)).cooUpdateOrderFulfilment,
72
73
  onSuccess: (e) => {
73
74
  r.setQueryData([
74
- s,
75
+ c,
75
76
  "brand-order",
76
77
  e.brandId,
77
78
  e.id
78
79
  ], e), r.invalidateQueries({ queryKey: [
79
- s,
80
+ c,
80
81
  "brand-orders",
81
82
  e.brandId
82
83
  ] }), r.invalidateQueries({ queryKey: [
83
- s,
84
+ c,
84
85
  "brand-order-summary",
85
86
  e.brandId
86
87
  ] });
87
88
  }
88
89
  });
89
- }, p = () => {
90
- let { apiGatewayUrl: n } = e(), r = o();
91
- return i({
90
+ }, m = () => {
91
+ let { apiGatewayUrl: n } = e(), r = s();
92
+ return a({
92
93
  mutationFn: async (e) => (await t(`mutation CooRefundBrandOrder($input: CooRefundBrandOrderInput!) {
93
- cooRefundBrandOrder(input: $input) { ${c} }
94
+ cooRefundBrandOrder(input: $input) { ${l} }
94
95
  }`, { input: e }, n)).cooRefundBrandOrder,
95
96
  onSuccess: (e) => {
96
97
  r.setQueryData([
97
- s,
98
+ c,
98
99
  "brand-order",
99
100
  e.brandId,
100
101
  e.id
101
102
  ], e), r.invalidateQueries({ queryKey: [
102
- s,
103
+ c,
103
104
  "brand-orders",
104
105
  e.brandId
105
106
  ] }), r.invalidateQueries({ queryKey: [
106
- s,
107
+ c,
107
108
  "brand-order-summary",
108
109
  e.brandId
109
110
  ] });
110
111
  },
111
112
  onError: (e, t) => {
112
113
  r.invalidateQueries({ queryKey: [
113
- s,
114
+ c,
114
115
  "brand-order",
115
116
  t.brandId,
116
117
  t.orderId
117
118
  ] });
118
119
  }
119
120
  });
121
+ }, h = (n, r) => {
122
+ let { apiGatewayUrl: a } = e();
123
+ return o({
124
+ queryKey: [
125
+ c,
126
+ "brand-return-requests",
127
+ n,
128
+ r ?? "ALL"
129
+ ],
130
+ enabled: !!n,
131
+ queryFn: async () => (await t(`query CooBrandReturnRequests($brandId: ID!, $status: CooReturnRequestStatus, $pagination: PaginationInput) {
132
+ cooBrandReturnRequests(brandId: $brandId, status: $status, pagination: $pagination) {
133
+ items { ${i} }
134
+ pageInfo { cursor hasMore }
135
+ }
136
+ }`, {
137
+ brandId: n,
138
+ status: r,
139
+ pagination: {
140
+ limit: 50,
141
+ offset: 0
142
+ }
143
+ }, a)).cooBrandReturnRequests
144
+ });
145
+ }, g = () => {
146
+ let e = s();
147
+ return (t, n, r) => {
148
+ r ? e.setQueryData([
149
+ c,
150
+ "brand-order",
151
+ t,
152
+ n
153
+ ], r) : e.invalidateQueries({ queryKey: [
154
+ c,
155
+ "brand-order",
156
+ t,
157
+ n
158
+ ] }), e.invalidateQueries({ queryKey: [
159
+ c,
160
+ "brand-orders",
161
+ t
162
+ ] }), e.invalidateQueries({ queryKey: [
163
+ c,
164
+ "brand-order-summary",
165
+ t
166
+ ] }), e.invalidateQueries({ queryKey: [
167
+ c,
168
+ "brand-return-requests",
169
+ t
170
+ ] });
171
+ };
172
+ }, _ = () => {
173
+ let { apiGatewayUrl: n } = e(), r = g();
174
+ return a({
175
+ mutationFn: async (e) => (await t(`mutation CooApproveReturnRequest($input: CooApproveReturnRequestInput!) {
176
+ cooApproveReturnRequest(input: $input) { ${l} }
177
+ }`, { input: e }, n)).cooApproveReturnRequest,
178
+ onSuccess: (e, t) => r(t.brandId, t.orderId, e),
179
+ onError: (e, t) => r(t.brandId, t.orderId)
180
+ });
181
+ }, v = () => {
182
+ let { apiGatewayUrl: n } = e(), r = g();
183
+ return a({
184
+ mutationFn: async (e) => (await t(`mutation CooDeclineReturnRequest($input: CooDeclineReturnRequestInput!) {
185
+ cooDeclineReturnRequest(input: $input) { ${l} }
186
+ }`, { input: e }, n)).cooDeclineReturnRequest,
187
+ onSuccess: (e, t) => r(t.brandId, t.orderId, e)
188
+ });
120
189
  };
121
190
  //#endregion
122
- export { d as useBrandOrder, u as useBrandOrderSummary, l as useBrandOrders, p as useRefundBrandOrder, f as useUpdateOrderFulfilment };
191
+ export { _ as useApproveReturnRequest, f as useBrandOrder, d as useBrandOrderSummary, u as useBrandOrders, h as useBrandReturnRequests, v as useDeclineReturnRequest, m as useRefundBrandOrder, p as useUpdateOrderFulfilment };
123
192
 
124
193
  //# sourceMappingURL=useBrandOrdersApi.js.map
@@ -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,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,kBAAkB,EAAE,UAAU;IAAC;IAAI;IAAgB,EAAM;IAAQ,EAAE,CAAC,EAChF,EAAY,kBAAkB,EAAE,UAAU;IAAC;IAAI;IAAuB,EAAM;IAAQ,EAAE,CAAC;;EAE/F,CAAC;GAOS,UAA4B;CACvC,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAc,GAAgB;AACpC,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;iDACyC,EAAmB;YAE5D,EAAE,UAAO,EACT,EACD,EACW;EAEd,YAAY,MAAU;AAGf,GAFL,EAAY,aAAa;IAAC;IAAI;IAAe,EAAM;IAAS,EAAM;IAAG,EAAE,EAAM,EACxE,EAAY,kBAAkB,EAAE,UAAU;IAAC;IAAI;IAAgB,EAAM;IAAQ,EAAE,CAAC,EAChF,EAAY,kBAAkB,EAAE,UAAU;IAAC;IAAI;IAAuB,EAAM;IAAQ,EAAE,CAAC;;EAG9F,UAAU,GAAQ,MAAU;AACrB,KAAY,kBAAkB,EACjC,UAAU;IAAC;IAAI;IAAe,EAAM;IAAS,EAAM;IAAQ,EAC5D,CAAC;;EAEL,CAAC"}
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;IAA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ACxE,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,EACf,MAAM,UAAU,CAAC;AAwBlB,iGAAiG;AACjG,eAAO,MAAM,iBAAiB,8IAG7B,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,aAAa,wGAEzB,CAAC;AAkBF,eAAO,MAAM,SAAS,+EAarB,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GAAiG;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
- `, f = `
11
+ returnRequests { ${d} }
12
+ returnWindowEndsAt
13
+ `, p = `
12
14
  order { ${c} }
13
15
  provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency
14
- `, p = () => {
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
- }, m = (t, i) => {
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
- }, h = () => m(`mutation CooAddToCart($input: CooAddToCartInput!) { cooAddToCart(input: $input) { ${s} } }`, "cooAddToCart"), g = () => m(`mutation CooUpdateCartItem($id: ID!, $quantity: Int!) {
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"), _ = () => m(`mutation CooRemoveCartItem($id: ID!) { cooRemoveCartItem(id: $id) { ${s} } }`, "cooRemoveCartItem"), v = (t) => {
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
- }, y = (t) => {
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) { ${d} } }`, { id: t }, r)).cooMyOrder
66
+ queryFn: async () => (await n(`query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${f} } }`, { id: t }, r)).cooMyOrder
65
67
  });
66
- }, b = () => {
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
- }, x = () => {
76
- let { apiGatewayUrl: t } = e(), i = b();
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) { ${f} } }`, { input: e }, t)).cooCheckout,
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
- }, S = () => {
82
- let { apiGatewayUrl: t } = e(), i = b();
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) { ${f} } }`, { id: e }, t)).cooResumeOrderPayment,
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
- }, C = () => {
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: b()
93
+ onSuccess: x()
92
94
  });
93
- }, w = () => {
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: b()
99
+ onSuccess: x()
98
100
  });
99
- }, T = () => {
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
- }, E = () => {
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
- }, D = () => {
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
- }, O = `
138
+ }, A = `
123
139
  payout { ${t} }
124
140
  provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency
125
- `, k = () => {
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
- }, A = () => {
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
- }, j = () => {
149
- let { apiGatewayUrl: t } = e(), i = A();
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) { ${O} }
168
+ cooPayCollaborationFee(id: $id) { ${A} }
153
169
  }`, { id: e }, t)).cooPayCollaborationFee,
154
170
  onSuccess: (e) => i(e.payout.collaborationId)
155
171
  });
156
- }, M = () => {
157
- let { apiGatewayUrl: i } = e(), a = 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, h as useAddToCart, w as useCancelOrder, x as useCheckout, p as useMyCart, k as useMyCollaborationPayouts, T as useMyCreatorEarnings, E as useMyCreatorEarningsSummary, y as useMyOrder, v as useMyOrders, j as usePayCollaborationFee, _ as useRemoveCartItem, D as useRequestCreatorPayout, S as useResumeOrderPayment, M as useSyncCollaborationPayment, C as useSyncOrderPayment, g as useUpdateCartItem };
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;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,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pC,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.cooSyncCollaborationP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AE,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"}
@@ -47,6 +47,14 @@ export declare const useUpdateStyleItem: () => import('@tanstack/react-query').U
47
47
  id: string;
48
48
  input: CooUpdateStyleItemInput;
49
49
  }, unknown>;
50
+ /**
51
+ * Re-drive the push of a piece to its Burdenoff store catalogue listing
52
+ * (`cooSyncStyleItemStoreListing`, BOFF-3430). Listings normally follow every
53
+ * change automatically; this is the manual retry for a FAILED sync. The
54
+ * service records a failed push on the piece rather than throwing, so the
55
+ * returned item carries the new outcome either way.
56
+ */
57
+ export declare const useSyncStyleItemStoreListing: () => import('@tanstack/react-query').UseMutationResult<CooStyleItem, Error, string, unknown>;
50
58
  export declare const useArchiveStyleItem: () => import('@tanstack/react-query').UseMutationResult<boolean, Error, string, unknown>;
51
59
  export interface ListLooksArgs {
52
60
  authorId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"useCoolAndLovelyApi.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;G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