@burdenoff/microfe-coolandlovely 2026.1031.1 → 2026.1031.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coolandlovely/CoolAndLovelyRoutes.d.ts.map +1 -1
- package/dist/coolandlovely/CoolAndLovelyRoutes.js +42 -38
- package/dist/coolandlovely/CoolAndLovelyRoutes.js.map +1 -1
- package/dist/coolandlovely/components/Field.d.ts +3 -1
- package/dist/coolandlovely/components/Field.d.ts.map +1 -1
- package/dist/coolandlovely/components/Field.js +5 -4
- package/dist/coolandlovely/components/Field.js.map +1 -1
- package/dist/coolandlovely/hooks/useCatalogImport.d.ts +25 -0
- package/dist/coolandlovely/hooks/useCatalogImport.d.ts.map +1 -0
- package/dist/coolandlovely/hooks/useCatalogImport.js +113 -0
- package/dist/coolandlovely/hooks/useCatalogImport.js.map +1 -0
- package/dist/coolandlovely/hooks/useFiles.js +6 -3
- package/dist/coolandlovely/hooks/useFiles.js.map +1 -1
- package/dist/coolandlovely/pages/brands/BrandsListPage.d.ts.map +1 -1
- package/dist/coolandlovely/pages/brands/BrandsListPage.js +72 -60
- package/dist/coolandlovely/pages/brands/BrandsListPage.js.map +1 -1
- package/dist/coolandlovely/pages/brands/ImportCatalogPage.d.ts +17 -0
- package/dist/coolandlovely/pages/brands/ImportCatalogPage.d.ts.map +1 -0
- package/dist/coolandlovely/pages/brands/ImportCatalogPage.js +417 -0
- package/dist/coolandlovely/pages/brands/ImportCatalogPage.js.map +1 -0
- package/dist/coolandlovely/types/index.d.ts +80 -0
- package/dist/coolandlovely/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoolAndLovelyRoutes.d.ts","sourceRoot":"","sources":["../../src/coolandlovely/CoolAndLovelyRoutes.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"CoolAndLovelyRoutes.d.ts","sourceRoot":"","sources":["../../src/coolandlovely/CoolAndLovelyRoutes.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,KAAK,EAAE,EAAkB,MAAM,OAAO,CAAC;AAiJhD,eAAO,MAAM,mBAAmB,EAAE,EA2FjC,CAAC"}
|
|
@@ -4,15 +4,15 @@ import { Suspense as n, lazy as r } from "react";
|
|
|
4
4
|
import { Navigate as i, Route as a, Routes as o, useLocation as s } from "react-router";
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
//#region src/coolandlovely/CoolAndLovelyRoutes.tsx
|
|
7
|
-
var u = r(() => import("./pages/brands/BrandsListPage.js").then((e) => ({ default: e.BrandsListPage }))), d = r(() => import("./pages/brands/BrandDetailPage.js").then((e) => ({ default: e.BrandDetailPage }))), f = r(() => import("./pages/brands/BrandFormPage.js").then((e) => ({ default: e.BrandFormPage }))), p = r(() => import("./pages/collections/CollectionsListPage.js").then((e) => ({ default: e.CollectionsListPage }))),
|
|
7
|
+
var u = r(() => import("./pages/brands/BrandsListPage.js").then((e) => ({ default: e.BrandsListPage }))), d = r(() => import("./pages/brands/BrandDetailPage.js").then((e) => ({ default: e.BrandDetailPage }))), f = r(() => import("./pages/brands/BrandFormPage.js").then((e) => ({ default: e.BrandFormPage }))), p = r(() => import("./pages/brands/ImportCatalogPage.js").then((e) => ({ default: e.ImportCatalogPage }))), m = r(() => import("./pages/collections/CollectionsListPage.js").then((e) => ({ default: e.CollectionsListPage }))), h = r(() => import("./pages/collections/CollectionDetailPage.js").then((e) => ({ default: e.CollectionDetailPage }))), g = r(() => import("./pages/collections/CollectionFormPage.js").then((e) => ({ default: e.CollectionFormPage }))), _ = r(() => import("./pages/items/StyleItemsListPage.js").then((e) => ({ default: e.StyleItemsListPage }))), v = r(() => import("./pages/items/StyleItemDetailPage.js").then((e) => ({ default: e.StyleItemDetailPage }))), y = r(() => import("./pages/items/StyleItemFormPage.js").then((e) => ({ default: e.StyleItemFormPage }))), b = r(() => import("./pages/looks/LooksListPage.js").then((e) => ({ default: e.LooksListPage }))), x = r(() => import("./pages/looks/LookDetailPage.js").then((e) => ({ default: e.LookDetailPage }))), S = r(() => import("./pages/looks/LookFormPage.js").then((e) => ({ default: e.LookFormPage }))), C = r(() => import("./pages/collaborations/CollaborationsListPage.js").then((e) => ({ default: e.CollaborationsListPage }))), w = r(() => import("./pages/collaborations/CollaborationDetailPage.js").then((e) => ({ default: e.CollaborationDetailPage }))), T = r(() => import("./pages/collaborations/CollaborationFormPage.js").then((e) => ({ default: e.CollaborationFormPage }))), E = r(() => import("./pages/wardrobe/WardrobeListPage.js").then((e) => ({ default: e.WardrobeListPage }))), D = r(() => import("./pages/wardrobe/WardrobeFormPage.js").then((e) => ({ default: e.WardrobeFormPage }))), O = r(() => import("./pages/lookbooks/LookbooksListPage.js").then((e) => ({ default: e.LookbooksListPage }))), k = r(() => import("./pages/lookbooks/LookbookDetailPage.js").then((e) => ({ default: e.LookbookDetailPage }))), A = r(() => import("./pages/profile/StyleProfilePage.js").then((e) => ({ default: e.StyleProfilePage }))), j = r(() => import("./pages/discover/DiscoverPage.js").then((e) => ({ default: e.DiscoverPage }))), M = r(() => import("./pages/trends/TrendsPage.js").then((e) => ({ default: e.TrendsPage }))), N = r(() => import("./pages/commerce/CartPage.js").then((e) => ({ default: e.CartPage }))), P = r(() => import("./pages/commerce/BrandOrdersPage.js").then((e) => ({ default: e.BrandOrdersPage }))), F = r(() => import("./pages/commerce/BrandOrdersPage.js").then((e) => ({ default: e.BrandOrderDetailPage }))), I = r(() => import("./pages/commerce/OrdersPage.js").then((e) => ({ default: e.OrdersPage }))), L = r(() => import("./pages/commerce/OrdersPage.js").then((e) => ({ default: e.OrderDetailPage }))), R = r(() => import("./pages/commerce/CreatorEarningsPage.js").then((e) => ({ default: e.CreatorEarningsPage }))), z = r(() => import("./pages/admin/AdminBrandsPage.js").then((e) => ({ default: e.AdminBrandsPage }))), B = r(() => import("./pages/admin/AdminCollaborationsPage.js").then((e) => ({ default: e.AdminCollaborationsPage }))), V = r(() => import("./pages/admin/AdminFeaturedItemsPage.js").then((e) => ({ default: e.AdminFeaturedItemsPage }))), H = () => /* @__PURE__ */ c("div", {
|
|
8
8
|
className: "flex min-h-[400px] items-center justify-center",
|
|
9
9
|
children: /* @__PURE__ */ c("div", { className: "h-8 w-8 animate-spin rounded-full border-b-2 border-primary" })
|
|
10
|
-
}),
|
|
11
|
-
let { basePath: r, isStandalone:
|
|
12
|
-
return
|
|
10
|
+
}), U = () => {
|
|
11
|
+
let { basePath: r, isStandalone: U } = e(), W = s(), G = r === "/" ? "" : (r ?? "").replace(/\/$/, "");
|
|
12
|
+
return G && !U && !(W.pathname === G || W.pathname.startsWith(G + "/")) ? null : /* @__PURE__ */ c("div", {
|
|
13
13
|
className: "flex min-h-full flex-col",
|
|
14
14
|
children: /* @__PURE__ */ c(n, {
|
|
15
|
-
fallback: /* @__PURE__ */ c(
|
|
15
|
+
fallback: /* @__PURE__ */ c(H, {}),
|
|
16
16
|
children: /* @__PURE__ */ l(o, { children: [
|
|
17
17
|
/* @__PURE__ */ c(a, {
|
|
18
18
|
index: !0,
|
|
@@ -26,6 +26,10 @@ var u = r(() => import("./pages/brands/BrandsListPage.js").then((e) => ({ defaul
|
|
|
26
26
|
path: "brands/new",
|
|
27
27
|
element: /* @__PURE__ */ c(f, {})
|
|
28
28
|
}),
|
|
29
|
+
/* @__PURE__ */ c(a, {
|
|
30
|
+
path: "brands/import",
|
|
31
|
+
element: /* @__PURE__ */ c(p, {})
|
|
32
|
+
}),
|
|
29
33
|
/* @__PURE__ */ c(a, {
|
|
30
34
|
path: "brands/:brandId",
|
|
31
35
|
element: /* @__PURE__ */ c(d, {})
|
|
@@ -36,119 +40,119 @@ var u = r(() => import("./pages/brands/BrandsListPage.js").then((e) => ({ defaul
|
|
|
36
40
|
}),
|
|
37
41
|
/* @__PURE__ */ c(a, {
|
|
38
42
|
path: "collections",
|
|
39
|
-
element: /* @__PURE__ */ c(
|
|
43
|
+
element: /* @__PURE__ */ c(m, {})
|
|
40
44
|
}),
|
|
41
45
|
/* @__PURE__ */ c(a, {
|
|
42
46
|
path: "collections/new",
|
|
43
|
-
element: /* @__PURE__ */ c(
|
|
47
|
+
element: /* @__PURE__ */ c(g, {})
|
|
44
48
|
}),
|
|
45
49
|
/* @__PURE__ */ c(a, {
|
|
46
50
|
path: "collections/:collectionId",
|
|
47
|
-
element: /* @__PURE__ */ c(
|
|
51
|
+
element: /* @__PURE__ */ c(h, {})
|
|
48
52
|
}),
|
|
49
53
|
/* @__PURE__ */ c(a, {
|
|
50
54
|
path: "collections/:collectionId/edit",
|
|
51
|
-
element: /* @__PURE__ */ c(
|
|
55
|
+
element: /* @__PURE__ */ c(g, {})
|
|
52
56
|
}),
|
|
53
57
|
/* @__PURE__ */ c(a, {
|
|
54
58
|
path: "items",
|
|
55
|
-
element: /* @__PURE__ */ c(
|
|
59
|
+
element: /* @__PURE__ */ c(_, {})
|
|
56
60
|
}),
|
|
57
61
|
/* @__PURE__ */ c(a, {
|
|
58
62
|
path: "items/new",
|
|
59
|
-
element: /* @__PURE__ */ c(
|
|
63
|
+
element: /* @__PURE__ */ c(y, {})
|
|
60
64
|
}),
|
|
61
65
|
/* @__PURE__ */ c(a, {
|
|
62
66
|
path: "items/:itemId",
|
|
63
|
-
element: /* @__PURE__ */ c(
|
|
67
|
+
element: /* @__PURE__ */ c(v, {})
|
|
64
68
|
}),
|
|
65
69
|
/* @__PURE__ */ c(a, {
|
|
66
70
|
path: "items/:itemId/edit",
|
|
67
|
-
element: /* @__PURE__ */ c(
|
|
71
|
+
element: /* @__PURE__ */ c(y, {})
|
|
68
72
|
}),
|
|
69
73
|
/* @__PURE__ */ c(a, {
|
|
70
74
|
path: "looks",
|
|
71
|
-
element: /* @__PURE__ */ c(
|
|
75
|
+
element: /* @__PURE__ */ c(b, {})
|
|
72
76
|
}),
|
|
73
77
|
/* @__PURE__ */ c(a, {
|
|
74
78
|
path: "looks/new",
|
|
75
|
-
element: /* @__PURE__ */ c(
|
|
79
|
+
element: /* @__PURE__ */ c(S, {})
|
|
76
80
|
}),
|
|
77
81
|
/* @__PURE__ */ c(a, {
|
|
78
82
|
path: "looks/:lookId",
|
|
79
|
-
element: /* @__PURE__ */ c(
|
|
83
|
+
element: /* @__PURE__ */ c(x, {})
|
|
80
84
|
}),
|
|
81
85
|
/* @__PURE__ */ c(a, {
|
|
82
86
|
path: "collaborations",
|
|
83
|
-
element: /* @__PURE__ */ c(
|
|
87
|
+
element: /* @__PURE__ */ c(C, {})
|
|
84
88
|
}),
|
|
85
89
|
/* @__PURE__ */ c(a, {
|
|
86
90
|
path: "collaborations/new",
|
|
87
|
-
element: /* @__PURE__ */ c(
|
|
91
|
+
element: /* @__PURE__ */ c(T, {})
|
|
88
92
|
}),
|
|
89
93
|
/* @__PURE__ */ c(a, {
|
|
90
94
|
path: "collaborations/:collaborationId",
|
|
91
|
-
element: /* @__PURE__ */ c(
|
|
95
|
+
element: /* @__PURE__ */ c(w, {})
|
|
92
96
|
}),
|
|
93
97
|
/* @__PURE__ */ c(a, {
|
|
94
98
|
path: "collaborations/:collaborationId/edit",
|
|
95
|
-
element: /* @__PURE__ */ c(
|
|
99
|
+
element: /* @__PURE__ */ c(T, {})
|
|
96
100
|
}),
|
|
97
101
|
/* @__PURE__ */ c(a, {
|
|
98
102
|
path: "wardrobe",
|
|
99
|
-
element: /* @__PURE__ */ c(
|
|
103
|
+
element: /* @__PURE__ */ c(E, {})
|
|
100
104
|
}),
|
|
101
105
|
/* @__PURE__ */ c(a, {
|
|
102
106
|
path: "wardrobe/new",
|
|
103
|
-
element: /* @__PURE__ */ c(
|
|
107
|
+
element: /* @__PURE__ */ c(D, {})
|
|
104
108
|
}),
|
|
105
109
|
/* @__PURE__ */ c(a, {
|
|
106
110
|
path: "lookbooks",
|
|
107
|
-
element: /* @__PURE__ */ c(
|
|
111
|
+
element: /* @__PURE__ */ c(O, {})
|
|
108
112
|
}),
|
|
109
113
|
/* @__PURE__ */ c(a, {
|
|
110
114
|
path: "lookbooks/:lookbookId",
|
|
111
|
-
element: /* @__PURE__ */ c(
|
|
115
|
+
element: /* @__PURE__ */ c(k, {})
|
|
112
116
|
}),
|
|
113
117
|
/* @__PURE__ */ c(a, {
|
|
114
118
|
path: "profile",
|
|
115
|
-
element: /* @__PURE__ */ c(
|
|
119
|
+
element: /* @__PURE__ */ c(A, {})
|
|
116
120
|
}),
|
|
117
121
|
/* @__PURE__ */ c(a, {
|
|
118
122
|
path: "profile/:userId",
|
|
119
|
-
element: /* @__PURE__ */ c(
|
|
123
|
+
element: /* @__PURE__ */ c(A, {})
|
|
120
124
|
}),
|
|
121
125
|
/* @__PURE__ */ c(a, {
|
|
122
126
|
path: "discover",
|
|
123
|
-
element: /* @__PURE__ */ c(
|
|
127
|
+
element: /* @__PURE__ */ c(j, {})
|
|
124
128
|
}),
|
|
125
129
|
/* @__PURE__ */ c(a, {
|
|
126
130
|
path: "trends",
|
|
127
|
-
element: /* @__PURE__ */ c(
|
|
131
|
+
element: /* @__PURE__ */ c(M, {})
|
|
128
132
|
}),
|
|
129
133
|
/* @__PURE__ */ c(a, {
|
|
130
134
|
path: "cart",
|
|
131
|
-
element: /* @__PURE__ */ c(
|
|
135
|
+
element: /* @__PURE__ */ c(N, {})
|
|
132
136
|
}),
|
|
133
137
|
/* @__PURE__ */ c(a, {
|
|
134
138
|
path: "orders",
|
|
135
|
-
element: /* @__PURE__ */ c(
|
|
139
|
+
element: /* @__PURE__ */ c(I, {})
|
|
136
140
|
}),
|
|
137
141
|
/* @__PURE__ */ c(a, {
|
|
138
142
|
path: "orders/:orderId",
|
|
139
|
-
element: /* @__PURE__ */ c(
|
|
143
|
+
element: /* @__PURE__ */ c(L, {})
|
|
140
144
|
}),
|
|
141
145
|
/* @__PURE__ */ c(a, {
|
|
142
146
|
path: "earnings",
|
|
143
|
-
element: /* @__PURE__ */ c(
|
|
147
|
+
element: /* @__PURE__ */ c(R, {})
|
|
144
148
|
}),
|
|
145
149
|
/* @__PURE__ */ c(a, {
|
|
146
150
|
path: "brand-orders",
|
|
147
|
-
element: /* @__PURE__ */ c(
|
|
151
|
+
element: /* @__PURE__ */ c(P, {})
|
|
148
152
|
}),
|
|
149
153
|
/* @__PURE__ */ c(a, {
|
|
150
154
|
path: "brand-orders/:brandId/:orderId",
|
|
151
|
-
element: /* @__PURE__ */ c(
|
|
155
|
+
element: /* @__PURE__ */ c(F, {})
|
|
152
156
|
}),
|
|
153
157
|
/* @__PURE__ */ c(a, {
|
|
154
158
|
path: "admin",
|
|
@@ -159,15 +163,15 @@ var u = r(() => import("./pages/brands/BrandsListPage.js").then((e) => ({ defaul
|
|
|
159
163
|
}),
|
|
160
164
|
/* @__PURE__ */ c(a, {
|
|
161
165
|
path: "admin/brands",
|
|
162
|
-
element: /* @__PURE__ */ c(
|
|
166
|
+
element: /* @__PURE__ */ c(z, {})
|
|
163
167
|
}),
|
|
164
168
|
/* @__PURE__ */ c(a, {
|
|
165
169
|
path: "admin/collaborations",
|
|
166
|
-
element: /* @__PURE__ */ c(
|
|
170
|
+
element: /* @__PURE__ */ c(B, {})
|
|
167
171
|
}),
|
|
168
172
|
/* @__PURE__ */ c(a, {
|
|
169
173
|
path: "admin/featured-items",
|
|
170
|
-
element: /* @__PURE__ */ c(
|
|
174
|
+
element: /* @__PURE__ */ c(V, {})
|
|
171
175
|
}),
|
|
172
176
|
/* @__PURE__ */ c(a, {
|
|
173
177
|
path: "*",
|
|
@@ -181,6 +185,6 @@ var u = r(() => import("./pages/brands/BrandsListPage.js").then((e) => ({ defaul
|
|
|
181
185
|
});
|
|
182
186
|
};
|
|
183
187
|
//#endregion
|
|
184
|
-
export {
|
|
188
|
+
export { U as CoolAndLovelyRoutes };
|
|
185
189
|
|
|
186
190
|
//# sourceMappingURL=CoolAndLovelyRoutes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CoolAndLovelyRoutes.js","names":[],"sources":["../../src/coolandlovely/CoolAndLovelyRoutes.tsx"],"sourcesContent":["/**\n * CoolAndLovely Routes\n * @module coolandlovely\n *\n * Real fashion-domain routes wired to the live `wspace-coolandlovely-svc`\n * GraphQL contract: overview, brands, collections, style items, looks,\n * collaborations, wardrobe, lookbooks and the shopper's style profile.\n */\n\nimport { type FC, lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { useCoolAndLovely } from './context/CoolAndLovelyContext';\n\n// Eager-loaded overview (primary landing page)\nimport { HomePage } from './pages/HomePage';\n\n// Brands\nconst BrandsListPage = lazy(() =>\n import('./pages/brands/BrandsListPage').then((m) => ({ default: m.BrandsListPage }))\n);\nconst BrandDetailPage = lazy(() =>\n import('./pages/brands/BrandDetailPage').then((m) => ({ default: m.BrandDetailPage }))\n);\nconst BrandFormPage = lazy(() =>\n import('./pages/brands/BrandFormPage').then((m) => ({ default: m.BrandFormPage }))\n);\n\n// Collections\nconst CollectionsListPage = lazy(() =>\n import('./pages/collections/CollectionsListPage').then((m) => ({\n default: m.CollectionsListPage,\n }))\n);\nconst CollectionDetailPage = lazy(() =>\n import('./pages/collections/CollectionDetailPage').then((m) => ({\n default: m.CollectionDetailPage,\n }))\n);\nconst CollectionFormPage = lazy(() =>\n import('./pages/collections/CollectionFormPage').then((m) => ({ default: m.CollectionFormPage }))\n);\n\n// Style items\nconst StyleItemsListPage = lazy(() =>\n import('./pages/items/StyleItemsListPage').then((m) => ({ default: m.StyleItemsListPage }))\n);\nconst StyleItemDetailPage = lazy(() =>\n import('./pages/items/StyleItemDetailPage').then((m) => ({ default: m.StyleItemDetailPage }))\n);\nconst StyleItemFormPage = lazy(() =>\n import('./pages/items/StyleItemFormPage').then((m) => ({ default: m.StyleItemFormPage }))\n);\n\n// Looks\nconst LooksListPage = lazy(() =>\n import('./pages/looks/LooksListPage').then((m) => ({ default: m.LooksListPage }))\n);\nconst LookDetailPage = lazy(() =>\n import('./pages/looks/LookDetailPage').then((m) => ({ default: m.LookDetailPage }))\n);\nconst LookFormPage = lazy(() =>\n import('./pages/looks/LookFormPage').then((m) => ({ default: m.LookFormPage }))\n);\n\n// Collaborations\nconst CollaborationsListPage = lazy(() =>\n import('./pages/collaborations/CollaborationsListPage').then((m) => ({\n default: m.CollaborationsListPage,\n }))\n);\nconst CollaborationDetailPage = lazy(() =>\n import('./pages/collaborations/CollaborationDetailPage').then((m) => ({\n default: m.CollaborationDetailPage,\n }))\n);\nconst CollaborationFormPage = lazy(() =>\n import('./pages/collaborations/CollaborationFormPage').then((m) => ({\n default: m.CollaborationFormPage,\n }))\n);\n\n// Wardrobe (self-scoped)\nconst WardrobeListPage = lazy(() =>\n import('./pages/wardrobe/WardrobeListPage').then((m) => ({ default: m.WardrobeListPage }))\n);\nconst WardrobeFormPage = lazy(() =>\n import('./pages/wardrobe/WardrobeFormPage').then((m) => ({ default: m.WardrobeFormPage }))\n);\n\n// Lookbooks\nconst LookbooksListPage = lazy(() =>\n import('./pages/lookbooks/LookbooksListPage').then((m) => ({ default: m.LookbooksListPage }))\n);\nconst LookbookDetailPage = lazy(() =>\n import('./pages/lookbooks/LookbookDetailPage').then((m) => ({ default: m.LookbookDetailPage }))\n);\n\n// Style profile (self-scoped)\nconst StyleProfilePage = lazy(() =>\n import('./pages/profile/StyleProfilePage').then((m) => ({ default: m.StyleProfilePage }))\n);\n\n// Discovery + trends (client-side analytics over the real catalogue/social lists)\nconst DiscoverPage = lazy(() =>\n import('./pages/discover/DiscoverPage').then((m) => ({ default: m.DiscoverPage }))\n);\nconst TrendsPage = lazy(() =>\n import('./pages/trends/TrendsPage').then((m) => ({ default: m.TrendsPage }))\n);\n\n// Commerce (BOFF-3370): cart, orders, creator earnings\nconst CartPage = lazy(() =>\n import('./pages/commerce/CartPage').then((m) => ({ default: m.CartPage }))\n);\nconst BrandOrdersPage = lazy(() =>\n import('./pages/commerce/BrandOrdersPage').then((m) => ({ default: m.BrandOrdersPage }))\n);\nconst BrandOrderDetailPage = lazy(() =>\n import('./pages/commerce/BrandOrdersPage').then((m) => ({ default: m.BrandOrderDetailPage }))\n);\nconst OrdersPage = lazy(() =>\n import('./pages/commerce/OrdersPage').then((m) => ({ default: m.OrdersPage }))\n);\nconst OrderDetailPage = lazy(() =>\n import('./pages/commerce/OrdersPage').then((m) => ({ default: m.OrderDetailPage }))\n);\nconst CreatorEarningsPage = lazy(() =>\n import('./pages/commerce/CreatorEarningsPage').then((m) => ({ default: m.CreatorEarningsPage }))\n);\n\n// Admin curation (gated by the `coolandlovely.admin.curation` feature flag)\nconst AdminBrandsPage = lazy(() =>\n import('./pages/admin/AdminBrandsPage').then((m) => ({ default: m.AdminBrandsPage }))\n);\nconst AdminCollaborationsPage = lazy(() =>\n import('./pages/admin/AdminCollaborationsPage').then((m) => ({\n default: m.AdminCollaborationsPage,\n }))\n);\nconst AdminFeaturedItemsPage = lazy(() =>\n import('./pages/admin/AdminFeaturedItemsPage').then((m) => ({\n default: m.AdminFeaturedItemsPage,\n }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-b-2 border-primary\" />\n </div>\n);\n\nexport const CoolAndLovelyRoutes: FC = () => {\n const { basePath, isStandalone } = useCoolAndLovely();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the path matches the basePath (when integrated).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Overview */}\n <Route index element={<HomePage />} />\n\n {/* Brands */}\n <Route path=\"brands\" element={<BrandsListPage />} />\n <Route path=\"brands/new\" element={<BrandFormPage />} />\n <Route path=\"brands/:brandId\" element={<BrandDetailPage />} />\n <Route path=\"brands/:brandId/edit\" element={<BrandFormPage />} />\n\n {/* Collections */}\n <Route path=\"collections\" element={<CollectionsListPage />} />\n <Route path=\"collections/new\" element={<CollectionFormPage />} />\n <Route path=\"collections/:collectionId\" element={<CollectionDetailPage />} />\n <Route path=\"collections/:collectionId/edit\" element={<CollectionFormPage />} />\n\n {/* Style items */}\n <Route path=\"items\" element={<StyleItemsListPage />} />\n <Route path=\"items/new\" element={<StyleItemFormPage />} />\n <Route path=\"items/:itemId\" element={<StyleItemDetailPage />} />\n <Route path=\"items/:itemId/edit\" element={<StyleItemFormPage />} />\n\n {/* Looks */}\n <Route path=\"looks\" element={<LooksListPage />} />\n <Route path=\"looks/new\" element={<LookFormPage />} />\n <Route path=\"looks/:lookId\" element={<LookDetailPage />} />\n\n {/* Collaborations */}\n <Route path=\"collaborations\" element={<CollaborationsListPage />} />\n <Route path=\"collaborations/new\" element={<CollaborationFormPage />} />\n <Route path=\"collaborations/:collaborationId\" element={<CollaborationDetailPage />} />\n <Route path=\"collaborations/:collaborationId/edit\" element={<CollaborationFormPage />} />\n\n {/* Wardrobe (self-scoped) */}\n <Route path=\"wardrobe\" element={<WardrobeListPage />} />\n <Route path=\"wardrobe/new\" element={<WardrobeFormPage />} />\n\n {/* Lookbooks */}\n <Route path=\"lookbooks\" element={<LookbooksListPage />} />\n <Route path=\"lookbooks/:lookbookId\" element={<LookbookDetailPage />} />\n\n {/* Style profile (self-scoped) + public profiles */}\n <Route path=\"profile\" element={<StyleProfilePage />} />\n <Route path=\"profile/:userId\" element={<StyleProfilePage />} />\n\n {/* Discovery + trends */}\n <Route path=\"discover\" element={<DiscoverPage />} />\n <Route path=\"trends\" element={<TrendsPage />} />\n\n {/* Commerce */}\n <Route path=\"cart\" element={<CartPage />} />\n <Route path=\"orders\" element={<OrdersPage />} />\n <Route path=\"orders/:orderId\" element={<OrderDetailPage />} />\n <Route path=\"earnings\" element={<CreatorEarningsPage />} />\n\n {/* Brand-side orders and fulfilment (BOFF-9636) */}\n <Route path=\"brand-orders\" element={<BrandOrdersPage />} />\n <Route path=\"brand-orders/:brandId/:orderId\" element={<BrandOrderDetailPage />} />\n\n {/* Admin curation */}\n <Route path=\"admin\" element={<Navigate to=\"admin/brands\" replace />} />\n <Route path=\"admin/brands\" element={<AdminBrandsPage />} />\n <Route path=\"admin/collaborations\" element={<AdminCollaborationsPage />} />\n <Route path=\"admin/featured-items\" element={<AdminFeaturedItemsPage />} />\n\n {/* Fallback */}\n <Route path=\"*\" element={<Navigate to=\"\" replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;AAiBA,IAAM,IAAiB,QACrB,OAAO,oCAAiC,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CACrF,EACK,IAAkB,QACtB,OAAO,qCAAkC,MAAM,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,CACvF,EACK,IAAgB,QACpB,OAAO,mCAAgC,MAAM,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,CACnF,EAGK,IAAsB,QAC1B,OAAO,8CAA2C,MAAM,OAAO,EAC7D,SAAS,EAAE,qBACZ,EAAE,CACJ,EACK,IAAuB,QAC3B,OAAO,+CAA4C,MAAM,OAAO,EAC9D,SAAS,EAAE,sBACZ,EAAE,CACJ,EACK,IAAqB,QACzB,OAAO,6CAA0C,MAAM,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAClG,EAGK,IAAqB,QACzB,OAAO,uCAAoC,MAAM,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,CAC5F,EACK,IAAsB,QAC1B,OAAO,wCAAqC,MAAM,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAC9F,EACK,IAAoB,QACxB,OAAO,sCAAmC,MAAM,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAC1F,EAGK,IAAgB,QACpB,OAAO,kCAA+B,MAAM,OAAO,EAAE,SAAS,EAA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B,CAAA;KAAI,CAAA;IAC3D,kBAAC,GAAD;KAAO,MAAK;KAAiC,SAAS,kBAAC,GAAD,EAAwB,CAAA;KAAI,CAAA;IAGlF,kBAAC,GAAD;KAAO,MAAK;KAAQ,SAAS,kBAAC,GAAD;MAAU,IAAG;MAAe,SAAA;MAAU,CAAA;KAAI,CAAA;IACvE,kBAAC,GAAD;KAAO,MAAK;KAAe,SAAS,kBAAC,GAAD,EAAmB,CAAA;KAAI,CAAA;IAC3D,kBAAC,GAAD;KAAO,MAAK;KAAuB,SAAS,kBAAC,GAAD,EAA2B,CAAA;KAAI,CAAA;IAC3E,kBAAC,GAAD;KAAO,MAAK;KAAuB,SAAS,kBAAC,GAAD,EAA0B,CAAA;KAAI,CAAA;IAG1E,kBAAC,GAAD;KAAO,MAAK;KAAI,SAAS,kBAAC,GAAD;MAAU,IAAG;MAAG,SAAA;MAAU,CAAA;KAAI,CAAA;IAChD,EAAA,CAAA;GACA,CAAA;EACP,CAAA"}
|
|
1
|
+
{"version":3,"file":"CoolAndLovelyRoutes.js","names":[],"sources":["../../src/coolandlovely/CoolAndLovelyRoutes.tsx"],"sourcesContent":["/**\n * CoolAndLovely Routes\n * @module coolandlovely\n *\n * Real fashion-domain routes wired to the live `wspace-coolandlovely-svc`\n * GraphQL contract: overview, brands, collections, style items, looks,\n * collaborations, wardrobe, lookbooks and the shopper's style profile.\n */\n\nimport { type FC, lazy, Suspense } from 'react';\nimport { Routes, Route, Navigate, useLocation } from 'react-router';\nimport { useCoolAndLovely } from './context/CoolAndLovelyContext';\n\n// Eager-loaded overview (primary landing page)\nimport { HomePage } from './pages/HomePage';\n\n// Brands\nconst BrandsListPage = lazy(() =>\n import('./pages/brands/BrandsListPage').then((m) => ({ default: m.BrandsListPage }))\n);\nconst BrandDetailPage = lazy(() =>\n import('./pages/brands/BrandDetailPage').then((m) => ({ default: m.BrandDetailPage }))\n);\nconst BrandFormPage = lazy(() =>\n import('./pages/brands/BrandFormPage').then((m) => ({ default: m.BrandFormPage }))\n);\nconst ImportCatalogPage = lazy(() =>\n import('./pages/brands/ImportCatalogPage').then((m) => ({ default: m.ImportCatalogPage }))\n);\n\n// Collections\nconst CollectionsListPage = lazy(() =>\n import('./pages/collections/CollectionsListPage').then((m) => ({\n default: m.CollectionsListPage,\n }))\n);\nconst CollectionDetailPage = lazy(() =>\n import('./pages/collections/CollectionDetailPage').then((m) => ({\n default: m.CollectionDetailPage,\n }))\n);\nconst CollectionFormPage = lazy(() =>\n import('./pages/collections/CollectionFormPage').then((m) => ({ default: m.CollectionFormPage }))\n);\n\n// Style items\nconst StyleItemsListPage = lazy(() =>\n import('./pages/items/StyleItemsListPage').then((m) => ({ default: m.StyleItemsListPage }))\n);\nconst StyleItemDetailPage = lazy(() =>\n import('./pages/items/StyleItemDetailPage').then((m) => ({ default: m.StyleItemDetailPage }))\n);\nconst StyleItemFormPage = lazy(() =>\n import('./pages/items/StyleItemFormPage').then((m) => ({ default: m.StyleItemFormPage }))\n);\n\n// Looks\nconst LooksListPage = lazy(() =>\n import('./pages/looks/LooksListPage').then((m) => ({ default: m.LooksListPage }))\n);\nconst LookDetailPage = lazy(() =>\n import('./pages/looks/LookDetailPage').then((m) => ({ default: m.LookDetailPage }))\n);\nconst LookFormPage = lazy(() =>\n import('./pages/looks/LookFormPage').then((m) => ({ default: m.LookFormPage }))\n);\n\n// Collaborations\nconst CollaborationsListPage = lazy(() =>\n import('./pages/collaborations/CollaborationsListPage').then((m) => ({\n default: m.CollaborationsListPage,\n }))\n);\nconst CollaborationDetailPage = lazy(() =>\n import('./pages/collaborations/CollaborationDetailPage').then((m) => ({\n default: m.CollaborationDetailPage,\n }))\n);\nconst CollaborationFormPage = lazy(() =>\n import('./pages/collaborations/CollaborationFormPage').then((m) => ({\n default: m.CollaborationFormPage,\n }))\n);\n\n// Wardrobe (self-scoped)\nconst WardrobeListPage = lazy(() =>\n import('./pages/wardrobe/WardrobeListPage').then((m) => ({ default: m.WardrobeListPage }))\n);\nconst WardrobeFormPage = lazy(() =>\n import('./pages/wardrobe/WardrobeFormPage').then((m) => ({ default: m.WardrobeFormPage }))\n);\n\n// Lookbooks\nconst LookbooksListPage = lazy(() =>\n import('./pages/lookbooks/LookbooksListPage').then((m) => ({ default: m.LookbooksListPage }))\n);\nconst LookbookDetailPage = lazy(() =>\n import('./pages/lookbooks/LookbookDetailPage').then((m) => ({ default: m.LookbookDetailPage }))\n);\n\n// Style profile (self-scoped)\nconst StyleProfilePage = lazy(() =>\n import('./pages/profile/StyleProfilePage').then((m) => ({ default: m.StyleProfilePage }))\n);\n\n// Discovery + trends (client-side analytics over the real catalogue/social lists)\nconst DiscoverPage = lazy(() =>\n import('./pages/discover/DiscoverPage').then((m) => ({ default: m.DiscoverPage }))\n);\nconst TrendsPage = lazy(() =>\n import('./pages/trends/TrendsPage').then((m) => ({ default: m.TrendsPage }))\n);\n\n// Commerce (BOFF-3370): cart, orders, creator earnings\nconst CartPage = lazy(() =>\n import('./pages/commerce/CartPage').then((m) => ({ default: m.CartPage }))\n);\nconst BrandOrdersPage = lazy(() =>\n import('./pages/commerce/BrandOrdersPage').then((m) => ({ default: m.BrandOrdersPage }))\n);\nconst BrandOrderDetailPage = lazy(() =>\n import('./pages/commerce/BrandOrdersPage').then((m) => ({ default: m.BrandOrderDetailPage }))\n);\nconst OrdersPage = lazy(() =>\n import('./pages/commerce/OrdersPage').then((m) => ({ default: m.OrdersPage }))\n);\nconst OrderDetailPage = lazy(() =>\n import('./pages/commerce/OrdersPage').then((m) => ({ default: m.OrderDetailPage }))\n);\nconst CreatorEarningsPage = lazy(() =>\n import('./pages/commerce/CreatorEarningsPage').then((m) => ({ default: m.CreatorEarningsPage }))\n);\n\n// Admin curation (gated by the `coolandlovely.admin.curation` feature flag)\nconst AdminBrandsPage = lazy(() =>\n import('./pages/admin/AdminBrandsPage').then((m) => ({ default: m.AdminBrandsPage }))\n);\nconst AdminCollaborationsPage = lazy(() =>\n import('./pages/admin/AdminCollaborationsPage').then((m) => ({\n default: m.AdminCollaborationsPage,\n }))\n);\nconst AdminFeaturedItemsPage = lazy(() =>\n import('./pages/admin/AdminFeaturedItemsPage').then((m) => ({\n default: m.AdminFeaturedItemsPage,\n }))\n);\n\nconst PageLoader: FC = () => (\n <div className=\"flex min-h-[400px] items-center justify-center\">\n <div className=\"h-8 w-8 animate-spin rounded-full border-b-2 border-primary\" />\n </div>\n);\n\nexport const CoolAndLovelyRoutes: FC = () => {\n const { basePath, isStandalone } = useCoolAndLovely();\n const location = useLocation();\n\n const normalizedBasePath = basePath === '/' ? '' : (basePath ?? '').replace(/\\/$/, '');\n\n // Guard: only render if the path matches the basePath (when integrated).\n if (normalizedBasePath && !isStandalone) {\n const pathMatches =\n location.pathname === normalizedBasePath ||\n location.pathname.startsWith(normalizedBasePath + '/');\n if (!pathMatches) {\n return null;\n }\n }\n\n return (\n <div className=\"flex min-h-full flex-col\">\n <Suspense fallback={<PageLoader />}>\n <Routes>\n {/* Overview */}\n <Route index element={<HomePage />} />\n\n {/* Brands */}\n <Route path=\"brands\" element={<BrandsListPage />} />\n <Route path=\"brands/new\" element={<BrandFormPage />} />\n <Route path=\"brands/import\" element={<ImportCatalogPage />} />\n <Route path=\"brands/:brandId\" element={<BrandDetailPage />} />\n <Route path=\"brands/:brandId/edit\" element={<BrandFormPage />} />\n\n {/* Collections */}\n <Route path=\"collections\" element={<CollectionsListPage />} />\n <Route path=\"collections/new\" element={<CollectionFormPage />} />\n <Route path=\"collections/:collectionId\" element={<CollectionDetailPage />} />\n <Route path=\"collections/:collectionId/edit\" element={<CollectionFormPage />} />\n\n {/* Style items */}\n <Route path=\"items\" element={<StyleItemsListPage />} />\n <Route path=\"items/new\" element={<StyleItemFormPage />} />\n <Route path=\"items/:itemId\" element={<StyleItemDetailPage />} />\n <Route path=\"items/:itemId/edit\" element={<StyleItemFormPage />} />\n\n {/* Looks */}\n <Route path=\"looks\" element={<LooksListPage />} />\n <Route path=\"looks/new\" element={<LookFormPage />} />\n <Route path=\"looks/:lookId\" element={<LookDetailPage />} />\n\n {/* Collaborations */}\n <Route path=\"collaborations\" element={<CollaborationsListPage />} />\n <Route path=\"collaborations/new\" element={<CollaborationFormPage />} />\n <Route path=\"collaborations/:collaborationId\" element={<CollaborationDetailPage />} />\n <Route path=\"collaborations/:collaborationId/edit\" element={<CollaborationFormPage />} />\n\n {/* Wardrobe (self-scoped) */}\n <Route path=\"wardrobe\" element={<WardrobeListPage />} />\n <Route path=\"wardrobe/new\" element={<WardrobeFormPage />} />\n\n {/* Lookbooks */}\n <Route path=\"lookbooks\" element={<LookbooksListPage />} />\n <Route path=\"lookbooks/:lookbookId\" element={<LookbookDetailPage />} />\n\n {/* Style profile (self-scoped) + public profiles */}\n <Route path=\"profile\" element={<StyleProfilePage />} />\n <Route path=\"profile/:userId\" element={<StyleProfilePage />} />\n\n {/* Discovery + trends */}\n <Route path=\"discover\" element={<DiscoverPage />} />\n <Route path=\"trends\" element={<TrendsPage />} />\n\n {/* Commerce */}\n <Route path=\"cart\" element={<CartPage />} />\n <Route path=\"orders\" element={<OrdersPage />} />\n <Route path=\"orders/:orderId\" element={<OrderDetailPage />} />\n <Route path=\"earnings\" element={<CreatorEarningsPage />} />\n\n {/* Brand-side orders and fulfilment (BOFF-9636) */}\n <Route path=\"brand-orders\" element={<BrandOrdersPage />} />\n <Route path=\"brand-orders/:brandId/:orderId\" element={<BrandOrderDetailPage />} />\n\n {/* Admin curation */}\n <Route path=\"admin\" element={<Navigate to=\"admin/brands\" replace />} />\n <Route path=\"admin/brands\" element={<AdminBrandsPage />} />\n <Route path=\"admin/collaborations\" element={<AdminCollaborationsPage />} />\n <Route path=\"admin/featured-items\" element={<AdminFeaturedItemsPage />} />\n\n {/* Fallback */}\n <Route path=\"*\" element={<Navigate to=\"\" replace />} />\n </Routes>\n </Suspense>\n </div>\n );\n};\n"],"mappings":";;;;;;AAiBA,IAAM,IAAiB,QACrB,OAAO,oCAAiC,MAAM,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,C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KAAuB,SAAS,kBAAC,GAAD,EAA2B,CAAA;KAAI,CAAA;IAC3E,kBAAC,GAAD;KAAO,MAAK;KAAuB,SAAS,kBAAC,GAAD,EAA0B,CAAA;KAAI,CAAA;IAG1E,kBAAC,GAAD;KAAO,MAAK;KAAI,SAAS,kBAAC,GAAD;MAAU,IAAG;MAAG,SAAA;MAAU,CAAA;KAAI,CAAA;IAChD,EAAA,CAAA;GACA,CAAA;EACP,CAAA"}
|
|
@@ -19,7 +19,9 @@ interface TextFieldProps {
|
|
|
19
19
|
required?: boolean;
|
|
20
20
|
hint?: string;
|
|
21
21
|
error?: string;
|
|
22
|
-
type?: 'text' | 'url' | 'number' | 'date';
|
|
22
|
+
type?: 'text' | 'url' | 'number' | 'date' | 'password';
|
|
23
|
+
/** Native autocomplete hint (e.g. 'off' for one-time API credentials). */
|
|
24
|
+
autoComplete?: string;
|
|
23
25
|
disabled?: boolean;
|
|
24
26
|
className?: string;
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/components/Field.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,EAAE,EAAE,SAAS,EAAe,MAAM,OAAO,CAAC;AAGxD,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAqB1C,CAAC;AAKF,UAAU,cAAc;IACtB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,C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MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CAyC5C,CAAC"}
|
|
@@ -21,22 +21,23 @@ var r = ({ label: r, htmlFor: i, required: a, hint: o, error: s, children: c, cl
|
|
|
21
21
|
children: o
|
|
22
22
|
}) : null
|
|
23
23
|
]
|
|
24
|
-
}), i = "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", a = ({ id: n, label: a, value: o, onChange: s, placeholder: c, required: l, hint: u, error: d, type: f = "text",
|
|
24
|
+
}), i = "w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", a = ({ id: n, label: a, value: o, onChange: s, placeholder: c, required: l, hint: u, error: d, type: f = "text", autoComplete: p, disabled: m, className: h }) => /* @__PURE__ */ t(r, {
|
|
25
25
|
label: a,
|
|
26
26
|
htmlFor: n,
|
|
27
27
|
required: l,
|
|
28
28
|
hint: u,
|
|
29
29
|
error: d,
|
|
30
|
-
className:
|
|
30
|
+
className: h,
|
|
31
31
|
children: /* @__PURE__ */ t("input", {
|
|
32
32
|
id: n,
|
|
33
33
|
type: f,
|
|
34
|
+
autoComplete: p,
|
|
34
35
|
value: o,
|
|
35
36
|
placeholder: c,
|
|
36
37
|
required: l,
|
|
37
|
-
disabled:
|
|
38
|
+
disabled: m,
|
|
38
39
|
onChange: (e) => s(e.target.value),
|
|
39
|
-
className: e(i, d && "border-status-error-text",
|
|
40
|
+
className: e(i, d && "border-status-error-text", m && "cursor-not-allowed opacity-60")
|
|
40
41
|
})
|
|
41
42
|
}), o = ({ id: n, label: a, value: o, onChange: s, placeholder: c, required: l, hint: u, error: d, rows: f = 3, disabled: p, className: m }) => /* @__PURE__ */ t(r, {
|
|
42
43
|
label: a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":[],"sources":["../../../src/coolandlovely/components/Field.tsx"],"sourcesContent":["/**\n * Form field primitives\n * @module coolandlovely/components\n *\n * Small, strictly-typed, token-only form controls used across the create/edit\n * forms (no third-party form lib — these wrap native inputs with consistent\n * labels, hints and error styling).\n */\n\nimport type { FC, ReactNode, ChangeEvent } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface FieldShellProps {\n label: string;\n htmlFor?: string;\n required?: boolean;\n hint?: string;\n error?: string;\n children: ReactNode;\n className?: string;\n}\n\nexport const FieldShell: FC<FieldShellProps> = ({\n label,\n htmlFor,\n required,\n hint,\n error,\n children,\n className,\n}) => (\n <div className={cn('flex flex-col gap-1.5', className)}>\n <label htmlFor={htmlFor} className=\"text-sm font-medium text-text-primary\">\n {label}\n {required && <span className=\"ml-0.5 text-status-error-text\">*</span>}\n </label>\n {children}\n {error ? (\n <p className=\"text-xs text-status-error-text\">{error}</p>\n ) : hint ? (\n <p className=\"text-xs text-text-secondary\">{hint}</p>\n ) : null}\n </div>\n);\n\nconst baseControl =\n 'w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\n\ninterface TextFieldProps {\n id?: string;\n label: string;\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n required?: boolean;\n hint?: string;\n error?: string;\n type?: 'text' | 'url' | 'number' | 'date';\n disabled?: boolean;\n className?: string;\n}\n\nexport const TextField: FC<TextFieldProps> = ({\n id,\n label,\n value,\n onChange,\n placeholder,\n required,\n hint,\n error,\n type = 'text',\n disabled,\n className,\n}) => (\n <FieldShell\n label={label}\n htmlFor={id}\n required={required}\n hint={hint}\n error={error}\n className={className}\n >\n <input\n id={id}\n type={type}\n value={value}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLInputElement>) => onChange(e.target.value)}\n className={cn(\n baseControl,\n error && 'border-status-error-text',\n disabled && 'cursor-not-allowed opacity-60'\n )}\n />\n </FieldShell>\n);\n\ninterface TextAreaFieldProps {\n id?: string;\n label: string;\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n required?: boolean;\n hint?: string;\n error?: string;\n rows?: number;\n disabled?: boolean;\n className?: string;\n}\n\nexport const TextAreaField: FC<TextAreaFieldProps> = ({\n id,\n label,\n value,\n onChange,\n placeholder,\n required,\n hint,\n error,\n rows = 3,\n disabled,\n className,\n}) => (\n <FieldShell\n label={label}\n htmlFor={id}\n required={required}\n hint={hint}\n error={error}\n className={className}\n >\n <textarea\n id={id}\n value={value}\n placeholder={placeholder}\n required={required}\n rows={rows}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => onChange(e.target.value)}\n className={cn(\n baseControl,\n 'resize-y',\n error && 'border-status-error-text',\n disabled && 'cursor-not-allowed opacity-60'\n )}\n />\n </FieldShell>\n);\n\ninterface ToggleFieldProps {\n id?: string;\n label: string;\n checked: boolean;\n onChange: (checked: boolean) => void;\n hint?: string;\n disabled?: boolean;\n className?: string;\n testId?: string;\n}\n\n/** A token-only checkbox row (used for boolean flags e.g. Featured). */\nexport const ToggleField: FC<ToggleFieldProps> = ({\n id,\n label,\n checked,\n onChange,\n hint,\n disabled,\n className,\n testId,\n}) => (\n <label\n htmlFor={id}\n className={cn(\n 'flex cursor-pointer items-start gap-3 rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5',\n disabled && 'cursor-not-allowed opacity-60',\n className\n )}\n >\n <input\n id={id}\n type=\"checkbox\"\n checked={checked}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLInputElement>) => onChange(e.target.checked)}\n data-testid={testId}\n className=\"mt-0.5 h-4 w-4 shrink-0 rounded border-border-seam text-action-primary-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n />\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary\">{label}</span>\n {hint && <span className=\"mt-0.5 block text-xs text-text-secondary\">{hint}</span>}\n </span>\n </label>\n);\n\ninterface SelectOption {\n value: string;\n label: string;\n}\n\ninterface SelectFieldProps {\n id?: string;\n label: string;\n value: string;\n onChange: (value: string) => void;\n options: SelectOption[];\n required?: boolean;\n hint?: string;\n error?: string;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nexport const SelectField: FC<SelectFieldProps> = ({\n id,\n label,\n value,\n onChange,\n options,\n required,\n hint,\n error,\n placeholder,\n disabled,\n className,\n}) => (\n <FieldShell\n label={label}\n htmlFor={id}\n required={required}\n hint={hint}\n error={error}\n className={className}\n >\n <select\n id={id}\n value={value}\n required={required}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLSelectElement>) => onChange(e.target.value)}\n className={cn(\n baseControl,\n error && 'border-status-error-text',\n disabled && 'cursor-not-allowed opacity-60'\n )}\n >\n {placeholder && <option value=\"\">{placeholder}</option>}\n {options.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </FieldShell>\n);\n"],"mappings":";;;AAsBA,IAAa,KAAmC,EAC9C,UACA,YACA,aACA,SACA,UACA,aACA,mBAEA,kBAAC,OAAD;CAAK,WAAW,EAAG,yBAAyB,EAAU;WAAtD;EACE,kBAAC,SAAD;GAAgB;GAAS,WAAU;aAAnC,CACG,GACA,KAAY,kBAAC,QAAD;IAAM,WAAU;cAAgC;IAAQ,CAAA,CAC/D;;EACP;EACA,IACC,kBAAC,KAAD;GAAG,WAAU;aAAkC;GAAU,CAAA,GACvD,IACF,kBAAC,KAAD;GAAG,WAAU;aAA+B;GAAS,CAAA,GACnD;EACA;IAGF,IACJ,
|
|
1
|
+
{"version":3,"file":"Field.js","names":[],"sources":["../../../src/coolandlovely/components/Field.tsx"],"sourcesContent":["/**\n * Form field primitives\n * @module coolandlovely/components\n *\n * Small, strictly-typed, token-only form controls used across the create/edit\n * forms (no third-party form lib — these wrap native inputs with consistent\n * labels, hints and error styling).\n */\n\nimport type { FC, ReactNode, ChangeEvent } from 'react';\nimport { cn } from '../utils/cn';\n\ninterface FieldShellProps {\n label: string;\n htmlFor?: string;\n required?: boolean;\n hint?: string;\n error?: string;\n children: ReactNode;\n className?: string;\n}\n\nexport const FieldShell: FC<FieldShellProps> = ({\n label,\n htmlFor,\n required,\n hint,\n error,\n children,\n className,\n}) => (\n <div className={cn('flex flex-col gap-1.5', className)}>\n <label htmlFor={htmlFor} className=\"text-sm font-medium text-text-primary\">\n {label}\n {required && <span className=\"ml-0.5 text-status-error-text\">*</span>}\n </label>\n {children}\n {error ? (\n <p className=\"text-xs text-status-error-text\">{error}</p>\n ) : hint ? (\n <p className=\"text-xs text-text-secondary\">{hint}</p>\n ) : null}\n </div>\n);\n\nconst baseControl =\n 'w-full rounded-lg border border-border-seam bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\n\ninterface TextFieldProps {\n id?: string;\n label: string;\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n required?: boolean;\n hint?: string;\n error?: string;\n type?: 'text' | 'url' | 'number' | 'date' | 'password';\n /** Native autocomplete hint (e.g. 'off' for one-time API credentials). */\n autoComplete?: string;\n disabled?: boolean;\n className?: string;\n}\n\nexport const TextField: FC<TextFieldProps> = ({\n id,\n label,\n value,\n onChange,\n placeholder,\n required,\n hint,\n error,\n type = 'text',\n autoComplete,\n disabled,\n className,\n}) => (\n <FieldShell\n label={label}\n htmlFor={id}\n required={required}\n hint={hint}\n error={error}\n className={className}\n >\n <input\n id={id}\n type={type}\n autoComplete={autoComplete}\n value={value}\n placeholder={placeholder}\n required={required}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLInputElement>) => onChange(e.target.value)}\n className={cn(\n baseControl,\n error && 'border-status-error-text',\n disabled && 'cursor-not-allowed opacity-60'\n )}\n />\n </FieldShell>\n);\n\ninterface TextAreaFieldProps {\n id?: string;\n label: string;\n value: string;\n onChange: (value: string) => void;\n placeholder?: string;\n required?: boolean;\n hint?: string;\n error?: string;\n rows?: number;\n disabled?: boolean;\n className?: string;\n}\n\nexport const TextAreaField: FC<TextAreaFieldProps> = ({\n id,\n label,\n value,\n onChange,\n placeholder,\n required,\n hint,\n error,\n rows = 3,\n disabled,\n className,\n}) => (\n <FieldShell\n label={label}\n htmlFor={id}\n required={required}\n hint={hint}\n error={error}\n className={className}\n >\n <textarea\n id={id}\n value={value}\n placeholder={placeholder}\n required={required}\n rows={rows}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLTextAreaElement>) => onChange(e.target.value)}\n className={cn(\n baseControl,\n 'resize-y',\n error && 'border-status-error-text',\n disabled && 'cursor-not-allowed opacity-60'\n )}\n />\n </FieldShell>\n);\n\ninterface ToggleFieldProps {\n id?: string;\n label: string;\n checked: boolean;\n onChange: (checked: boolean) => void;\n hint?: string;\n disabled?: boolean;\n className?: string;\n testId?: string;\n}\n\n/** A token-only checkbox row (used for boolean flags e.g. Featured). */\nexport const ToggleField: FC<ToggleFieldProps> = ({\n id,\n label,\n checked,\n onChange,\n hint,\n disabled,\n className,\n testId,\n}) => (\n <label\n htmlFor={id}\n className={cn(\n 'flex cursor-pointer items-start gap-3 rounded-lg border border-border-seam bg-bg-surface px-3 py-2.5',\n disabled && 'cursor-not-allowed opacity-60',\n className\n )}\n >\n <input\n id={id}\n type=\"checkbox\"\n checked={checked}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLInputElement>) => onChange(e.target.checked)}\n data-testid={testId}\n className=\"mt-0.5 h-4 w-4 shrink-0 rounded border-border-seam text-action-primary-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]\"\n />\n <span className=\"min-w-0\">\n <span className=\"block text-sm font-medium text-text-primary\">{label}</span>\n {hint && <span className=\"mt-0.5 block text-xs text-text-secondary\">{hint}</span>}\n </span>\n </label>\n);\n\ninterface SelectOption {\n value: string;\n label: string;\n}\n\ninterface SelectFieldProps {\n id?: string;\n label: string;\n value: string;\n onChange: (value: string) => void;\n options: SelectOption[];\n required?: boolean;\n hint?: string;\n error?: string;\n placeholder?: string;\n disabled?: boolean;\n className?: string;\n}\n\nexport const SelectField: FC<SelectFieldProps> = ({\n id,\n label,\n value,\n onChange,\n options,\n required,\n hint,\n error,\n placeholder,\n disabled,\n className,\n}) => (\n <FieldShell\n label={label}\n htmlFor={id}\n required={required}\n hint={hint}\n error={error}\n className={className}\n >\n <select\n id={id}\n value={value}\n required={required}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLSelectElement>) => onChange(e.target.value)}\n className={cn(\n baseControl,\n error && 'border-status-error-text',\n disabled && 'cursor-not-allowed opacity-60'\n )}\n >\n {placeholder && <option value=\"\">{placeholder}</option>}\n {options.map((opt) => (\n <option key={opt.value} value={opt.value}>\n {opt.label}\n </option>\n ))}\n </select>\n </FieldShell>\n);\n"],"mappings":";;;AAsBA,IAAa,KAAmC,EAC9C,UACA,YACA,aACA,SACA,UACA,aACA,mBAEA,kBAAC,OAAD;CAAK,WAAW,EAAG,yBAAyB,EAAU;WAAtD;EACE,kBAAC,SAAD;GAAgB;GAAS,WAAU;aAAnC,CACG,GACA,KAAY,kBAAC,QAAD;IAAM,WAAU;cAAgC;IAAQ,CAAA,CAC/D;;EACP;EACA,IACC,kBAAC,KAAD;GAAG,WAAU;aAAkC;GAAU,CAAA,GACvD,IACF,kBAAC,KAAD;GAAG,WAAU;aAA+B;GAAS,CAAA,GACnD;EACA;IAGF,IACJ,sMAkBW,KAAiC,EAC5C,OACA,UACA,UACA,aACA,gBACA,aACA,SACA,UACA,UAAO,QACP,iBACA,aACA,mBAEA,kBAAC,GAAD;CACS;CACP,SAAS;CACC;CACJ;CACC;CACI;WAEX,kBAAC,SAAD;EACM;EACE;EACQ;EACP;EACM;EACH;EACA;EACV,WAAW,MAAqC,EAAS,EAAE,OAAO,MAAM;EACxE,WAAW,EACT,GACA,KAAS,4BACT,KAAY,gCACb;EACD,CAAA;CACS,CAAA,EAiBF,KAAyC,EACpD,OACA,UACA,UACA,aACA,gBACA,aACA,SACA,UACA,UAAO,GACP,aACA,mBAEA,kBAAC,GAAD;CACS;CACP,SAAS;CACC;CACJ;CACC;CACI;WAEX,kBAAC,YAAD;EACM;EACG;EACM;EACH;EACJ;EACI;EACV,WAAW,MAAwC,EAAS,EAAE,OAAO,MAAM;EAC3E,WAAW,EACT,GACA,YACA,KAAS,4BACT,KAAY,gCACb;EACD,CAAA;CACS,CAAA,EAeF,KAAqC,EAChD,OACA,UACA,YACA,aACA,SACA,aACA,cACA,gBAEA,kBAAC,SAAD;CACE,SAAS;CACT,WAAW,EACT,wGACA,KAAY,iCACZ,EACD;WANH,CAQE,kBAAC,SAAD;EACM;EACJ,MAAK;EACI;EACC;EACV,WAAW,MAAqC,EAAS,EAAE,OAAO,QAAQ;EAC1E,eAAa;EACb,WAAU;EACV,CAAA,EACF,kBAAC,QAAD;EAAM,WAAU;YAAhB,CACE,kBAAC,QAAD;GAAM,WAAU;aAA+C;GAAa,CAAA,EAC3E,KAAQ,kBAAC,QAAD;GAAM,WAAU;aAA4C;GAAY,CAAA,CAC5E;IACD;IAsBG,KAAqC,EAChD,OACA,UACA,UACA,aACA,YACA,aACA,SACA,UACA,gBACA,aACA,mBAEA,kBAAC,GAAD;CACS;CACP,SAAS;CACC;CACJ;CACC;CACI;WAEX,kBAAC,UAAD;EACM;EACG;EACG;EACA;EACV,WAAW,MAAsC,EAAS,EAAE,OAAO,MAAM;EACzE,WAAW,EACT,GACA,KAAS,4BACT,KAAY,gCACb;YAVH,CAYG,KAAe,kBAAC,UAAD;GAAQ,OAAM;aAAI;GAAqB,CAAA,EACtD,EAAQ,KAAK,MACZ,kBAAC,UAAD;GAAwB,OAAO,EAAI;aAChC,EAAI;GACE,EAFI,EAAI,MAER,CACT,CACK;;CACE,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CooBulkCatalogImportResult, CooExternalCatalogPreview, CooExternalCatalogSourceInput } from '../types';
|
|
2
|
+
|
|
3
|
+
export declare const usePreviewExternalCatalog: () => import('@tanstack/react-query').UseMutationResult<CooExternalCatalogPreview, Error, CooExternalCatalogSourceInput, unknown>;
|
|
4
|
+
/** Progress of an import run, for the progress bar. */
|
|
5
|
+
export interface CatalogImportProgress {
|
|
6
|
+
phase: 'images' | 'saving';
|
|
7
|
+
done: number;
|
|
8
|
+
total: number;
|
|
9
|
+
}
|
|
10
|
+
export interface ImportExternalCatalogArgs {
|
|
11
|
+
preview: CooExternalCatalogPreview;
|
|
12
|
+
/** Brand name and handle as the merchant confirmed them. */
|
|
13
|
+
brandName: string;
|
|
14
|
+
brandHandle: string;
|
|
15
|
+
/** Items the merchant kept (by externalId). */
|
|
16
|
+
selectedIds: ReadonlySet<string>;
|
|
17
|
+
copyImages: boolean;
|
|
18
|
+
onProgress?: (progress: CatalogImportProgress) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface ImportExternalCatalogResult extends CooBulkCatalogImportResult {
|
|
21
|
+
imagesCopied: number;
|
|
22
|
+
imagesFailed: number;
|
|
23
|
+
}
|
|
24
|
+
export declare const useImportExternalCatalog: () => import('@tanstack/react-query').UseMutationResult<ImportExternalCatalogResult, Error, ImportExternalCatalogArgs, unknown>;
|
|
25
|
+
//# sourceMappingURL=useCatalogImport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCatalogImport.d.ts","sourceRoot":"","sources":["../../../src/coolandlovely/hooks/useCatalogImport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH,OAAO,KAAK,EACV,0BAA0B,EAI1B,yBAAyB,EACzB,6BAA6B,EAC9B,MAAM,UAAU,CAAC;AAqBlB,eAAO,MAAM,yBAAyB,mIAcrC,CAAC;AAEF,uDAAuD;AACvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,yBAAyB;IACxC,OAAO,EAAE,yBAAyB,CAAC;IACnC,4DAA4D;IAC5D,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACxD;AAED,MAAM,WAAW,2BAA4B,SAAQ,0BAA0B;IAC7E,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;CACtB;AA6ED,eAAO,MAAM,wBAAwB,iIA4FpC,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { useCoolAndLovely as e } from "../context/CoolAndLovelyContext.js";
|
|
2
|
+
import "../context/index.js";
|
|
3
|
+
import { coolQuery as t } from "./useCoolAndLovelyApi.js";
|
|
4
|
+
import { COO_FILE_FOLDERS as n, uploadImageToFiles as r } from "./useFiles.js";
|
|
5
|
+
import { useMutation as i, useQueryClient as a } from "@tanstack/react-query";
|
|
6
|
+
//#region src/coolandlovely/hooks/useCatalogImport.ts
|
|
7
|
+
var o = "coolandlovely", s = 4, c = 10 * 1024 * 1024, l = "\n provider sourceUrl truncated warnings\n brand { name handle tagline bio websiteUrl logoUrl tags }\n collections { name description tags }\n items {\n externalId collectionName name description category sku price currency\n colours sizes materials tags imageUrl sourceUrl\n }\n", u = () => {
|
|
8
|
+
let { apiGatewayUrl: n } = e();
|
|
9
|
+
return i({ mutationFn: async (e) => (await t(`mutation CooPreviewExternalCatalog($source: CooExternalCatalogSourceInput!) {
|
|
10
|
+
cooPreviewExternalCatalog(source: $source) { ${l} }
|
|
11
|
+
}`, { source: e }, n)).cooPreviewExternalCatalog });
|
|
12
|
+
};
|
|
13
|
+
function d(e, t, n) {
|
|
14
|
+
let r = new URL(e).pathname.split("/").pop() ?? "";
|
|
15
|
+
return /\.[a-z0-9]{2,5}$/i.test(r) ? r.slice(-120) : `${t}.${n.split("/")[1]?.split("+")[0] ?? "jpg"}`;
|
|
16
|
+
}
|
|
17
|
+
async function f(e, t, n, i) {
|
|
18
|
+
try {
|
|
19
|
+
let a = await fetch(e, {
|
|
20
|
+
mode: "cors",
|
|
21
|
+
credentials: "omit",
|
|
22
|
+
referrerPolicy: "no-referrer"
|
|
23
|
+
});
|
|
24
|
+
if (!a.ok) return null;
|
|
25
|
+
let o = await a.blob();
|
|
26
|
+
return !o.type.startsWith("image/") || o.size === 0 || o.size > c ? null : (await r(new File([o], d(e, t, o.type), { type: o.type }), i, n)).id;
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
async function p(e, t, n) {
|
|
32
|
+
let r = Array(e.length), i = 0;
|
|
33
|
+
return await Promise.all(Array.from({ length: Math.min(t, e.length) }, async () => {
|
|
34
|
+
for (; i < e.length;) {
|
|
35
|
+
let t = i;
|
|
36
|
+
i += 1, r[t] = await n(e[t], t);
|
|
37
|
+
}
|
|
38
|
+
})), r;
|
|
39
|
+
}
|
|
40
|
+
function m(e, t) {
|
|
41
|
+
return {
|
|
42
|
+
collectionName: e.collectionName ?? "",
|
|
43
|
+
name: e.name,
|
|
44
|
+
...e.description ? { description: e.description } : {},
|
|
45
|
+
category: e.category,
|
|
46
|
+
...e.sku ? { sku: e.sku } : {},
|
|
47
|
+
...t ? { imageFileId: t } : {},
|
|
48
|
+
price: e.price,
|
|
49
|
+
currency: e.currency,
|
|
50
|
+
colours: e.colours,
|
|
51
|
+
sizes: e.sizes,
|
|
52
|
+
materials: e.materials,
|
|
53
|
+
tags: e.tags
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var h = () => {
|
|
57
|
+
let r = a(), { apiGatewayUrl: c } = e();
|
|
58
|
+
return i({
|
|
59
|
+
mutationFn: async ({ preview: e, brandName: r, brandHandle: i, selectedIds: a, copyImages: o, onProgress: l }) => {
|
|
60
|
+
let u = e.items.filter((e) => a.has(e.externalId)), d = 0, h = 0, g = 0, _ = o ? u.filter((e) => e.imageUrl).length : 0, v = o && e.brand.logoUrl ? 1 : 0, y = _ + v;
|
|
61
|
+
l?.({
|
|
62
|
+
phase: "images",
|
|
63
|
+
done: g,
|
|
64
|
+
total: y
|
|
65
|
+
});
|
|
66
|
+
let b = (e) => {
|
|
67
|
+
e ? d += 1 : h += 1, g += 1, l?.({
|
|
68
|
+
phase: "images",
|
|
69
|
+
done: g,
|
|
70
|
+
total: y
|
|
71
|
+
});
|
|
72
|
+
}, x = null;
|
|
73
|
+
v && e.brand.logoUrl && (x = await f(e.brand.logoUrl, `${i}-logo`, n.brands, c), b(!!x));
|
|
74
|
+
let S = await p(u, s, async (e, t) => {
|
|
75
|
+
if (!o || !e.imageUrl) return null;
|
|
76
|
+
let r = await f(e.imageUrl, `${i}-${t + 1}`, n.items, c);
|
|
77
|
+
return b(!!r), r;
|
|
78
|
+
}), C = new Set(u.map((e) => e.collectionName).filter(Boolean)), w = {
|
|
79
|
+
brand: {
|
|
80
|
+
name: r,
|
|
81
|
+
handle: i,
|
|
82
|
+
...e.brand.tagline ? { tagline: e.brand.tagline } : {},
|
|
83
|
+
...e.brand.bio ? { bio: e.brand.bio } : {},
|
|
84
|
+
...e.brand.websiteUrl ? { websiteUrl: e.brand.websiteUrl } : {},
|
|
85
|
+
...x ? { logoFileId: x } : {},
|
|
86
|
+
tags: e.brand.tags
|
|
87
|
+
},
|
|
88
|
+
collections: e.collections.filter((e) => C.has(e.name)).map((e) => ({
|
|
89
|
+
name: e.name,
|
|
90
|
+
...e.description ? { description: e.description } : {},
|
|
91
|
+
tags: e.tags
|
|
92
|
+
})),
|
|
93
|
+
items: u.map((e, t) => m(e, S[t] ?? null))
|
|
94
|
+
};
|
|
95
|
+
return l?.({
|
|
96
|
+
phase: "saving",
|
|
97
|
+
done: g,
|
|
98
|
+
total: y
|
|
99
|
+
}), {
|
|
100
|
+
...(await t("mutation CooBulkImportCatalog($input: CooBulkImportCatalogInput!) {\n cooBulkImportCatalog(input: $input) {\n brand { id name handle }\n collectionsCreated\n itemsCreated\n }\n }", { input: w }, c)).cooBulkImportCatalog,
|
|
101
|
+
imagesCopied: d,
|
|
102
|
+
imagesFailed: h
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
onSuccess: () => {
|
|
106
|
+
r.invalidateQueries({ queryKey: [o, "brands"] }), r.invalidateQueries({ queryKey: [o, "collections"] }), r.invalidateQueries({ queryKey: [o, "style-items"] });
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
export { h as useImportExternalCatalog, u as usePreviewExternalCatalog };
|
|
112
|
+
|
|
113
|
+
//# sourceMappingURL=useCatalogImport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCatalogImport.js","names":[],"sources":["../../../src/coolandlovely/hooks/useCatalogImport.ts"],"sourcesContent":["/**\n * Catalog import hooks (BOFF-3384)\n * @module coolandlovely/hooks\n *\n * Brands onboard an existing catalog from Shopify, WooCommerce or BigCommerce:\n *\n * 1. `usePreviewExternalCatalog` calls `cooPreviewExternalCatalog`, which reads\n * the merchant's store with the credentials typed into the form (used for\n * that one request, never stored) and returns the catalog mapped onto\n * CoolAndLovely brand / collection / style-item shapes.\n * 2. `useImportExternalCatalog` copies each product image (and the store logo)\n * from the platform's CDN into wspace-files, then imports everything in\n * one transaction with `cooBulkImportCatalog`, so CoolAndLovely only ever\n * stores federated File ids, never third-party image URLs.\n */\n\nimport { useMutation, useQueryClient } from '@tanstack/react-query';\n\nimport { useCoolAndLovely } from '../context';\nimport type {\n CooBulkCatalogImportResult,\n CooBulkImportCatalogInput,\n CooBulkImportCatalogItemInput,\n CooExternalCatalogItemPreview,\n CooExternalCatalogPreview,\n CooExternalCatalogSourceInput,\n} from '../types';\nimport { coolQuery } from './useCoolAndLovelyApi';\nimport { COO_FILE_FOLDERS, uploadImageToFiles } from './useFiles';\n\nconst QK = 'coolandlovely';\n\n/** Images copied in parallel; small enough to stay polite to the platform CDN. */\nconst IMAGE_CONCURRENCY = 4;\n/** Largest image copied into Files; bigger ones are imported without an image. */\nconst MAX_IMAGE_BYTES = 10 * 1024 * 1024;\n\nconst PREVIEW_FIELDS = `\n provider sourceUrl truncated warnings\n brand { name handle tagline bio websiteUrl logoUrl tags }\n collections { name description tags }\n items {\n externalId collectionName name description category sku price currency\n colours sizes materials tags imageUrl sourceUrl\n }\n`;\n\nexport const usePreviewExternalCatalog = () => {\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async (source: CooExternalCatalogSourceInput) => {\n const data = await coolQuery<{ cooPreviewExternalCatalog: CooExternalCatalogPreview }>(\n `mutation CooPreviewExternalCatalog($source: CooExternalCatalogSourceInput!) {\n cooPreviewExternalCatalog(source: $source) { ${PREVIEW_FIELDS} }\n }`,\n { source },\n apiGatewayUrl\n );\n return data.cooPreviewExternalCatalog;\n },\n });\n};\n\n/** Progress of an import run, for the progress bar. */\nexport interface CatalogImportProgress {\n phase: 'images' | 'saving';\n done: number;\n total: number;\n}\n\nexport interface ImportExternalCatalogArgs {\n preview: CooExternalCatalogPreview;\n /** Brand name and handle as the merchant confirmed them. */\n brandName: string;\n brandHandle: string;\n /** Items the merchant kept (by externalId). */\n selectedIds: ReadonlySet<string>;\n copyImages: boolean;\n onProgress?: (progress: CatalogImportProgress) => void;\n}\n\nexport interface ImportExternalCatalogResult extends CooBulkCatalogImportResult {\n imagesCopied: number;\n imagesFailed: number;\n}\n\nfunction fileNameFor(url: string, fallback: string, mimeType: string): string {\n const last = new URL(url).pathname.split('/').pop() ?? '';\n if (/\\.[a-z0-9]{2,5}$/i.test(last)) return last.slice(-120);\n const extension = mimeType.split('/')[1]?.split('+')[0] ?? 'jpg';\n return `${fallback}.${extension}`;\n}\n\n/**\n * Copy one remote image into wspace-files. Returns the File id, or null when\n * the image cannot be fetched (CORS, 404, not an image, too large) — the item\n * is then imported without an image rather than failing the whole import.\n */\nasync function copyImageToFiles(\n url: string,\n name: string,\n folder: string,\n apiGatewayUrl?: string\n): Promise<string | null> {\n try {\n const response = await fetch(url, {\n mode: 'cors',\n credentials: 'omit',\n referrerPolicy: 'no-referrer',\n });\n if (!response.ok) return null;\n const blob = await response.blob();\n if (!blob.type.startsWith('image/') || blob.size === 0 || blob.size > MAX_IMAGE_BYTES)\n return null;\n const file = new File([blob], fileNameFor(url, name, blob.type), { type: blob.type });\n const uploaded = await uploadImageToFiles(file, apiGatewayUrl, folder);\n return uploaded.id;\n } catch {\n return null;\n }\n}\n\n/** Run `task` over `items` with at most `limit` in flight, preserving order. */\nasync function mapWithConcurrency<T, R>(\n items: readonly T[],\n limit: number,\n task: (item: T, index: number) => Promise<R>\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n const worker = async () => {\n while (next < items.length) {\n const index = next;\n next += 1;\n results[index] = await task(items[index] as T, index);\n }\n };\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));\n return results;\n}\n\nfunction toImportItem(\n item: CooExternalCatalogItemPreview,\n imageFileId: string | null\n): CooBulkImportCatalogItemInput {\n return {\n collectionName: item.collectionName ?? '',\n name: item.name,\n ...(item.description ? { description: item.description } : {}),\n category: item.category,\n ...(item.sku ? { sku: item.sku } : {}),\n ...(imageFileId ? { imageFileId } : {}),\n price: item.price,\n currency: item.currency,\n colours: item.colours,\n sizes: item.sizes,\n materials: item.materials,\n tags: item.tags,\n };\n}\n\nexport const useImportExternalCatalog = () => {\n const queryClient = useQueryClient();\n const { apiGatewayUrl } = useCoolAndLovely();\n return useMutation({\n mutationFn: async ({\n preview,\n brandName,\n brandHandle,\n selectedIds,\n copyImages,\n onProgress,\n }: ImportExternalCatalogArgs): Promise<ImportExternalCatalogResult> => {\n const items = preview.items.filter((item) => selectedIds.has(item.externalId));\n let imagesCopied = 0;\n let imagesFailed = 0;\n let done = 0;\n const imageJobs = copyImages ? items.filter((item) => item.imageUrl).length : 0;\n const logoJob = copyImages && preview.brand.logoUrl ? 1 : 0;\n const total = imageJobs + logoJob;\n onProgress?.({ phase: 'images', done, total });\n\n const tick = (copied: boolean) => {\n if (copied) imagesCopied += 1;\n else imagesFailed += 1;\n done += 1;\n onProgress?.({ phase: 'images', done, total });\n };\n\n let logoFileId: string | null = null;\n if (logoJob && preview.brand.logoUrl) {\n logoFileId = await copyImageToFiles(\n preview.brand.logoUrl,\n `${brandHandle}-logo`,\n COO_FILE_FOLDERS.brands,\n apiGatewayUrl\n );\n tick(Boolean(logoFileId));\n }\n\n const imageIds = await mapWithConcurrency(items, IMAGE_CONCURRENCY, async (item, index) => {\n if (!copyImages || !item.imageUrl) return null;\n const id = await copyImageToFiles(\n item.imageUrl,\n `${brandHandle}-${index + 1}`,\n COO_FILE_FOLDERS.items,\n apiGatewayUrl\n );\n tick(Boolean(id));\n return id;\n });\n\n const usedCollections = new Set(items.map((item) => item.collectionName).filter(Boolean));\n const input: CooBulkImportCatalogInput = {\n brand: {\n name: brandName,\n handle: brandHandle,\n ...(preview.brand.tagline ? { tagline: preview.brand.tagline } : {}),\n ...(preview.brand.bio ? { bio: preview.brand.bio } : {}),\n ...(preview.brand.websiteUrl ? { websiteUrl: preview.brand.websiteUrl } : {}),\n ...(logoFileId ? { logoFileId } : {}),\n tags: preview.brand.tags,\n },\n collections: preview.collections\n .filter((collection) => usedCollections.has(collection.name))\n .map((collection) => ({\n name: collection.name,\n ...(collection.description ? { description: collection.description } : {}),\n tags: collection.tags,\n })),\n items: items.map((item, index) => toImportItem(item, imageIds[index] ?? null)),\n };\n\n onProgress?.({ phase: 'saving', done, total });\n const data = await coolQuery<{ cooBulkImportCatalog: CooBulkCatalogImportResult }>(\n `mutation CooBulkImportCatalog($input: CooBulkImportCatalogInput!) {\n cooBulkImportCatalog(input: $input) {\n brand { id name handle }\n collectionsCreated\n itemsCreated\n }\n }`,\n { input },\n apiGatewayUrl\n );\n return { ...data.cooBulkImportCatalog, imagesCopied, imagesFailed };\n },\n onSuccess: () => {\n void queryClient.invalidateQueries({ queryKey: [QK, 'brands'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'collections'] });\n void queryClient.invalidateQueries({ queryKey: [QK, 'style-items'] });\n },\n });\n};\n"],"mappings":";;;;;;AA8BA,IAAM,IAAK,iBAGL,IAAoB,GAEpB,IAAkB,KAAK,OAAO,MAE9B,IAAiB,sSAUV,UAAkC;CAC7C,IAAM,EAAE,qBAAkB,GAAkB;AAC5C,QAAO,EAAY,EACjB,YAAY,OAAO,OACJ,MAAM,EACjB;yDACiD,EAAe;YAEhE,EAAE,WAAQ,EACV,EACD,EACW,2BAEf,CAAC;;AA0BJ,SAAS,EAAY,GAAa,GAAkB,GAA0B;CAC5E,IAAM,IAAO,IAAI,IAAI,EAAI,CAAC,SAAS,MAAM,IAAI,CAAC,KAAK,IAAI;AAGvD,QAFI,oBAAoB,KAAK,EAAK,GAAS,EAAK,MAAM,KAAK,GAEpD,GAAG,EAAS,GADD,EAAS,MAAM,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,MAAM;;AAS7D,eAAe,EACb,GACA,GACA,GACA,GACwB;AACxB,KAAI;EACF,IAAM,IAAW,MAAM,MAAM,GAAK;GAChC,MAAM;GACN,aAAa;GACb,gBAAgB;GACjB,CAAC;AACF,MAAI,CAAC,EAAS,GAAI,QAAO;EACzB,IAAM,IAAO,M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W,cAAc,EAAE,aAAa,EAAW,aAAa,GAAG,EAAE;KACzE,MAAM,EAAW;KAClB,EAAE;IACL,OAAO,EAAM,KAAK,GAAM,MAAU,EAAa,GAAM,EAAS,MAAU,KAAK,CAAC;IAC/E;AAcD,UAZA,IAAa;IAAE,OAAO;IAAU;IAAM;IAAO,CAAC,EAYvC;IAAE,IAXI,MAAM,EACjB,gPAOA,EAAE,UAAO,EACT,EACD,EACgB;IAAsB;IAAc;IAAc;;EAErE,iBAAiB;AAGV,GAFA,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,SAAS,EAAE,CAAC,EAC3D,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,cAAc,EAAE,CAAC,EAChE,EAAY,kBAAkB,EAAE,UAAU,CAAC,GAAI,cAAc,EAAE,CAAC;;EAExE,CAAC"}
|
|
@@ -85,10 +85,13 @@ async function p(e, t, n = a.items, r) {
|
|
|
85
85
|
name: b?.name ?? e.name
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
|
-
async function m(e, t, n = a.items
|
|
88
|
+
async function m(e, t, n = a.items) {
|
|
89
|
+
return p(e, t, n);
|
|
90
|
+
}
|
|
91
|
+
async function h(e, t, n = a.items, r) {
|
|
89
92
|
return p(e, t, n, r);
|
|
90
93
|
}
|
|
91
|
-
function
|
|
94
|
+
function g(n) {
|
|
92
95
|
let { apiGatewayUrl: r } = e();
|
|
93
96
|
return t({
|
|
94
97
|
queryKey: [
|
|
@@ -106,6 +109,6 @@ function h(n) {
|
|
|
106
109
|
});
|
|
107
110
|
}
|
|
108
111
|
//#endregion
|
|
109
|
-
export { a as COO_FILE_FOLDERS, m as
|
|
112
|
+
export { a as COO_FILE_FOLDERS, m as uploadImageToFiles, h as uploadImageToFilesWithProgress, g as useFileUrl };
|
|
110
113
|
|
|
111
114
|
//# sourceMappingURL=useFiles.js.map
|