@revenexx/cover 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/app/components/account/carts/AccountCartsTable.vue +4 -2
  2. package/app/components/auth/AuthLoginPanel.vue +71 -16
  3. package/app/components/auth/AuthRegisterPanel.vue +1 -1
  4. package/app/components/cart/recommend/CartCrossSell.vue +2 -1
  5. package/app/components/cart/switcher/CartSwitcher.vue +5 -2
  6. package/app/components/listing/ListingFilterBar.vue +1 -0
  7. package/app/components/listing/ListingFilterDrawer.vue +1 -0
  8. package/app/components/listing/ListingFilterRail.vue +1 -0
  9. package/app/components/search/filter/SearchFacets.vue +10 -3
  10. package/app/components/search/filter/SearchFacetsBar.vue +7 -3
  11. package/app/components/search/filter/SearchFacetsDrawer.vue +7 -2
  12. package/app/components/ui/forms/SearchInput.vue +4 -1
  13. package/app/composables/useAuthStore.ts +4 -2
  14. package/app/composables/useFacetMeta.ts +6 -6
  15. package/app/composables/useProductListing.ts +18 -2
  16. package/app/composables/useSearchListing.ts +16 -0
  17. package/app/interfaces/auth.ts +12 -2
  18. package/app/interfaces/shopSettings.ts +84 -0
  19. package/app/shared/locale.ts +114 -0
  20. package/i18n/locales/de/auth.json +41 -2
  21. package/i18n/locales/de/cart.json +2 -1
  22. package/i18n/locales/en/auth.json +41 -2
  23. package/i18n/locales/en/cart.json +2 -1
  24. package/nuxt.config.ts +22 -0
  25. package/package.json +1 -1
  26. package/server/api/account/quotes/[id]/order.post.ts +14 -3
  27. package/server/api/auth/login.post.ts +16 -3
  28. package/server/api/cart/calculate.post.ts +4 -0
  29. package/server/api/carts/[id]/activate.post.ts +7 -0
  30. package/server/api/carts/[id]/index.delete.ts +2 -0
  31. package/server/api/carts/index.post.ts +4 -0
  32. package/server/api/categories/[slug]/subcategories.get.ts +34 -31
  33. package/server/api/orders/index.post.ts +78 -31
  34. package/server/api/payment/psp-config.get.ts +11 -21
  35. package/server/api/quotes/request.post.ts +2 -2
  36. package/server/api/typesense/search.post.ts +61 -317
  37. package/server/api/typesense/suggest.post.ts +14 -9
  38. package/server/{api/typesense/drop.get.ts → dev/typesense/drop.ts} +2 -1
  39. package/server/{api/typesense/health.get.ts → dev/typesense/health.ts} +1 -0
  40. package/server/dev/typesense/seed.ts +59 -0
  41. package/server/dev/typesense/seedDocuments.ts +105 -0
  42. package/server/interfaces/auth.ts +10 -1
  43. package/server/routes/punchout/start.get.ts +44 -16
  44. package/server/services/ApiAuthService.ts +22 -6
  45. package/server/services/ApiBrandService.ts +28 -42
  46. package/server/services/ApiCartService.ts +64 -22
  47. package/server/services/ApiProductService.ts +10 -11
  48. package/server/services/MockAuthService.ts +21 -2
  49. package/server/utils/buyerIdentity.ts +11 -0
  50. package/server/utils/cartOwnership.ts +40 -0
  51. package/server/utils/liveCatalog.ts +132 -49
  52. package/server/utils/liveListingSearch.ts +201 -0
  53. package/server/utils/livePrices.ts +24 -9
  54. package/server/utils/orderLinePrices.ts +72 -0
  55. package/server/utils/paymentFee.ts +59 -0
  56. package/server/utils/pspConfig.ts +42 -0
  57. package/server/utils/revenexxSdk.ts +25 -2
  58. package/server/utils/searchClient.ts +305 -0
  59. package/server/utils/searchMultiSearchFallback.ts +216 -0
  60. package/server/utils/shopSettings.ts +5 -0
  61. package/server/api/typesense/seed.get.ts +0 -111
