@mamindom/contracts 1.0.140 → 1.0.142

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.
@@ -13,36 +13,16 @@ export const protobufPackage = "catalog.v1";
13
13
 
14
14
  export interface GetShopFiltersRequest {
15
15
  categoryId: string;
16
- /**
17
- * Поточно застосовані фільтри. Counts по кожному facet рахуються
18
- * з виключенням саме того facet — щоб лічильники реагували на вибір.
19
- */
20
16
  brandIds: string[];
21
17
  colorIds: string[];
22
18
  sizeIds: string[];
23
19
  priceMin?: number | undefined;
24
20
  priceMax?: number | undefined;
25
21
  inStock?: boolean | undefined;
26
- search?:
27
- | string
28
- | undefined;
29
- /**
30
- * Обмеження множини товарів акцією — фасети рахуються тільки
31
- * по товарах, що належать поточній акції.
32
- */
33
- promotionFilter?:
34
- | PromotionFilter
35
- | undefined;
36
- /** Динамічні атрибути окрім color/size (матеріал, виробник тощо). */
22
+ search?: string | undefined;
23
+ promotionFilter?: PromotionFilter | undefined;
37
24
  attributeValueIds: string[];
38
- /**
39
- * Явний прапор "ціновий фільтр активний". Без нього неможливо
40
- * відрізнити "користувач не вибирав" від "обрав від 0".
41
- */
42
- priceActive?:
43
- | boolean
44
- | undefined;
45
- /** 'uk' | 'ru' — для локалізації labels у відповіді (дефолт uk). */
25
+ priceActive?: boolean | undefined;
46
26
  locale?: string | undefined;
47
27
  }
48
28
 
@@ -53,7 +33,14 @@ export interface GetShopFiltersResponse {
53
33
  attributes: ShopFilterAttribute[];
54
34
  priceMin: number;
55
35
  priceMax: number;
56
- subcategoryIds: string[];
36
+ subcategories: ShopFilterSubcategory[];
37
+ }
38
+
39
+ export interface ShopFilterSubcategory {
40
+ id: string;
41
+ slug: string;
42
+ label: string;
43
+ count: number;
57
44
  }
58
45
 
