@burdenoff/microfe-coolandlovely 2026.1024.1 → 2026.1024.3
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/CoolAndLovelyRoot.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoot.js +92 -68
- package/dist/coolandlovely/CoolAndLovelyRoot.js.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +25 -9
- package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
- package/dist/coolandlovely/components/AddToCartPanel.d.ts +10 -0
- package/dist/coolandlovely/components/AddToCartPanel.d.ts.map +1 -0
- package/dist/coolandlovely/components/AddToCartPanel.js +97 -0
- package/dist/coolandlovely/components/AddToCartPanel.js.map +1 -0
- package/dist/coolandlovely/components/PayForOrder.d.ts +11 -0
- package/dist/coolandlovely/components/PayForOrder.d.ts.map +1 -0
- package/dist/coolandlovely/components/PayForOrder.js +118 -0
- package/dist/coolandlovely/components/PayForOrder.js.map +1 -0
- package/dist/coolandlovely/components/StatusBadge.d.ts.map +1 -1
- package/dist/coolandlovely/components/StatusBadge.js +4 -0
- package/dist/coolandlovely/components/StatusBadge.js.map +1 -1
- package/dist/coolandlovely/hooks/useCommerceApi.d.ts +27 -0
- package/dist/coolandlovely/hooks/useCommerceApi.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/useCommerceApi.js +121 -0
- package/dist/coolandlovely/hooks/useCommerceApi.js.map +1 -0
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts +1 -0
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.d.ts.map +1 -1
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js +1 -1
- package/dist/coolandlovely/hooks/useCoolAndLovelyApi.js.map +1 -1
- package/dist/coolandlovely/pages/commerce/CartPage.d.ts +10 -0
- package/dist/coolandlovely/pages/commerce/CartPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/commerce/CartPage.js +283 -0
- package/dist/coolandlovely/pages/commerce/CartPage.js.map +1 -0
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.d.ts +11 -0
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js +185 -0
- package/dist/coolandlovely/pages/commerce/CreatorEarningsPage.js.map +1 -0
- package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts +11 -0
- package/dist/coolandlovely/pages/commerce/OrdersPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/commerce/OrdersPage.js +280 -0
- package/dist/coolandlovely/pages/commerce/OrdersPage.js.map +1 -0
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js +114 -106
- package/dist/coolandlovely/pages/items/StyleItemDetailPage.js.map +1 -1
- package/dist/coolandlovely/pages/looks/LookDetailPage.js +1 -1
- package/dist/coolandlovely/pages/looks/LookDetailPage.js.map +1 -1
- package/dist/coolandlovely/types/commerce.d.ts +137 -0
- package/dist/coolandlovely/types/commerce.d.ts.map +1 -0
- package/dist/coolandlovely/types/index.d.ts +1 -0
- package/dist/coolandlovely/types/index.d.ts.map +1 -1
- package/dist/coolandlovely/utils/paymentProviders.d.ts +74 -0
- package/dist/coolandlovely/utils/paymentProviders.d.ts.map +1 -0
- package/dist/coolandlovely/utils/paymentProviders.js +42 -0
- package/dist/coolandlovely/utils/paymentProviders.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AddToCartPanel.js","names":[],"sources":["../../../src/coolandlovely/components/AddToCartPanel.tsx"],"sourcesContent":["/**\n * AddToCartPanel — size / colour / quantity picker + \"Add to cart\" for a catalogue piece.\n * @module coolandlovely/components\n *\n * When the shopper arrived from a look (\"shop the look\"), the look id rides along so the look's\n * creator earns the commission once the order is paid (BOFF-3370).\n */\n\nimport { type FC, useState } from 'react';\nimport { Check, Loader2, ShoppingBag, Sparkles } from 'lucide-react';\n\nimport { useCoolAndLovely } from '../context/CoolAndLovelyContext';\nimport { useTr } from '../hooks';\nimport { useAddToCart } from '../hooks/useCommerceApi';\nimport type { CooStyleItem } from '../types';\nimport { cn } from '../utils/cn';\n\ninterface AddToCartPanelProps {\n item: Pick<CooStyleItem, 'id' | 'status' | 'price' | 'sizes' | 'colours'>;\n lookId?: string | null;\n}\n\nconst MAX_QUANTITY = 10;\n\nconst chip = (selected: boolean) =>\n cn(\n 'inline-flex min-w-9 items-center justify-center rounded-full border px-3 py-1 text-sm font-medium transition-colors',\n selected\n ? 'border-action-primary-bg bg-action-primary-bg text-action-primary-text'\n : 'border-border-seam text-text-primary hover:bg-bg-sunken'\n );\n\nexport const AddToCartPanel: FC<AddToCartPanelProps> = ({ item, lookId }) => {\n const tr = useTr();\n const { navigateTo } = useCoolAndLovely();\n const addToCart = useAddToCart();\n const [size, setSize] = useState<string | null>(\n item.sizes.length === 1 ? (item.sizes[0] ?? null) : null\n );\n const [colour, setColour] = useState<string | null>(\n item.colours.length === 1 ? (item.colours[0] ?? null) : null\n );\n const [quantity, setQuantity] = useState(1);\n\n const purchasable = item.status === 'ACTIVE' && item.price > 0;\n const needsSize = item.sizes.length > 0 && !size;\n const needsColour = item.colours.length > 0 && !colour;\n\n if (!purchasable) {\n return (\n <p className=\"rounded-lg border border-border-seam bg-bg-sunken p-3 text-sm text-text-secondary\">\n {tr('coolandlovely.cart.notForSale', 'This piece is not available to buy right now.')}\n </p>\n );\n }\n\n return (\n <div className=\"space-y-4\" data-testid=\"add-to-cart-panel\">\n {lookId && (\n <p className=\"inline-flex items-center gap-1.5 text-xs font-medium text-accent-primary\">\n <Sparkles className=\"h-3.5 w-3.5\" />\n {tr(\n 'coolandlovely.cart.shoppingLook',\n 'Shopping from a look — your purchase supports its creator'\n )}\n </p>\n )}\n {item.sizes.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr('coolandlovely.cart.chooseSize', 'Choose a size')}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {item.sizes.map((option) => (\n <button\n key={option}\n type=\"button\"\n aria-pressed={size === option}\n onClick={() => setSize(option)}\n className={chip(size === option)}\n >\n {option}\n </button>\n ))}\n </div>\n </div>\n )}\n {item.colours.length > 0 && (\n <div>\n <p className=\"mb-2 text-xs font-medium uppercase tracking-wide text-text-secondary\">\n {tr('coolandlovely.cart.chooseColour', 'Choose a colour')}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {item.colours.map((option) => (\n <button\n key={option}\n type=\"button\"\n aria-pressed={colour === option}\n onClick={() => setColour(option)}\n className={chip(colour === option)}\n >\n {option}\n </button>\n ))}\n </div>\n </div>\n )}\n <div className=\"flex items-center gap-3\">\n <label htmlFor=\"coo-add-quantity\" className=\"text-sm text-text-secondary\">\n {tr('coolandlovely.cart.quantity', 'Quantity')}\n </label>\n <select\n id=\"coo-add-quantity\"\n value={quantity}\n onChange={(event) => setQuantity(Number(event.target.value))}\n className=\"rounded-lg border border-border-seam bg-bg-surface px-2 py-1.5 text-sm text-text-primary\"\n >\n {Array.from({ length: MAX_QUANTITY }, (_, index) => index + 1).map((value) => (\n <option key={value} value={value}>\n {value}\n </option>\n ))}\n </select>\n </div>\n {addToCart.error && (\n <p className=\"text-sm text-status-error-text\">{addToCart.error.message}</p>\n )}\n <div className=\"flex flex-wrap gap-2\">\n <button\n type=\"button\"\n disabled={needsSize || needsColour || addToCart.isPending}\n onClick={() =>\n addToCart.mutate({\n input: { styleItemId: item.id, quantity, size, colour, lookId: lookId ?? null },\n })\n }\n className=\"inline-flex flex-1 items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50\"\n >\n {addToCart.isPending ? (\n <Loader2 className=\"h-4 w-4 animate-spin\" />\n ) : addToCart.isSuccess ? (\n <Check className=\"h-4 w-4\" />\n ) : (\n <ShoppingBag className=\"h-4 w-4\" />\n )}\n {addToCart.isSuccess\n ? tr('coolandlovely.cart.added', 'Added to cart')\n : tr('coolandlovely.cart.add', 'Add to cart')}\n </button>\n {addToCart.isSuccess && (\n <button\n type=\"button\"\n onClick={() => navigateTo('/cart')}\n className=\"inline-flex items-center gap-1.5 rounded-lg border border-border-seam px-4 py-2.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken\"\n >\n {tr('coolandlovely.cart.viewCart', 'View cart')}\n </button>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAsBA,IAAM,IAAe,IAEf,KAAQ,MACZ,EACE,uHACA,IACI,2EACA,0DACL,EAEU,KAA2C,EAAE,SAAM,gBAAa;CAC3E,IAAM,IAAK,GAAO,EACZ,EAAE,kBAAe,GAAkB,EACnC,IAAY,GAAc,EAC1B,CAAC,GAAM,KAAW,EACtB,EAAK,MAAM,WAAW,IAAK,EAAK,MAAM,MAAM,OAAQ,KACrD,EACK,CAAC,GAAQ,KAAa,EAC1B,EAAK,QAAQ,WAAW,IAAK,EAAK,QAAQ,MAAM,OAAQ,KACzD,EACK,CAAC,GAAU,KAAe,EAAS,EAAE,EAErC,IAAc,EAAK,WAAW,YAAY,EAAK,QAAQ,GACvD,IAAY,EAAK,MAAM,SAAS,KAAK,CAAC,GACtC,IAAc,EAAK,QAAQ,SAAS,KAAK,CAAC;AAUhD,QARK,IASH,kBAAC,OAAD;EAAK,WAAU;EAAY,eAAY;YAAvC;GACG,KACC,kBAAC,KAAD;IAAG,WAAU;cAAb,CACE,kBAAC,GAAD,EAAU,WAAU,eAAgB,CAAA,EACnC,EACC,mCACA,4DACD,CACC;;GAEL,EAAK,MAAM,SAAS,KACnB,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;IAAG,WAAU;cACV,EAAG,iCAAiC,gBAAgB;IACnD,CAAA,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,CAUG,EAAU,YACT,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,GAC1C,EAAU,YACZ,kBAAC,GAAD,EAAO,WAAU,WAAY,CAAA,GAE7B,kBAAC,GAAD,EAAa,WAAU,WAAY,CAAA,EAEpC,EAAU,YACP,EAAG,4BAA4B,gBAAgB,GAC/C,EAAG,0BAA0B,cAAc,CACxC;QACR,EAAU,aACT,kBAAC,UAAD;KACE,MAAK;KACL,eAAe,EAAW,QAAQ;KAClC,WAAU;eAET,EAAG,+BAA+B,YAAY;KACxC,CAAA,CAEP;;GACF;MA7GJ,kBAAC,KAAD;EAAG,WAAU;YACV,EAAG,iCAAiC,gDAAgD;EACnF,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
import { CooOrderCheckout } from '../types';
|
|
3
|
+
|
|
4
|
+
interface PayForOrderProps {
|
|
5
|
+
checkout: CooOrderCheckout;
|
|
6
|
+
/** Ask the backend to settle the order against billing; called after every attempt. */
|
|
7
|
+
onSettle: () => Promise<void>;
|
|
8
|
+
}
|
|
9
|
+
export declare const PayForOrder: FC<PayForOrderProps>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=PayForOrder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayForOrder.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/components/PayForOrder.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,EAAE,EAA+B,MAAM,OAAO,CAAC;AAG7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAUjD,UAAU,gBAAgB;IACxB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,uFAAuF;IACvF,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/B;AAuGD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2D5C,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { useTr as e } from "../hooks/useTr.js";
|
|
2
|
+
import "../hooks/index.js";
|
|
3
|
+
import { formatPrice as t } from "../utils/formatters.js";
|
|
4
|
+
import { loadStripe as n, openRazorpayCheckout as r } from "../utils/paymentProviders.js";
|
|
5
|
+
import { useEffect as i, useRef as a, useState as o } from "react";
|
|
6
|
+
import { CreditCard as s, Loader2 as c, Lock as l } from "lucide-react";
|
|
7
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
8
|
+
//#region src/coolandlovely/components/PayForOrder.tsx
|
|
9
|
+
var f = "inline-flex items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50";
|
|
10
|
+
function p(e) {
|
|
11
|
+
return window.getComputedStyle(document.documentElement).getPropertyValue(e).trim() || void 0;
|
|
12
|
+
}
|
|
13
|
+
var m = ({ checkout: r, onSettle: s, publishableKey: m, clientSecret: h }) => {
|
|
14
|
+
let g = e(), _ = a(null), v = a(null), y = a(null), [b, x] = o(!1), [S, C] = o(!1), [w, T] = o(!1), [E, D] = o(null);
|
|
15
|
+
i(() => {
|
|
16
|
+
let e = !1;
|
|
17
|
+
return n(m).then((t) => {
|
|
18
|
+
if (e || !_.current) return;
|
|
19
|
+
v.current = t;
|
|
20
|
+
let n = t.elements().create("card", { style: {
|
|
21
|
+
base: {
|
|
22
|
+
fontSize: "16px",
|
|
23
|
+
color: p("--color-text-primary"),
|
|
24
|
+
iconColor: p("--color-text-secondary"),
|
|
25
|
+
"::placeholder": { color: p("--color-text-secondary") }
|
|
26
|
+
},
|
|
27
|
+
invalid: { color: p("--color-status-error-text") }
|
|
28
|
+
} });
|
|
29
|
+
n.on("change", (e) => {
|
|
30
|
+
C(e.complete), D(e.error?.message ?? null);
|
|
31
|
+
}), n.mount(_.current), y.current = n, x(!0);
|
|
32
|
+
}).catch((t) => {
|
|
33
|
+
e || D(t instanceof Error ? t.message : String(t));
|
|
34
|
+
}), () => {
|
|
35
|
+
e = !0, y.current?.destroy(), y.current = null;
|
|
36
|
+
};
|
|
37
|
+
}, [m]);
|
|
38
|
+
let O = async () => {
|
|
39
|
+
let e = v.current, t = y.current;
|
|
40
|
+
if (!(!e || !t)) {
|
|
41
|
+
T(!0), D(null);
|
|
42
|
+
try {
|
|
43
|
+
let n = await e.confirmCardPayment(h, { payment_method: { card: t } });
|
|
44
|
+
n.error && D(n.error.message ?? g("coolandlovely.checkout.payFailed", "The payment did not go through.")), await s();
|
|
45
|
+
} finally {
|
|
46
|
+
T(!1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return /* @__PURE__ */ d("div", {
|
|
51
|
+
className: "space-y-3",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ u("div", {
|
|
54
|
+
ref: _,
|
|
55
|
+
"data-testid": "stripe-card-element",
|
|
56
|
+
className: "rounded-lg border border-border-seam bg-bg-surface px-3 py-3"
|
|
57
|
+
}),
|
|
58
|
+
E && /* @__PURE__ */ u("p", {
|
|
59
|
+
className: "text-sm text-status-error-text",
|
|
60
|
+
children: E
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ d("button", {
|
|
63
|
+
type: "button",
|
|
64
|
+
className: f,
|
|
65
|
+
disabled: !b || !S || w,
|
|
66
|
+
onClick: () => void O(),
|
|
67
|
+
children: [w ? /* @__PURE__ */ u(c, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ u(l, { className: "h-4 w-4" }), g("coolandlovely.checkout.payAmount", "Pay {{amount}}", { amount: t(r.total, r.currency) })]
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
}, h = ({ checkout: n, onSettle: i }) => {
|
|
72
|
+
let a = e(), [l, p] = o(!1), [h, g] = o(null);
|
|
73
|
+
if (n.clientSecret && n.stripePublishableKey) return /* @__PURE__ */ u(m, {
|
|
74
|
+
checkout: n,
|
|
75
|
+
onSettle: i,
|
|
76
|
+
publishableKey: n.stripePublishableKey,
|
|
77
|
+
clientSecret: n.clientSecret
|
|
78
|
+
});
|
|
79
|
+
if (n.providerOrderId && n.razorpayKeyId) {
|
|
80
|
+
let { providerOrderId: e, razorpayKeyId: o } = n, m = async () => {
|
|
81
|
+
p(!0), g(null);
|
|
82
|
+
try {
|
|
83
|
+
await r({
|
|
84
|
+
keyId: o,
|
|
85
|
+
providerOrderId: e,
|
|
86
|
+
total: n.total,
|
|
87
|
+
currency: n.currency,
|
|
88
|
+
description: a("coolandlovely.checkout.orderLabel", "Order {{number}}", { number: n.order.orderNumber })
|
|
89
|
+
}), await i();
|
|
90
|
+
} catch (e) {
|
|
91
|
+
g(e instanceof Error ? e.message : String(e));
|
|
92
|
+
} finally {
|
|
93
|
+
p(!1);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return /* @__PURE__ */ d("div", {
|
|
97
|
+
className: "space-y-3",
|
|
98
|
+
children: [h && /* @__PURE__ */ u("p", {
|
|
99
|
+
className: "text-sm text-status-error-text",
|
|
100
|
+
children: h
|
|
101
|
+
}), /* @__PURE__ */ d("button", {
|
|
102
|
+
type: "button",
|
|
103
|
+
className: f,
|
|
104
|
+
disabled: l,
|
|
105
|
+
onClick: () => void m(),
|
|
106
|
+
children: [l ? /* @__PURE__ */ u(c, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ u(s, { className: "h-4 w-4" }), a("coolandlovely.checkout.payAmount", "Pay {{amount}}", { amount: t(n.total, n.currency) })]
|
|
107
|
+
})]
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return /* @__PURE__ */ u("p", {
|
|
111
|
+
className: "rounded-lg border border-border-seam bg-bg-sunken p-3 text-sm text-text-secondary",
|
|
112
|
+
children: a("coolandlovely.checkout.providerUnavailable", "Online payment is not available for this order right now. Your order is saved — try again from My Orders.")
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
//#endregion
|
|
116
|
+
export { h as PayForOrder };
|
|
117
|
+
|
|
118
|
+
//# sourceMappingURL=PayForOrder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PayForOrder.js","names":[],"sources":["../../../src/coolandlovely/components/PayForOrder.tsx"],"sourcesContent":["/**\n * PayForOrder — collects the payment for an order through the provider global-billing chose.\n * @module coolandlovely/components\n *\n * Razorpay: opens Razorpay's checkout widget for the billing-created order.\n * Stripe: mounts a Stripe card element and confirms the billing-issued client secret.\n * Whatever the provider reports, the order is only marked paid by `onSettle`, which asks the\n * backend to re-read billing's payment record (BOFF-3370).\n */\n\nimport { type FC, useEffect, useRef, useState } from 'react';\nimport { CreditCard, Loader2, Lock } from 'lucide-react';\n\nimport type { CooOrderCheckout } from '../types';\nimport { formatPrice } from '../utils/formatters';\nimport {\n type StripeCardElement,\n type StripeInstance,\n loadStripe,\n openRazorpayCheckout,\n} from '../utils/paymentProviders';\nimport { useTr } from '../hooks';\n\ninterface PayForOrderProps {\n checkout: CooOrderCheckout;\n /** Ask the backend to settle the order against billing; called after every attempt. */\n onSettle: () => Promise<void>;\n}\n\nconst primaryButton =\n 'inline-flex items-center justify-center gap-2 rounded-lg bg-action-primary-bg px-4 py-2.5 text-sm font-semibold text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:opacity-50';\n\n/** Read a semantic colour token so the Stripe iframe matches the current theme. */\nfunction cssToken(name: string): string | undefined {\n const value = window.getComputedStyle(document.documentElement).getPropertyValue(name).trim();\n return value || undefined;\n}\n\nconst StripeCardForm: FC<PayForOrderProps & { publishableKey: string; clientSecret: string }> = ({\n checkout,\n onSettle,\n publishableKey,\n clientSecret,\n}) => {\n const tr = useTr();\n const mountRef = useRef<HTMLDivElement | null>(null);\n const stripeRef = useRef<StripeInstance | null>(null);\n const cardRef = useRef<StripeCardElement | null>(null);\n const [ready, setReady] = useState(false);\n const [complete, setComplete] = useState(false);\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n useEffect(() => {\n let cancelled = false;\n loadStripe(publishableKey)\n .then((stripe) => {\n if (cancelled || !mountRef.current) return;\n stripeRef.current = stripe;\n const card = stripe.elements().create('card', {\n style: {\n base: {\n fontSize: '16px',\n color: cssToken('--color-text-primary'),\n iconColor: cssToken('--color-text-secondary'),\n '::placeholder': { color: cssToken('--color-text-secondary') },\n },\n invalid: { color: cssToken('--color-status-error-text') },\n },\n });\n card.on('change', (event) => {\n setComplete(event.complete);\n setError(event.error?.message ?? null);\n });\n card.mount(mountRef.current);\n cardRef.current = card;\n setReady(true);\n })\n .catch((err: unknown) => {\n if (!cancelled) setError(err instanceof Error ? err.message : String(err));\n });\n return () => {\n cancelled = true;\n cardRef.current?.destroy();\n cardRef.current = null;\n };\n }, [publishableKey]);\n\n const pay = async () => {\n const stripe = stripeRef.current;\n const card = cardRef.current;\n if (!stripe || !card) return;\n setBusy(true);\n setError(null);\n try {\n const result = await stripe.confirmCardPayment(clientSecret, { payment_method: { card } });\n if (result.error)\n setError(\n result.error.message ??\n tr('coolandlovely.checkout.payFailed', 'The payment did not go through.')\n );\n await onSettle();\n } finally {\n setBusy(false);\n }\n };\n\n return (\n <div className=\"space-y-3\">\n <div\n ref={mountRef}\n data-testid=\"stripe-card-element\"\n className=\"rounded-lg border border-border-seam bg-bg-surface px-3 py-3\"\n />\n {error && <p className=\"text-sm text-status-error-text\">{error}</p>}\n <button\n type=\"button\"\n className={primaryButton}\n disabled={!ready || !complete || busy}\n onClick={() => void pay()}\n >\n {busy ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <Lock className=\"h-4 w-4\" />}\n {tr('coolandlovely.checkout.payAmount', 'Pay {{amount}}', {\n amount: formatPrice(checkout.total, checkout.currency),\n })}\n </button>\n </div>\n );\n};\n\nexport const PayForOrder: FC<PayForOrderProps> = ({ checkout, onSettle }) => {\n const tr = useTr();\n const [busy, setBusy] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n if (checkout.clientSecret && checkout.stripePublishableKey) {\n return (\n <StripeCardForm\n checkout={checkout}\n onSettle={onSettle}\n publishableKey={checkout.stripePublishableKey}\n clientSecret={checkout.clientSecret}\n />\n );\n }\n\n if (checkout.providerOrderId && checkout.razorpayKeyId) {\n const { providerOrderId, razorpayKeyId } = checkout;\n const pay = async () => {\n setBusy(true);\n setError(null);\n try {\n await openRazorpayCheckout({\n keyId: razorpayKeyId,\n providerOrderId,\n total: checkout.total,\n currency: checkout.currency,\n description: tr('coolandlovely.checkout.orderLabel', 'Order {{number}}', {\n number: checkout.order.orderNumber,\n }),\n });\n await onSettle();\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err));\n } finally {\n setBusy(false);\n }\n };\n return (\n <div className=\"space-y-3\">\n {error && <p className=\"text-sm text-status-error-text\">{error}</p>}\n <button type=\"button\" className={primaryButton} disabled={busy} onClick={() => void pay()}>\n {busy ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <CreditCard className=\"h-4 w-4\" />}\n {tr('coolandlovely.checkout.payAmount', 'Pay {{amount}}', {\n amount: formatPrice(checkout.total, checkout.currency),\n })}\n </button>\n </div>\n );\n }\n\n return (\n <p className=\"rounded-lg border border-border-seam bg-bg-sunken p-3 text-sm text-text-secondary\">\n {tr(\n 'coolandlovely.checkout.providerUnavailable',\n 'Online payment is not available for this order right now. Your order is saved — try again from My Orders.'\n )}\n </p>\n );\n};\n"],"mappings":";;;;;;;;AA6BA,IAAM,IACJ;AAGF,SAAS,EAAS,GAAkC;AAElD,QADc,OAAO,iBAAiB,SAAS,gBAAgB,CAAC,iBAAiB,EAAK,CAAC,MAAM,IAC7E,KAAA;;AAGlB,IAAM,KAA2F,EAC/F,aACA,aACA,mBACA,sBACI;CACJ,IAAM,IAAK,GAAO,EACZ,IAAW,EAA8B,KAAK,EAC9C,IAAY,EAA8B,KAAK,EAC/C,IAAU,EAAiC,KAAK,EAChD,CAAC,GAAO,KAAY,EAAS,GAAM,EACnC,CAAC,GAAU,KAAe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IAAM,eAAe,KAAK,GAAK;cAAzF,CACG,IAAO,kBAAC,GAAD,EAAS,WAAU,wBAAyB,CAAA,GAAG,kBAAC,GAAD,EAAY,WAAU,WAAY,CAAA,EACxF,EAAG,oCAAoC,kBAAkB,EACxD,QAAQ,EAAY,EAAS,OAAO,EAAS,SAAS,EACvD,CAAC,CACK;MACL;;;AAIV,QACE,kBAAC,KAAD;EAAG,WAAU;YACV,EACC,8CACA,4GACD;EACC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/components/StatusBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"StatusBadge.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/components/StatusBadge.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAIhC,UAAU,gBAAgB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AA4GD,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA2B5C,CAAC"}
|
|
@@ -41,6 +41,10 @@ var i = {
|
|
|
41
41
|
wishlist: "info",
|
|
42
42
|
purchased_on_platform: "success",
|
|
43
43
|
gifted: "warning",
|
|
44
|
+
pending_payment: "warning",
|
|
45
|
+
paid: "success",
|
|
46
|
+
pending: "secondary",
|
|
47
|
+
synced: "success",
|
|
44
48
|
inactive: "secondary",
|
|
45
49
|
error: "destructive",
|
|
46
50
|
failed: "destructive",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/coolandlovely/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module coolandlovely/components\n *\n * A colored badge based on status value with semantic color mapping\n * for various order, cart, and investment statuses.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-accent-blue-subtle text-accent-blue',\n outline: 'border border-border-seam text-text-primary',\n};\n\nconst dotStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-text',\n warning: 'bg-status-warning-text',\n destructive: 'bg-status-error-text',\n secondary: 'bg-text-secondary',\n info: 'bg-accent-blue',\n outline: 'bg-text-secondary',\n};\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Brand lifecycle\n draft: 'secondary',\n pending_review: 'warning',\n published: 'success',\n suspended: 'destructive',\n archived: 'outline',\n\n // Collection lifecycle\n scheduled: 'info',\n live: 'success',\n ended: 'outline',\n\n // Style item status\n active: 'success',\n out_of_stock: 'warning',\n retired: 'outline',\n\n // Collaboration lifecycle\n proposed: 'secondary',\n accepted: 'info',\n in_progress: 'warning',\n declined: 'destructive',\n cancelled: 'destructive',\n\n // Visibility\n public: 'success',\n followers: 'info',\n private: 'secondary',\n\n // Wardrobe source\n owned: 'success',\n wishlist: 'info',\n purchased_on_platform: 'success',\n gifted: 'warning',\n\n // Generic\n inactive: 'secondary',\n error: 'destructive',\n failed: 'destructive',\n completed: 'success',\n};\n\n/** Statuses that represent a live/active state get a calm opacity pulse on the dot. */\nconst liveStatuses = new Set(['live', 'published', 'active', 'in_progress']);\n\nconst STATUS_LABEL_KEYS: Record<string, string> = {\n draft: 'coolandlovely.status.draft',\n pending_review: 'coolandlovely.status.pendingReview',\n published: 'coolandlovely.status.published',\n suspended: 'coolandlovely.status.suspended',\n archived: 'coolandlovely.status.archived',\n scheduled: 'coolandlovely.status.scheduled',\n live: 'coolandlovely.status.live',\n ended: 'coolandlovely.status.ended',\n active: 'coolandlovely.status.active',\n out_of_stock: 'coolandlovely.status.outOfStock',\n retired: 'coolandlovely.status.retired',\n proposed: 'coolandlovely.status.proposed',\n accepted: 'coolandlovely.status.accepted',\n in_progress: 'coolandlovely.status.inProgress',\n declined: 'coolandlovely.status.declined',\n cancelled: 'coolandlovely.status.cancelled',\n public: 'coolandlovely.status.public',\n followers: 'coolandlovely.status.followers',\n private: 'coolandlovely.status.private',\n owned: 'coolandlovely.status.owned',\n wishlist: 'coolandlovely.status.wishlist',\n purchased_on_platform: 'coolandlovely.status.purchasedOnPlatform',\n gifted: 'coolandlovely.status.gifted',\n inactive: 'coolandlovely.status.inactive',\n error: 'coolandlovely.status.error',\n failed: 'coolandlovely.status.failed',\n completed: 'coolandlovely.status.completed',\n};\n\nfunction formatStatusLabel(status: string): string {\n return status.replace(/_/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const tr = useTr();\n const key = status.toLowerCase();\n const variant = statusVariantMap[key] || 'secondary';\n const isLive = liveStatuses.has(key);\n const labelKey = STATUS_LABEL_KEYS[key];\n const label = labelKey ? tr(labelKey, formatStatusLabel(status)) : formatStatusLabel(status);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'h-1.5 w-1.5 rounded-full',\n dotStyles[variant],\n isLive && 'motion-safe:animate-vc-glow-pulse'\n )}\n />\n {label}\n </span>\n );\n};\n"],"mappings":";;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G,EAAkB,EAAO;AAE5F,QACE,kBAAC,QAAD;EACE,WAAW,EACT,mFACA,EAAc,IACd,EACD;YALH,CAOE,kBAAC,QAAD;GACE,eAAY;GACZ,WAAW,EACT,4BACA,EAAU,IACV,KAAU,oCACX;GACD,CAAA,EACD,EACI"}
|
|
1
|
+
{"version":3,"file":"StatusBadge.js","names":[],"sources":["../../../src/coolandlovely/components/StatusBadge.tsx"],"sourcesContent":["/**\n * Status Badge Component\n * @module coolandlovely/components\n *\n * A colored badge based on status value with semantic color mapping\n * for various order, cart, and investment statuses.\n */\n\nimport type { FC } from 'react';\nimport { cn } from '../utils/cn';\nimport { useTr } from '../hooks';\n\ninterface StatusBadgeProps {\n status: string;\n className?: string;\n}\n\ntype BadgeVariant = 'success' | 'warning' | 'destructive' | 'secondary' | 'info' | 'outline';\n\nconst variantStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-bg-subtle text-status-success-text',\n warning: 'bg-status-warning-bg-subtle text-status-warning-text',\n destructive: 'bg-status-error-bg-subtle text-status-error-text',\n secondary: 'bg-bg-sunken text-text-secondary',\n info: 'bg-accent-blue-subtle text-accent-blue',\n outline: 'border border-border-seam text-text-primary',\n};\n\nconst dotStyles: Record<BadgeVariant, string> = {\n success: 'bg-status-success-text',\n warning: 'bg-status-warning-text',\n destructive: 'bg-status-error-text',\n secondary: 'bg-text-secondary',\n info: 'bg-accent-blue',\n outline: 'bg-text-secondary',\n};\n\nconst statusVariantMap: Record<string, BadgeVariant> = {\n // Brand lifecycle\n draft: 'secondary',\n pending_review: 'warning',\n published: 'success',\n suspended: 'destructive',\n archived: 'outline',\n\n // Collection lifecycle\n scheduled: 'info',\n live: 'success',\n ended: 'outline',\n\n // Style item status\n active: 'success',\n out_of_stock: 'warning',\n retired: 'outline',\n\n // Collaboration lifecycle\n proposed: 'secondary',\n accepted: 'info',\n in_progress: 'warning',\n declined: 'destructive',\n cancelled: 'destructive',\n\n // Visibility\n public: 'success',\n followers: 'info',\n private: 'secondary',\n\n // Wardrobe source\n owned: 'success',\n wishlist: 'info',\n purchased_on_platform: 'success',\n gifted: 'warning',\n\n // Orders + creator commissions (BOFF-3370)\n pending_payment: 'warning',\n paid: 'success',\n pending: 'secondary',\n synced: 'success',\n\n // Generic\n inactive: 'secondary',\n error: 'destructive',\n failed: 'destructive',\n completed: 'success',\n};\n\n/** Statuses that represent a live/active state get a calm opacity pulse on the dot. */\nconst liveStatuses = new Set(['live', 'published', 'active', 'in_progress']);\n\nconst STATUS_LABEL_KEYS: Record<string, string> = {\n draft: 'coolandlovely.status.draft',\n pending_review: 'coolandlovely.status.pendingReview',\n published: 'coolandlovely.status.published',\n suspended: 'coolandlovely.status.suspended',\n archived: 'coolandlovely.status.archived',\n scheduled: 'coolandlovely.status.scheduled',\n live: 'coolandlovely.status.live',\n ended: 'coolandlovely.status.ended',\n active: 'coolandlovely.status.active',\n out_of_stock: 'coolandlovely.status.outOfStock',\n retired: 'coolandlovely.status.retired',\n proposed: 'coolandlovely.status.proposed',\n accepted: 'coolandlovely.status.accepted',\n in_progress: 'coolandlovely.status.inProgress',\n declined: 'coolandlovely.status.declined',\n cancelled: 'coolandlovely.status.cancelled',\n public: 'coolandlovely.status.public',\n followers: 'coolandlovely.status.followers',\n private: 'coolandlovely.status.private',\n owned: 'coolandlovely.status.owned',\n wishlist: 'coolandlovely.status.wishlist',\n purchased_on_platform: 'coolandlovely.status.purchasedOnPlatform',\n gifted: 'coolandlovely.status.gifted',\n inactive: 'coolandlovely.status.inactive',\n error: 'coolandlovely.status.error',\n failed: 'coolandlovely.status.failed',\n completed: 'coolandlovely.status.completed',\n};\n\nfunction formatStatusLabel(status: string): string {\n return status.replace(/_/g, ' ').replace(/\\b\\w/g, (char) => char.toUpperCase());\n}\n\nexport const StatusBadge: FC<StatusBadgeProps> = ({ status, className }) => {\n const tr = useTr();\n const key = status.toLowerCase();\n const variant = statusVariantMap[key] || 'secondary';\n const isLive = liveStatuses.has(key);\n const labelKey = STATUS_LABEL_KEYS[key];\n const label = labelKey ? tr(labelKey, formatStatusLabel(status)) : formatStatusLabel(status);\n\n return (\n <span\n className={cn(\n 'inline-flex items-center gap-1.5 rounded-full px-2.5 py-0.5 text-xs font-medium',\n variantStyles[variant],\n className\n )}\n >\n <span\n aria-hidden=\"true\"\n className={cn(\n 'h-1.5 w-1.5 rounded-full',\n dotStyles[variant],\n isLive && 'motion-safe:animate-vc-glow-pulse'\n )}\n />\n {label}\n </span>\n );\n};\n"],"mappings":";;;;;AAmBA,IAAM,IAA8C;CAClD,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;CACV,EAEK,IAA0C;CAC9C,SAAS;CACT,SAAS;CACT,aAAa;CACb,WAAW;CACX,MAAM;CACN,SAAS;CACV,EAEK,IAAiD;CAErD,OAAO;CACP,gBAAgB;CAChB,WAAW;CACX,WAAW;CACX,UAAU;CAGV,WAAW;CACX,MAAM;CACN,OAAO;CAGP,QAAQ;CACR,cAAc;CACd,SAAS;CAGT,UAAU;CACV,UAAU;CACV,aAAa;CACb,UAAU;CACV,WAAW;CAGX,QAAQ;CACR,WAAW;CACX,SAAS;CAGT,OAAO;CACP,UAAU;CACV,uBAAuB;CACvB,QAAQ;CAGR,iBAAiB;CACjB,MAAM;CACN,SAAS;CACT,QAAQ;CAGR,UAAU;CACV,OAAO;CACP,QAAQ;CACR,WAAW;CACZ,EAGK,IAAe,IAAI,IAAI;CAAC;CAAQ;CAAa;CAAU;CAAc,CAAC,EAEtE,IAA4C;CAChD,OAAO;CACP,gBAAgB;CAChB,WAAW;CACX,WAAW;CACX,UAAU;CACV,WAAW;CACX,MAAM;CACN,OAAO;CACP,QAAQ;CACR,cAAc;CACd,SAAS;CACT,UAAU;CACV,UAAU;CACV,aAAa;CACb,UAAU;CACV,WAAW;CACX,QAAQ;CACR,WAAW;CACX,SAAS;CACT,OAAO;CACP,UAAU;CACV,uBAAuB;CACvB,QAAQ;CACR,UAAU;CACV,OAAO;CACP,QAAQ;CACR,WAAW;CACZ;AAED,SAAS,EAAkB,GAAwB;AACjD,QAAO,EAAO,QAAQ,MAAM,IAAI,CAAC,QAAQ,UAAU,MAAS,EAAK,aAAa,CAAC;;AAGjF,IAAa,KAAqC,EAAE,WAAQ,mBAAgB;CAC1E,IAAM,IAAK,GAAO,EACZ,IAAM,EAAO,aAAa,EAC1B,IAAU,EAAiB,MAAQ,aACnC,IAAS,EAAa,IAAI,EAAI,EAC9B,IAAW,EAAkB,IAC7B,IAAQ,IAAW,EAAG,GAAU,EAAkB,EAAO,CAAC,GAAG,EAAkB,EAAO;AAE5F,QACE,kBAAC,QAAD;EACE,WAAW,EACT,mFACA,EAAc,IACd,EACD;YALH,CAOE,kBAAC,QAAD;GACE,eAAY;GACZ,WAAW,EACT,4BACA,EAAU,IACV,KAAU,oCACX;GACD,CAAA,EACD,EACI"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { CooAddToCartInput, CooCart, CooCheckoutInput, CooCreatorEarningConnection, CooCreatorEarningsSummary, CooCreatorPayout, CooOrder, CooOrderCheckout, CooOrderConnection, CooOrderStatus } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const useMyCart: () => import('@tanstack/react-query').UseQueryResult<NoInfer<CooCart>, Error>;
|
|
4
|
+
export declare const useAddToCart: () => import('@tanstack/react-query').UseMutationResult<CooCart, Error, {
|
|
5
|
+
input: CooAddToCartInput;
|
|
6
|
+
}, unknown>;
|
|
7
|
+
export declare const useUpdateCartItem: () => import('@tanstack/react-query').UseMutationResult<CooCart, Error, {
|
|
8
|
+
id: string;
|
|
9
|
+
quantity: number;
|
|
10
|
+
}, unknown>;
|
|
11
|
+
export declare const useRemoveCartItem: () => import('@tanstack/react-query').UseMutationResult<CooCart, Error, {
|
|
12
|
+
id: string;
|
|
13
|
+
}, unknown>;
|
|
14
|
+
export declare const useMyOrders: (status?: CooOrderStatus) => import('@tanstack/react-query').UseQueryResult<NoInfer<CooOrderConnection>, Error>;
|
|
15
|
+
export declare const useMyOrder: (id: string | undefined) => import('@tanstack/react-query').UseQueryResult<NoInfer<CooOrder | null>, Error>;
|
|
16
|
+
export declare const useCheckout: () => import('@tanstack/react-query').UseMutationResult<CooOrderCheckout, Error, CooCheckoutInput, unknown>;
|
|
17
|
+
export declare const useResumeOrderPayment: () => import('@tanstack/react-query').UseMutationResult<CooOrderCheckout, Error, string, unknown>;
|
|
18
|
+
export declare const useSyncOrderPayment: () => import('@tanstack/react-query').UseMutationResult<CooOrder, Error, string, unknown>;
|
|
19
|
+
export declare const useCancelOrder: () => import('@tanstack/react-query').UseMutationResult<CooOrder, Error, string, unknown>;
|
|
20
|
+
export declare const useMyCreatorEarnings: () => import('@tanstack/react-query').UseQueryResult<NoInfer<CooCreatorEarningConnection>, Error>;
|
|
21
|
+
export declare const useMyCreatorEarningsSummary: () => import('@tanstack/react-query').UseQueryResult<NoInfer<CooCreatorEarningsSummary>, Error>;
|
|
22
|
+
export declare const useRequestCreatorPayout: () => import('@tanstack/react-query').UseMutationResult<CooCreatorPayout, Error, {
|
|
23
|
+
amount: number;
|
|
24
|
+
currency: string;
|
|
25
|
+
notes?: string | null;
|
|
26
|
+
}, unknown>;
|
|
27
|
+
//# sourceMappingURL=useCommerceApi.d.ts.map
|
|
@@ -0,0 +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,2BAA2B,EAC3B,yBAAyB,EACzB,gBAAgB,EAChB,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,cAAc,EACf,MAAM,UAAU,CAAC;AA+BlB,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;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"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { coolQuery as t } from "./useCoolAndLovelyApi.js";
|
|
4
|
+
import { useMutation as n, useQuery as r, useQueryClient as i } from "@tanstack/react-query";
|
|
5
|
+
//#region src/coolandlovely/hooks/useCommerceApi.ts
|
|
6
|
+
var a = "coolandlovely", o = "\n items {\n id styleItemId quantity size colour lookId unitPrice currency lineTotal isPurchasable\n styleItem { id name status image { id } brand { id name } }\n }\n itemCount subtotal currency canCheckout blockedReason\n", s = "\n id orderNumber status currency subtotal taxAmount total itemCount\n shippingName shippingAddress buyerNote paymentProvider paidAt cancelledAt createdAt updatedAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n", c = `
|
|
7
|
+
order { ${s} }
|
|
8
|
+
provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency
|
|
9
|
+
`, l = () => {
|
|
10
|
+
let { apiGatewayUrl: n } = e();
|
|
11
|
+
return r({
|
|
12
|
+
queryKey: [a, "cart"],
|
|
13
|
+
queryFn: async () => (await t(`query CooMyCart { cooMyCart { ${o} } }`, {}, n)).cooMyCart
|
|
14
|
+
});
|
|
15
|
+
}, u = (r, o) => {
|
|
16
|
+
let { apiGatewayUrl: s } = e(), c = i();
|
|
17
|
+
return n({
|
|
18
|
+
mutationFn: async (e) => {
|
|
19
|
+
let n = (await t(r, e, s))[o];
|
|
20
|
+
if (!n) throw Error("The cart could not be updated");
|
|
21
|
+
return n;
|
|
22
|
+
},
|
|
23
|
+
onSuccess: (e) => {
|
|
24
|
+
c.setQueryData([a, "cart"], e);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}, d = () => u(`mutation CooAddToCart($input: CooAddToCartInput!) { cooAddToCart(input: $input) { ${o} } }`, "cooAddToCart"), f = () => u(`mutation CooUpdateCartItem($id: ID!, $quantity: Int!) {
|
|
28
|
+
cooUpdateCartItem(id: $id, quantity: $quantity) { ${o} }
|
|
29
|
+
}`, "cooUpdateCartItem"), p = () => u(`mutation CooRemoveCartItem($id: ID!) { cooRemoveCartItem(id: $id) { ${o} } }`, "cooRemoveCartItem"), m = (n) => {
|
|
30
|
+
let { apiGatewayUrl: i } = e();
|
|
31
|
+
return r({
|
|
32
|
+
queryKey: [
|
|
33
|
+
a,
|
|
34
|
+
"orders",
|
|
35
|
+
n ?? "ALL"
|
|
36
|
+
],
|
|
37
|
+
queryFn: async () => (await t(`query CooMyOrders($status: CooOrderStatus, $pagination: PaginationInput) {
|
|
38
|
+
cooMyOrders(status: $status, pagination: $pagination) {
|
|
39
|
+
items { ${s} }
|
|
40
|
+
pageInfo { cursor hasMore }
|
|
41
|
+
}
|
|
42
|
+
}`, {
|
|
43
|
+
status: n,
|
|
44
|
+
pagination: {
|
|
45
|
+
limit: 50,
|
|
46
|
+
offset: 0
|
|
47
|
+
}
|
|
48
|
+
}, i)).cooMyOrders
|
|
49
|
+
});
|
|
50
|
+
}, h = (n) => {
|
|
51
|
+
let { apiGatewayUrl: i } = e();
|
|
52
|
+
return r({
|
|
53
|
+
queryKey: [
|
|
54
|
+
a,
|
|
55
|
+
"order",
|
|
56
|
+
n
|
|
57
|
+
],
|
|
58
|
+
enabled: !!n,
|
|
59
|
+
queryFn: async () => (await t(`query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${s} } }`, { id: n }, i)).cooMyOrder
|
|
60
|
+
});
|
|
61
|
+
}, g = () => {
|
|
62
|
+
let e = i();
|
|
63
|
+
return (t) => {
|
|
64
|
+
e.setQueryData([
|
|
65
|
+
a,
|
|
66
|
+
"order",
|
|
67
|
+
t.id
|
|
68
|
+
], t), e.invalidateQueries({ queryKey: [a, "orders"] }), e.invalidateQueries({ queryKey: [a, "cart"] });
|
|
69
|
+
};
|
|
70
|
+
}, _ = () => {
|
|
71
|
+
let { apiGatewayUrl: r } = e(), i = g();
|
|
72
|
+
return n({
|
|
73
|
+
mutationFn: async (e) => (await t(`mutation CooCheckout($input: CooCheckoutInput!) { cooCheckout(input: $input) { ${c} } }`, { input: e }, r)).cooCheckout,
|
|
74
|
+
onSuccess: (e) => i(e.order)
|
|
75
|
+
});
|
|
76
|
+
}, v = () => {
|
|
77
|
+
let { apiGatewayUrl: r } = e(), i = g();
|
|
78
|
+
return n({
|
|
79
|
+
mutationFn: async (e) => (await t(`mutation CooResumeOrderPayment($id: ID!) { cooResumeOrderPayment(id: $id) { ${c} } }`, { id: e }, r)).cooResumeOrderPayment,
|
|
80
|
+
onSuccess: (e) => i(e.order)
|
|
81
|
+
});
|
|
82
|
+
}, y = () => {
|
|
83
|
+
let { apiGatewayUrl: r } = e();
|
|
84
|
+
return n({
|
|
85
|
+
mutationFn: async (e) => (await t(`mutation CooSyncOrderPayment($id: ID!) { cooSyncOrderPayment(id: $id) { ${s} } }`, { id: e }, r)).cooSyncOrderPayment,
|
|
86
|
+
onSuccess: g()
|
|
87
|
+
});
|
|
88
|
+
}, b = () => {
|
|
89
|
+
let { apiGatewayUrl: r } = e();
|
|
90
|
+
return n({
|
|
91
|
+
mutationFn: async (e) => (await t(`mutation CooCancelOrder($id: ID!) { cooCancelOrder(id: $id) { ${s} } }`, { id: e }, r)).cooCancelOrder,
|
|
92
|
+
onSuccess: g()
|
|
93
|
+
});
|
|
94
|
+
}, x = () => {
|
|
95
|
+
let { apiGatewayUrl: n } = e();
|
|
96
|
+
return r({
|
|
97
|
+
queryKey: [a, "creator-earnings"],
|
|
98
|
+
queryFn: async () => (await t("query CooMyCreatorEarnings($pagination: PaginationInput) {\n cooMyCreatorEarnings(pagination: $pagination) {\n items {\n id orderId orderNumber lookId collaborationId commissionRate saleAmount amount currency\n availableAt billingSyncStatus createdAt\n }\n pageInfo { cursor hasMore }\n }\n }", { pagination: {
|
|
99
|
+
limit: 50,
|
|
100
|
+
offset: 0
|
|
101
|
+
} }, n)).cooMyCreatorEarnings
|
|
102
|
+
});
|
|
103
|
+
}, S = () => {
|
|
104
|
+
let { apiGatewayUrl: n } = e();
|
|
105
|
+
return r({
|
|
106
|
+
queryKey: [a, "creator-earnings-summary"],
|
|
107
|
+
queryFn: async () => (await t("query CooMyCreatorEarningsSummary {\n cooMyCreatorEarningsSummary {\n commissionRate holdDays currency totalLifetimeAmount availableAmount pendingAmount\n reservedAmount paidAmount pendingPayoutCount unsyncedCount billingAvailable\n }\n }", {}, n)).cooMyCreatorEarningsSummary
|
|
108
|
+
});
|
|
109
|
+
}, C = () => {
|
|
110
|
+
let { apiGatewayUrl: r } = e(), o = i();
|
|
111
|
+
return n({
|
|
112
|
+
mutationFn: async (e) => (await t("mutation CooRequestCreatorPayout($input: CooRequestCreatorPayoutInput!) {\n cooRequestCreatorPayout(input: $input) { id status requestedAmount currency createdAt }\n }", { input: e }, r)).cooRequestCreatorPayout,
|
|
113
|
+
onSuccess: () => {
|
|
114
|
+
o.invalidateQueries({ queryKey: [a, "creator-earnings-summary"] });
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { d as useAddToCart, b as useCancelOrder, _ as useCheckout, l as useMyCart, x as useMyCreatorEarnings, S as useMyCreatorEarningsSummary, h as useMyOrder, m as useMyOrders, p as useRemoveCartItem, C as useRequestCreatorPayout, v as useResumeOrderPayment, y as useSyncOrderPayment, f as useUpdateCartItem };
|
|
120
|
+
|
|
121
|
+
//# sourceMappingURL=useCommerceApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommerceApi.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCommerceApi.ts"],"sourcesContent":["/**\n * Commerce API hooks (BOFF-3370)\n * @module coolandlovely/hooks\n *\n * React Query layer over the self-scoped commerce fields of `wspace-coolandlovely-svc`:\n * the shopper's cart, checkout and orders, and the creator's look commissions + payouts.\n * The client never decides that an order is paid — it opens the provider's checkout that\n * global-billing prepared and then asks the backend to settle against billing's record.\n */\n\nimport { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooAddToCartInput,\n CooCart,\n CooCheckoutInput,\n CooCreatorEarningConnection,\n CooCreatorEarningsSummary,\n CooCreatorPayout,\n CooOrder,\n CooOrderCheckout,\n CooOrderConnection,\n CooOrderStatus,\n} from '../types';\nimport { coolQuery } from './useCoolAndLovelyApi';\n\nconst QK = 'coolandlovely';\n\nconst CART_FIELDS = `\n items {\n id styleItemId quantity size colour lookId unitPrice currency lineTotal isPurchasable\n styleItem { id name status image { id } brand { id name } }\n }\n itemCount subtotal currency canCheckout blockedReason\n`;\n\nconst ORDER_FIELDS = `\n id orderNumber status currency subtotal taxAmount total itemCount\n shippingName shippingAddress buyerNote paymentProvider paidAt cancelledAt createdAt updatedAt\n items {\n id styleItemId brandId name sku image { id } size colour unitPrice quantity lineTotal\n lookId isCreatorAttributed\n }\n`;\n\nconst CHECKOUT_FIELDS = `\n order { ${ORDER_FIELDS} }\n provider providerOrderId razorpayKeyId clientSecret stripePublishableKey subtotal taxAmount total currency\n`;\n\n// ---------------------------------------------------------------------------\n// Cart\n// ---------------------------------------------------------------------------\n\nexport const useMyCart = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'cart'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCart: CooCart }>(\n `query CooMyCart { cooMyCart { ${CART_FIELDS} } }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyCart;\n },\n });\n};\n\n/** Every cart mutation answers with the fresh cart, which is written straight into the cache. */\nconst useCartMutation = <TVars>(document: string, field: string) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (variables: TVars) => {\n const data = await coolQuery<Record<string, CooCart>>(\n document,\n variables as Record<string, unknown>,\n apiGatewayUrl\n );\n const cart = data[field];\n if (!cart) throw new Error('The cart could not be updated');\n return cart;\n },\n onSuccess: (cart) => {\n queryClient.setQueryData([QK, 'cart'], cart);\n },\n });\n};\n\nexport const useAddToCart = () =>\n useCartMutation<{ input: CooAddToCartInput }>(\n `mutation CooAddToCart($input: CooAddToCartInput!) { cooAddToCart(input: $input) { ${CART_FIELDS} } }`,\n 'cooAddToCart'\n );\n\nexport const useUpdateCartItem = () =>\n useCartMutation<{ id: string; quantity: number }>(\n `mutation CooUpdateCartItem($id: ID!, $quantity: Int!) {\n cooUpdateCartItem(id: $id, quantity: $quantity) { ${CART_FIELDS} }\n }`,\n 'cooUpdateCartItem'\n );\n\nexport const useRemoveCartItem = () =>\n useCartMutation<{ id: string }>(\n `mutation CooRemoveCartItem($id: ID!) { cooRemoveCartItem(id: $id) { ${CART_FIELDS} } }`,\n 'cooRemoveCartItem'\n );\n\n// ---------------------------------------------------------------------------\n// Orders + checkout\n// ---------------------------------------------------------------------------\n\nexport const useMyOrders = (status?: CooOrderStatus) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'orders', status ?? 'ALL'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyOrders: CooOrderConnection }>(\n `query CooMyOrders($status: CooOrderStatus, $pagination: PaginationInput) {\n cooMyOrders(status: $status, pagination: $pagination) {\n items { ${ORDER_FIELDS} }\n pageInfo { cursor hasMore }\n }\n }`,\n { status, pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyOrders;\n },\n });\n};\n\nexport const useMyOrder = (id: string | undefined) => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'order', id],\n enabled: !!id,\n queryFn: async () => {\n const data = await coolQuery<{ cooMyOrder: CooOrder | null }>(\n `query CooMyOrder($id: ID!) { cooMyOrder(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooMyOrder;\n },\n });\n};\n\nconst useOrderInvalidation = () => {\n const queryClient = useQueryClient();\n return (order: CooOrder) => {\n queryClient.setQueryData([QK, 'order', order.id], order);\n void queryClient.invalidateQueries({ queryKey: [QK, 'orders'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'cart'] });\n };\n};\n\nexport const useCheckout = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (input: CooCheckoutInput) => {\n const data = await coolQuery<{ cooCheckout: CooOrderCheckout }>(\n `mutation CooCheckout($input: CooCheckoutInput!) { cooCheckout(input: $input) { ${CHECKOUT_FIELDS} } }`,\n { input },\n apiGatewayUrl\n );\n return data.cooCheckout;\n },\n onSuccess: (checkout) => settle(checkout.order),\n });\n};\n\nexport const useResumeOrderPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooResumeOrderPayment: CooOrderCheckout }>(\n `mutation CooResumeOrderPayment($id: ID!) { cooResumeOrderPayment(id: $id) { ${CHECKOUT_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooResumeOrderPayment;\n },\n onSuccess: (checkout) => settle(checkout.order),\n });\n};\n\nexport const useSyncOrderPayment = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooSyncOrderPayment: CooOrder }>(\n `mutation CooSyncOrderPayment($id: ID!) { cooSyncOrderPayment(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooSyncOrderPayment;\n },\n onSuccess: settle,\n });\n};\n\nexport const useCancelOrder = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const settle = useOrderInvalidation();\n return useMutation({\n mutationFn: async (id: string) => {\n const data = await coolQuery<{ cooCancelOrder: CooOrder }>(\n `mutation CooCancelOrder($id: ID!) { cooCancelOrder(id: $id) { ${ORDER_FIELDS} } }`,\n { id },\n apiGatewayUrl\n );\n return data.cooCancelOrder;\n },\n onSuccess: settle,\n });\n};\n\n// ---------------------------------------------------------------------------\n// Creator earnings + payouts\n// ---------------------------------------------------------------------------\n\nexport const useMyCreatorEarnings = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'creator-earnings'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCreatorEarnings: CooCreatorEarningConnection }>(\n `query CooMyCreatorEarnings($pagination: PaginationInput) {\n cooMyCreatorEarnings(pagination: $pagination) {\n items {\n id orderId orderNumber lookId collaborationId commissionRate saleAmount amount currency\n availableAt billingSyncStatus createdAt\n }\n pageInfo { cursor hasMore }\n }\n }`,\n { pagination: { limit: 50, offset: 0 } },\n apiGatewayUrl\n );\n return data.cooMyCreatorEarnings;\n },\n });\n};\n\nexport const useMyCreatorEarningsSummary = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useQuery({\n queryKey: [QK, 'creator-earnings-summary'],\n queryFn: async () => {\n const data = await coolQuery<{ cooMyCreatorEarningsSummary: CooCreatorEarningsSummary }>(\n `query CooMyCreatorEarningsSummary {\n cooMyCreatorEarningsSummary {\n commissionRate holdDays currency totalLifetimeAmount availableAmount pendingAmount\n reservedAmount paidAmount pendingPayoutCount unsyncedCount billingAvailable\n }\n }`,\n {},\n apiGatewayUrl\n );\n return data.cooMyCreatorEarningsSummary;\n },\n });\n};\n\nexport const useRequestCreatorPayout = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n const queryClient = useQueryClient();\n return useMutation({\n mutationFn: async (input: { amount: number; currency: string; notes?: string | null }) => {\n const data = await coolQuery<{ cooRequestCreatorPayout: CooCreatorPayout }>(\n `mutation CooRequestCreatorPayout($input: CooRequestCreatorPayoutInput!) {\n cooRequestCreatorPayout(input: $input) { id status requestedAmount currency createdAt }\n }`,\n { input },\n apiGatewayUrl\n );\n return data.cooRequestCreatorPayout;\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'creator-earnings-summary'] });\n },\n });\n};\n"],"mappings":";;;;;AA2BA,IAAM,IAAK,iBAEL,IAAc,2OAQd,IAAe,uTASf,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,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EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,2EAA2E,EAAa,OACxF,EAAE,OAAI,EACN,EACD,EACW;EAEd,WAVa,GAAsB;EAWpC,CAAC;GAGS,UAAuB;CAClC,IAAM,EAAE,qBAAkB,GAAkB;AAE5C,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,iEAAiE,EAAa,OAC9E,EAAE,OAAI,EACN,EACD,EACW;EAEd,WAVa,GAAsB;EAWpC,CAAC;GAOS,UAA6B;CACxC,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,mBAAmB;EAClC,SAAS,aACM,MAAM,EACjB,4XASA,EAAE,YAAY;GAAE,OAAO;GAAI,QAAQ;GAAG,EAAE,EACxC,EACD,EACW;EAEf,CAAC;GAGS,UAAoC;CAC/C,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAS;EACd,UAAU,CAAC,GAAI,2BAA2B;EAC1C,SAAS,aACM,MAAM,EACjB,iSAMA,EAAE,EACF,EACD,EACW;EAEf,CAAC;GAGS,UAAgC;CAC3C,IAAM,EAAE,qBAAkB,GAAkB,EACtC,IAAc,GAAgB;AACpC,QAAO,EAAY;EACjB,YAAY,OAAO,OACJ,MAAM,EACjB,2LAGA,EAAE,UAAO,EACT,EACD,EACW;EAEd,iBAAiB;AACV,KAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,2BAA2B,EAAE,CAAC;;EAErF,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CooAddLookbookEntryInput, CooBrand, CooBrandConnection, CooBrandStatus, CooCollaboration, CooCollaborationStatus, CooCollection, CooCollectionStatus, CooCreateBrandInput, CooCreateCollaborationInput, CooCreateCollectionInput, CooCreateLookInput, CooCreateLookbookInput, CooCreateStyleItemInput, CooCreateWardrobeItemInput, CooLook, CooLookConnection, CooLookOccasion, CooLookbook, CooStyleCategory, CooStyleItem, CooStyleItemConnection, CooStyleItemStatus, CooStyleProfile, CooUpdateBrandInput, CooUpdateCollaborationInput, CooUpdateCollectionInput, CooUpdateLookInput, CooUpdateStyleItemInput, CooUpdateWardrobeItemInput, CooUpsertStyleProfileInput, CooWardrobeItem, CooWardrobeSource, PaginationInput, CooSearchStyleItemsInput, CooSearchLooksInput, CooReviewCollaborationInput } from '../types';
|
|
2
2
|
|
|
3
|
+
export declare const coolQuery: <TData>(query: string, variables: Record<string, unknown>, baseUrl?: string) => Promise<TData>;
|
|
3
4
|
export interface ListBrandsArgs {
|
|
4
5
|
status?: CooBrandStatus;
|
|
5
6
|
featured?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCoolAndLovelyApi.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH,OAAO,KAAK,EACV,wBAAwB,EACxB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,gBAAgB,EAEhB,sBAAsB,EACtB,aAAa,EAEb,mBAAmB,EACnB,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,0BAA0B,EAC1B,OAAO,EACP,iBAAiB,EAEjB,eAAe,EACf,WAAW,EAEX,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,EAEf,mBAAmB,EACnB,2BAA2B,EAC3B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,0BAA0B,EAC1B,eAAe,EAEf,iBAAiB,EACjB,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,2BAA2B,EAC5B,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"useCoolAndLovelyApi.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCoolAndLovelyApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;A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Ae,2FAiB3B,CAAC;AAEF,eAAO,MAAM,cAAc,2FAiB1B,CAAC;AAEF,eAAO,MAAM,sBAAsB;QAIS,MAAM;WAAS,2BAA2B;WAerF,CAAC;AAEF,eAAO,MAAM,mBAAmB,+FAiB/B,CAAC;AAEF,eAAO,MAAM,qBAAqB,+FAiBjC,CAAC"}
|
|
@@ -868,6 +868,6 @@ var o = "coolandlovely", s = async (e, t, n) => {
|
|
|
868
868
|
});
|
|
869
869
|
};
|
|
870
870
|
//#endregion
|
|
871
|
-
export { se as useAddLookbookEntry, _e as useApproveBrand, T as useArchiveCollection, A as useArchiveStyleItem, te as useBrand, ee as useBrands, U as useCollaboration, H as useCollaborations, x as useCollection, b as useCollections, _ as useCreateBrand, W as useCreateCollaboration, S as useCreateCollection, P as useCreateLook, oe as useCreateLookbook, O as useCreateStyleItem, J as useCreateWardrobeItem, K as useDeleteCollaboration, V as useDeleteLook, me as useDeleteLookbook, be as useFeatureStyleItem, de as useFollow, ue as useIsFollowing, L as useLikeLook, Y as useLogWardrobeWear, M as useLook, $ as useLookbook, ae as useLookbooks, j as useLooks, N as useLooksWithItems, pe as useMyFollowing, Z as useMyStyleProfile, w as usePublishCollection, I as usePublishLook, ve as useRejectBrand, ce as useRemoveLookbookEntry, X as useRemoveWardrobeItem, ye as useReviewCollaboration, z as useSaveLook, ge as useSearchLooks, he as useSearchStyleItems, D as useStyleItem, E as useStyleItems, re as useStyleProfileByOwner, y as useTransitionBrand, G as useTransitionCollaboration, xe as useUnfeatureStyleItem, fe as useUnfollow, R as useUnlikeLook, B as useUnsaveLook, v as useUpdateBrand, ne as useUpdateCollaboration, C as useUpdateCollection, F as useUpdateLook, k as useUpdateStyleItem, ie as useUpsertStyleProfile, q as useWardrobeItems };
|
|
871
|
+
export { s as coolQuery, se as useAddLookbookEntry, _e as useApproveBrand, T as useArchiveCollection, A as useArchiveStyleItem, te as useBrand, ee as useBrands, U as useCollaboration, H as useCollaborations, x as useCollection, b as useCollections, _ as useCreateBrand, W as useCreateCollaboration, S as useCreateCollection, P as useCreateLook, oe as useCreateLookbook, O as useCreateStyleItem, J as useCreateWardrobeItem, K as useDeleteCollaboration, V as useDeleteLook, me as useDeleteLookbook, be as useFeatureStyleItem, de as useFollow, ue as useIsFollowing, L as useLikeLook, Y as useLogWardrobeWear, M as useLook, $ as useLookbook, ae as useLookbooks, j as useLooks, N as useLooksWithItems, pe as useMyFollowing, Z as useMyStyleProfile, w as usePublishCollection, I as usePublishLook, ve as useRejectBrand, ce as useRemoveLookbookEntry, X as useRemoveWardrobeItem, ye as useReviewCollaboration, z as useSaveLook, ge as useSearchLooks, he as useSearchStyleItems, D as useStyleItem, E as useStyleItems, re as useStyleProfileByOwner, y as useTransitionBrand, G as useTransitionCollaboration, xe as useUnfeatureStyleItem, fe as useUnfollow, R as useUnlikeLook, B as useUnsaveLook, v as useUpdateBrand, ne as useUpdateCollaboration, C as useUpdateCollection, F as useUpdateLook, k as useUpdateStyleItem, ie as useUpsertStyleProfile, q as useWardrobeItems };
|
|
872
872
|
|
|
873
873
|
//# sourceMappingURL=useCoolAndLovelyApi.js.map
|