@@ -1,111 +0,0 @@
1
- import productsData from "../../data/product-list.json";
2
- import { PRODUCTS_COLLECTION, productsSchema } from "../../utils/productsSchema";
3
-
4
- const MAX_COUNT = 5000;
5
-
6
- function mapEntry(entry: (typeof productsData)[number], idOffset: number) {
7
- const product = entry.product[0];
8
- // Catalog list price only — a sort/filter key. Price tiers + stock are the
9
- // Offer domain (MockOfferService), never indexed.
10
- const prices = entry.prices[0] as Record<string, number>;
11
- const longDescription = entry.descriptions.find(d => d.type === "long");
12
- const mainCategory = entry.categories.find(c => c.type === "main");
13
- const subcategory = entry.categories.find(c => c.type === "subcategory");
14
- const slugCategory = entry.categories.find(c => c.type === "slug");
15
- const mainImage = entry.images.find(i => i.priority === 1);
16
- const basePrice = prices["1"] ?? Object.values(prices)[0] ?? 0;
17
-
18
- const slugPath = slugCategory?.name ?? "";
19
- const slugSegments = slugPath.split("/").filter(Boolean);
20
- const categorySlug = slugSegments[0] ?? "";
21
- const candidateSubcategory = slugSegments[1];
22
- const subcategorySlug = candidateSubcategory
23
- && candidateSubcategory !== "product"
24
- && candidateSubcategory !== "products"
25
- ? candidateSubcategory
26
- : undefined;
27
-
28
- const id = idOffset === 0 ? product.id : product.id + idOffset * 100_000;
29
- const suffix = idOffset === 0 ? "" : ` #${idOffset}`;
30
-
31
- return {
32
- id: String(id),
33
- name: `${product.name}${suffix}`,
34
- sku: idOffset === 0 ? product.sku : `${product.sku}-${idOffset}`,
35
- manufacturer: product.manufacturer,
36
- available: product.available,
37
- price: basePrice,
38
- description: longDescription?.content,
39
- category: mainCategory?.name ?? "",
40
- categorySlug,
41
- subcategory: subcategory?.name,
42
- ...(subcategorySlug ? { subcategorySlug } : {}),
43
- slug: idOffset === 0 ? slugPath : `${slugPath}-${idOffset}`,
44
- image: mainImage?.url,
45
- taxRate: entry.tax.rate,
46
- };
47
- }
48
-
49
- export default defineEventHandler(async (event) => {
50
- const query = getQuery(event);
51
- const requestedCount = parseInt(String(query.count ?? "0"), 10);
52
- const targetCount = requestedCount > 0
53
- ? Math.min(requestedCount, MAX_COUNT)
54
- : productsData.length;
55
-
56
- const ts = useTypesense();
57
-
58
- try {
59
- const collections = await ts.collections().retrieve();
60
- const exists = collections.some(c => c.name === PRODUCTS_COLLECTION);
61
- if (exists) {
62
- await ts.collections(PRODUCTS_COLLECTION).delete();
63
- }
64
-
65
- await ts.collections().create(productsSchema);
66
- }
67
- catch (err) {
68
- getLogService().error("Typesense error: seed collection setup", toErrorContext(err));
69
- throw createError({ statusCode: 503, message: "Search service unavailable" });
70
- }
71
-
72
- const documents: ReturnType<typeof mapEntry>[] = [];
73
- let idOffset = 0;
74
-
75
- while (documents.length < targetCount) {
76
- for (const entry of productsData) {
77
- if (documents.length >= targetCount) {
78
- break;
79
- }
80
- documents.push(mapEntry(entry, idOffset));
81
- }
82
- idOffset++;
83
- }
84
-
85
- let result: { success: boolean; error?: string; document?: unknown }[] = [];
86
-
87
- try {
88
- result = await ts.collections(PRODUCTS_COLLECTION).documents().import(
89
- documents,
90
- { action: "upsert" },
91
- );
92
- }
93
- catch (e: unknown) {
94
- if (e && typeof e === "object" && "importResults" in e) {
95
- result = (e as { importResults: typeof result }).importResults;
96
- }
97
- else {
98
- getLogService().error("Typesense error: seed import", toErrorContext(e));
99
- throw e;
100
- }
101
- }
102
-
103
- const failed = result.filter(r => !r.success);
104
-
105
- return {
106
- total: documents.length,
107
- indexed: documents.length - failed.length,
108
- failed: failed.length,
109
- errors: failed,
110
- };
111
- });