59
46
  export interface ShopFilterOption {
@@ -71,10 +58,6 @@ export interface ShopFilterColorOption {
71
58
 
72
59
  export interface ShopFilterAttribute {
73
60
  slug: string;
74
- /**
75
- * Локалізована назва атрибута (на стороні gateway вже згорнута у
76
- * одну рядкову label згідно locale запиту).
77
- */
78
61
  label: string;
79
62
  values: ShopFilterOption[];
80
63
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mamindom/contracts",
3
3
  "description": "proto",
4
- "version": "1.0.140",
4
+ "version": "1.0.142",
5
5
  "main": "./dist/src/index.js",
6
6
  "types": "./dist/src/index.d.ts",
7
7
  "exports": {
package/proto/audit.proto CHANGED
@@ -11,11 +11,11 @@ message LogActionRequest {
11
11
  optional string actor_id = 1;
12
12
  optional string actor_name = 2;
13
13
  optional string actor_email = 3;
14
- string action = 4; // e.g. "order.cancelled", "product.price_changed"
15
- string target_type = 5; // e.g. "order", "product", "role"
14
+ string action = 4;
15
+ string target_type = 5;
16
16
  optional string target_id = 6;
17
- optional string summary = 7; // human-readable summary
18
- optional string before_json = 8; // serialized JSON snapshot (small!)
17
+ optional string summary = 7;
18
+ optional string before_json = 8;
19
19
  optional string after_json = 9;
20
20
  optional string ip = 10;
21
21
  optional string user_agent = 11;
@@ -32,8 +32,8 @@ message ListAuditRequest {
32
32
  optional string target_type = 4;
33
33
  optional string target_id = 5;
34
34
  optional string action = 6;
35
- optional string action_group = 7; // "orders" matches order.* etc
36
- optional string from = 8; // ISO date
35
+ optional string action_group = 7;
36
+ optional string from = 8;
37
37
  optional string to = 9;
38
38
  }
39
39
 
@@ -118,7 +118,7 @@ message UpdateBannerRequest {
118
118
  string id = 1;
119
119
  optional string slug = 2;
120
120
  map<string, string> name = 3;
121
- // empty = не оновлювати; non-empty = заміна повного списку плейсментів.
121
+
122
122
  repeated BannerPlacement placements = 4;
123
123
  optional bool status = 5;
124
124
  optional int32 sort_order = 6;
@@ -10,14 +10,13 @@ service BonusSettingsService {
10
10
 
11
11
 
12
12
  message BonusSettingsResponse {
13
- // Курс нарахування бонусів від суми замовлення (0.02 = 2%).
13
+
14
14
  double earn_rate = 1;
15
- // Курс списання бонусів (1 бонус = N грн, default 1.0).
15
+
16
16
  double redeem_rate = 2;
17
- // Мінімальна сума замовлення для нарахування бонусів (0 = без обмеження).
17
+
18
18
  double min_order_for_earn = 3;
19
- // Максимальний відсоток від суми замовлення, який можна оплатити бонусами
20
- // (1.0 = до 100%, 0.5 = до 50%; 0 — без обмеження).
19
+
21
20
  double max_redeem_share = 4;
22
21
 
23
22
  string updated_at = 5;
package/proto/brand.proto CHANGED
@@ -30,7 +30,7 @@ message BrandResponse {
30
30
  optional string guid_1c = 8;
31
31
  optional string image_id = 9;
32
32
 
33
- // Кількість АКТИВНИХ товарів бренду (для shop UI).
33
+
34
34
  int32 product_count = 10;
35
35
  }
36
36
 
@@ -42,7 +42,6 @@ service BundleService {
42
42
  }
43
43
 
44
44
 
45
- // ─── Enums ────────────────────────────────────────────────────────────────────
46
45
 
47
46
  enum BundleStatus {
48
47
  BUNDLE_STATUS_UNSPECIFIED = 0;
@@ -83,7 +82,6 @@ enum RuleOperator {
83
82
  }
84
83
 
85
84
 
86
- // ─── Requests ─────────────────────────────────────────────────────────────────
87
85
 
88
86
  message GetBundlesRequest {
89
87
  PaginationRequest pagination = 1;
@@ -122,7 +120,7 @@ message CreateBundleRequest {
122
120
  repeated BundleItemPayload items = 15;
123
121
  string created_by_id = 16;
124
122
 
125
- // NEW
123
+
126
124
  repeated DisplayPlacement display_placements = 17;
127
125
  PriceMode price_mode = 18;
128
126
  bool require_all_in_stock = 19;
@@ -155,7 +153,7 @@ message UpdateBundleRequest {
155
153
 
156
154
  repeated BundleItemPayload items = 16;
157
155
 
158
- // NEW
156
+
159
157
  repeated DisplayPlacement display_placements = 17;
160
158
  optional PriceMode price_mode = 18;
161
159
  optional bool require_all_in_stock = 19;
@@ -252,7 +250,6 @@ message AddCrossSellLinkRequest {
252
250
  }
253
251
 
254
252
 
255
- // ─── Responses ────────────────────────────────────────────────────────────────
256
253
 
257
254
  message GetBundlesResponse {
258
255
  repeated BundleListItemResponse items = 1;
@@ -312,7 +309,7 @@ message BundleDetailResponse {
312
309
  double final_price = 19;
313
310
  bool in_stock = 20;
314
311
 
315
- // NEW
312
+
316
313
  repeated DisplayPlacement display_placements = 21;
317
314
  PriceMode price_mode = 22;
318
315
  bool require_all_in_stock = 23;
@@ -360,26 +357,25 @@ message BundleItemAvailability {
360
357
  }
361
358
 
362
359
  message ExportBundlesResponse {
363
- string content = 1; // JSON string or CSV string
360
+ string content = 1;
364
361
  string format = 2;
365
362
  int32 count = 3;
366
363
  }
367
364
 
368
365
  message GenerateBundleCollageRequest {
369
366
  string bundle_id = 1;
370
- // Optional: override cell pixel size (default 400)
367
+
371
368
  optional int32 cell_size = 2;
372
369
  }
373
370
 
374
371
  message GenerateBundleCollageResponse {
375
- string url = 1; // Public CDN/S3 URL of the collage JPEG
376
- string key = 2; // S3 object key
377
- int32 width = 3; // Final image width in pixels
378
- int32 height = 4; // Final image height in pixels
372
+ string url = 1;
373
+ string key = 2;
374
+ int32 width = 3;
375
+ int32 height = 4;
379
376
  string bundle_id = 5;
380
377
  }
381
378
 
382
- // ── Bulk Lookup ──────────────────────────────────────────────────────────────
383
379
 
384
380
  message BulkLookupBundlesRequest {
385
381
  repeated string slugs = 1;
@@ -396,7 +392,6 @@ message BulkLookupBundlesResponse {
396
392
  repeated BundleLookupResult results = 1;
397
393
  }
398
394
 
399
- // ── Bundle Related Products ──────────────────────────────────────────────────
400
395
 
401
396
  enum BundleRelatedType {
402
397
  BUNDLE_RELATED_TYPE_UNSPECIFIED = 0;
@@ -4,8 +4,7 @@ package catalog.v1;
4
4
 
5
5
  import "common.proto";
6
6
 
7
- // SearchService — окремий сервіс під autocomplete та керування пошуком
8
- // (синоніми, популярні запити). Логіка та індекс живуть у catalog-service.
7
+
9
8
  service SearchService {
10
9
  // ─── Public (autocomplete) ───────────────────────────────────────────────
11
10
  rpc Suggest (SuggestRequest) returns (SuggestResponse);
@@ -0,0 +1,154 @@
1
+ syntax = "proto3";
2
+
3
+ package catalog.v1;
4
+
5
+ import "common.proto";
6
+
7
+
8
+ service SeoFilterService {
9
+ // ─── Public ──────────────────────────────────────────────────────────────
10
+
11
+ // Резолв ЧПУ-URL → metadata + canonical. Викликається SSR Next.js для
12
+ // кожного category/[[...filters]] запиту. Якщо combo не знайдено —
13
+ // повертає isIndexed=false і автогенерований fallback metadata.
14
+ rpc ResolveSeoFilter (ResolveSeoFilterRequest) returns (ResolveSeoFilterResponse);
15
+
16
+ // ─── Admin ───────────────────────────────────────────────────────────────
17
+
18
+ rpc ListSeoFilters (ListSeoFiltersRequest) returns (ListSeoFiltersResponse);
19
+ rpc GetSeoFilter (GetSeoFilterRequest) returns (SeoFilterResponse);
20
+ rpc CreateSeoFilter (CreateSeoFilterRequest) returns (SeoFilterResponse);
21
+ rpc UpdateSeoFilter (UpdateSeoFilterRequest) returns (SeoFilterResponse);
22
+ rpc DeleteSeoFilter (DeleteSeoFilterRequest) returns (DeleteResponse);
23
+
24
+ // Топ-N непокритих combinations (за impressions/popularity) — для
25
+ // швидкого створення SeoFilter з адмін-форми "Автопідказки".
26
+ rpc SuggestSeoFilters (SuggestSeoFiltersRequest) returns (SuggestSeoFiltersResponse);
27
+ }
28
+
29
+ // ─────────────────────────── Domain types ────────────────────────────────
30
+
31
+ // Частина combo. Однаковий формат і у DB (combo_parts JSON), і у gRPC.
32
+ // type: 'brand'|'price'|'color'|'size'
33
+ message FilterPart {
34
+ string type = 1;
35
+ // Для brand/color/size:
36
+ optional string value_id = 2;
37
+ optional string value_slug = 3;
38
+ // Для price:
39
+ optional int32 price_min = 4;
40
+ optional int32 price_max = 5;
41
+ }
42
+
43
+ // Локалізовані поля (uk/ru) у форматі { uk: "...", ru: "..." }.
44
+ message LocaleStrings {
45
+ string uk = 1;
46
+ string ru = 2;
47
+ }
48
+
49
+ message SeoFilterResponse {
50
+ string id = 1;
51
+ string category_id = 2;
52
+ string combo_hash = 3;
53
+ repeated FilterPart combo_parts = 4;
54
+ LocaleStrings url_segments = 5;
55
+ LocaleStrings title = 6;
56
+ LocaleStrings description = 7;
57
+ LocaleStrings h1 = 8;
58
+ bool is_indexed = 9;
59
+ bool is_auto = 10;
60
+ int32 popularity = 11;
61
+ int64 created_at = 12;
62
+ int64 updated_at = 13;
63
+ }
64
+
65
+ // ─────────────────────────── Resolve (public) ────────────────────────────
66
+
67
+ message ResolveSeoFilterRequest {
68
+ string category_id = 1;
69
+ // Канонічно відсортовані URL segments як приходять з Next.js, напр.
70
+ // ["brend-cybex", "cina-1000-5000"]. Caller гарантує що порядок canonical.
71
+ repeated string url_segments = 2;
72
+ string locale = 3; // 'uk' | 'ru'
73
+ }
74
+
75
+ message ResolveSeoFilterResponse {
76
+ // Якщо false → caller рендерить категорію з noindex,follow.
77
+ bool found = 1;
78
+ // Якщо false → caller додає <meta robots="noindex,follow"> навіть якщо
79
+ // запис знайдено (наприклад, isIndexed=false manual override).
80
+ bool is_indexed = 2;
81
+ LocaleStrings title = 3;
82
+ LocaleStrings description = 4;
83
+ LocaleStrings h1 = 5;
84
+ // Canonical-URL-path без host: "/uk/c/koliaski/brend-cybex"
85
+ string canonical_path = 6;
86
+ // Денормалізовані combo_parts з resolved valueId — для побудови
87
+ // запиту до products (categoryId + filter ids).
88
+ repeated FilterPart resolved_parts = 7;
89
+ }
90
+
91
+ // ─────────────────────────── List (admin) ────────────────────────────────
92
+
93
+ message ListSeoFiltersRequest {
94
+ PaginationRequest pagination = 1;
95
+ optional string category_id = 2;
96
+ optional bool is_indexed = 3;
97
+ optional bool is_auto = 4;
98
+ // Пошук за uk/ru title (для адмін-фільтра).
99
+ optional string search = 5;
100
+ }
101
+
102
+ message ListSeoFiltersResponse {
103
+ repeated SeoFilterResponse items = 1;
104
+ PaginationMeta meta = 2;
105
+ }
106
+
107
+ message GetSeoFilterRequest {
108
+ string id = 1;
109
+ }
110
+
111
+ // ─────────────────────────── Create / Update ─────────────────────────────
112
+
113
+ message CreateSeoFilterRequest {
114
+ string category_id = 1;
115
+ repeated FilterPart combo_parts = 2;
116
+ LocaleStrings title = 3;
117
+ LocaleStrings description = 4;
118
+ LocaleStrings h1 = 5;
119
+ bool is_indexed = 6;
120
+ }
121
+
122
+ message UpdateSeoFilterRequest {
123
+ string id = 1;
124
+ optional LocaleStrings title = 2;
125
+ optional LocaleStrings description = 3;
126
+ optional LocaleStrings h1 = 4;
127
+ optional bool is_indexed = 5;
128
+ }
129
+
130
+ message DeleteSeoFilterRequest {
131
+ string id = 1;
132
+ }
133
+
134
+ // ─────────────────────────── Suggestions (admin) ─────────────────────────
135
+
136
+ message SuggestSeoFiltersRequest {
137
+ string category_id = 1;
138
+ int32 limit = 2; // default 20
139
+ }
140
+
141
+ message SuggestSeoFilterCandidate {
142
+ // Запропоновані combo_parts (валідні, з resolved slug).
143
+ repeated FilterPart combo_parts = 1;
144
+ // Оцінка популярності: clicks / impressions / товарообіг (single число).
145
+ int32 score = 2;
146
+ // Чи існує вже SeoFilter з таким комбо (тоді UI ховає кнопку Create).
147
+ bool already_exists = 3;
148
+ // Pre-built canonical URL path для preview.
149
+ LocaleStrings preview_segments = 4;
150
+ }
151
+
152
+ message SuggestSeoFiltersResponse {
153
+ repeated SuggestSeoFilterCandidate items = 1;
154
+ }
@@ -15,8 +15,7 @@ service ShopFilterService {
15
15
  message GetShopFiltersRequest {
16
16
  string category_id = 1;
17
17
 
18
- // Поточно застосовані фільтри. Counts по кожному facet рахуються
19
- // з виключенням саме того facet — щоб лічильники реагували на вибір.
18
+
20
19
  repeated string brand_ids = 2;
21
20
  repeated string color_ids = 3;
22
21
  repeated string size_ids = 4;
@@ -25,18 +24,16 @@ message GetShopFiltersRequest {
25
24
  optional bool in_stock = 7;
26
25
  optional string search = 8;
27
26
 
28
- // Обмеження множини товарів акцією — фасети рахуються тільки
29
- // по товарах, що належать поточній акції.
27
+
30
28
  optional PromotionFilter promotion_filter = 9;
31
29
 
32
- // Динамічні атрибути окрім color/size (матеріал, виробник тощо).
30
+
33
31
  repeated string attribute_value_ids = 10;
34
32
 
35
- // Явний прапор "ціновий фільтр активний". Без нього неможливо
36
- // відрізнити "користувач не вибирав" від "обрав від 0".
33
+
37
34
  optional bool price_active = 11;
38
35
 
39
- // 'uk' | 'ru' — для локалізації labels у відповіді (дефолт uk).
36
+
40
37
  optional string locale = 12;
41
38
  }
42
39
 
@@ -48,7 +45,15 @@ message GetShopFiltersResponse {
48
45
  repeated ShopFilterAttribute attributes = 4;
49
46
  double price_min = 5;
50
47
  double price_max = 6;
51
- repeated string subcategory_ids = 7;
48
+
49
+ repeated ShopFilterSubcategory subcategories = 7;
50
+ }
51
+
52
+ message ShopFilterSubcategory {
53
+ string id = 1;
54
+ string slug = 2;
55
+ string label = 3;
56
+ int32 count = 4;
52
57
  }
53
58
 
54
59
  message ShopFilterOption {
@@ -66,8 +71,7 @@ message ShopFilterColorOption {
66
71
 
67
72
  message ShopFilterAttribute {
68
73
  string slug = 1;
69
- // Локалізована назва атрибута (на стороні gateway вже згорнута у
70
- // одну рядкову label згідно locale запиту).
74
+
71
75
  string label = 2;
72
76
  repeated ShopFilterOption values = 3;
73
77
  }