@voyantjs/products-ui 0.103.0 → 0.104.1
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/components/product-detail/product-option-pricing-grid.d.ts.map +1 -1
- package/dist/components/product-detail/product-option-pricing-grid.js +3 -2
- package/dist/components/product-detail/product-options-pricing.d.ts +3 -0
- package/dist/components/product-detail/product-options-pricing.d.ts.map +1 -1
- package/dist/components/product-detail/product-options-pricing.js +16 -1
- package/package.json +29 -29
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-option-pricing-grid.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-option-pricing-grid.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-option-pricing-grid.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-option-pricing-grid.tsx"],"names":[],"mappings":"AAyBA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAA;AA8BpC,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,mBAAmB,CAAA;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,MAAM,GACP,EAAE,sBAAsB,2CAybxB"}
|
|
@@ -8,7 +8,7 @@ import { Button } from "@voyantjs/ui/components/button";
|
|
|
8
8
|
import { Pencil, Plus, Trash2 } from "lucide-react";
|
|
9
9
|
import { useState } from "react";
|
|
10
10
|
import { useProductDetailMessages } from "./host.js";
|
|
11
|
-
import { categoryAppliesToUnit, ExtraPriceRulesPanel, formatProductMoney, getCategoryCondition, TravelerCategoryDialog, } from "./product-options-pricing.js";
|
|
11
|
+
import { categoryAppliesToUnit, ExtraPriceRulesPanel, formatProductMoney, getCategoryCondition, isTravelerCategory, TravelerCategoryDialog, } from "./product-options-pricing.js";
|
|
12
12
|
import { getOptionPriceRulesQueryOptions, getOptionUnitPriceRulesQueryOptions, getOptionUnitsQueryOptions, getPriceCatalogsQueryOptions, getPricingCategoriesQueryOptions, } from "./product-options-shared.js";
|
|
13
13
|
import { UnitDialog } from "./product-unit-dialog.js";
|
|
14
14
|
import { UnitPriceRuleDialog, } from "./product-unit-price-rule-dialog.js";
|
|
@@ -94,7 +94,8 @@ export function OptionPricingGrid({ productId, optionId, optionName, productCurr
|
|
|
94
94
|
const referencedCategoryIds = new Set(cells.flatMap((cell) => (cell.pricingCategoryId ? [cell.pricingCategoryId] : [])));
|
|
95
95
|
const categories = (categoriesData?.data ?? [])
|
|
96
96
|
.filter((category) => category.active &&
|
|
97
|
-
(((category
|
|
97
|
+
((isTravelerCategory(category) &&
|
|
98
|
+
(category.productId == null || category.productId === productId) &&
|
|
98
99
|
(category.optionId == null || category.optionId === optionId)) ||
|
|
99
100
|
referencedCategoryIds.has(category.id)))
|
|
100
101
|
.slice()
|
|
@@ -4,6 +4,9 @@ import { useProductDetailMessages } from "./host.js";
|
|
|
4
4
|
import { type OptionPricingLayout } from "./product-options-shared.js";
|
|
5
5
|
import type { OptionUnitData } from "./product-unit-dialog.js";
|
|
6
6
|
export declare function getUnitTypeLabel(type: OptionUnitData["unitType"], messages: ReturnType<typeof useProductDetailMessages>["products"]["operations"]["units"]): string;
|
|
7
|
+
export declare function isTravelerCategory(category: {
|
|
8
|
+
categoryType: PricingCategoryRecord["categoryType"];
|
|
9
|
+
}): boolean;
|
|
7
10
|
export declare function getCategoryCondition(metadata: Record<string, unknown> | null | undefined): string | null;
|
|
8
11
|
export declare function categoryAppliesToUnit(category: {
|
|
9
12
|
id: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-options-pricing.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-options-pricing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,qBAAqB,EAM3B,MAAM,yBAAyB,CAAA;AA4BhC,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAA;AAEnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAA;AAOpD,OAAO,EAKL,KAAK,mBAAmB,EACzB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AA0B9D,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,EAChC,QAAQ,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,UAkBzF;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,SAAS,iBAGxF;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;CAAE,EAC1E,IAAI,EAAE,cAAc,WAMrB;AAeD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,QAAQ,EACR,UAAU,EACV,eAAe,EACf,MAAM,EACN,MAAM,GACP,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,mBAAmB,CAAA;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACzB,2CA+CA;
|
|
1
|
+
{"version":3,"file":"product-options-pricing.d.ts","sourceRoot":"","sources":["../../../src/components/product-detail/product-options-pricing.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAA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AI,EACJ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,aAAa,EACb,QAAQ,EACR,SAAS,GACV,EAAE;IACD,IAAI,EAAE,OAAO,CAAA;IACb,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAA;IACrC,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,EAAE,cAAc,EAAE,CAAA;IACvB,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,EAAE,qBAAqB,CAAA;IAChC,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,2CAiOA;AAED,wBAAgB,oBAAoB,CAAC,EACnC,SAAS,EACT,QAAQ,EACR,iBAAiB,EACjB,uBAAuB,EACvB,eAAe,GAChB,EAAE;IACD,SAAS,EAAE,MAAM,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAIhB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,uBAAuB,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/C,eAAe,EAAE,MAAM,CAAA;CACxB,2CAwJA;AAkID,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,UAG1F"}
|
|
@@ -48,6 +48,20 @@ export function getUnitTypeLabel(type, messages) {
|
|
|
48
48
|
return type;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
// Pricing categories that describe the *unit* dimension (room/vehicle — already
|
|
52
|
+
// the grid's rows) or a standalone add-on (`service`, handled by the extras
|
|
53
|
+
// panel) are not per-traveler price columns. Excluding them stops a product
|
|
54
|
+
// whose data carries such categories — e.g. legacy data migrated with a
|
|
55
|
+
// "Double room" pricing category alongside the real Adult/Child split — from
|
|
56
|
+
// rendering one bogus price column per room next to the traveler columns.
|
|
57
|
+
const NON_TRAVELER_CATEGORY_TYPES = new Set([
|
|
58
|
+
"room",
|
|
59
|
+
"vehicle",
|
|
60
|
+
"service",
|
|
61
|
+
]);
|
|
62
|
+
export function isTravelerCategory(category) {
|
|
63
|
+
return !NON_TRAVELER_CATEGORY_TYPES.has(category.categoryType);
|
|
64
|
+
}
|
|
51
65
|
export function getCategoryCondition(metadata) {
|
|
52
66
|
const condition = metadata?.condition;
|
|
53
67
|
return typeof condition === "string" && condition.trim().length > 0 ? condition : null;
|
|
@@ -140,7 +154,8 @@ function UnitPriceMatrix({ productId, optionPriceRuleId, optionId, pricingMode,
|
|
|
140
154
|
const cells = cellsData?.data ?? [];
|
|
141
155
|
const referencedCategoryIds = new Set(cells.flatMap((cell) => (cell.pricingCategoryId ? [cell.pricingCategoryId] : [])));
|
|
142
156
|
const categories = (categoriesData?.data ?? []).filter((category) => category.active &&
|
|
143
|
-
(((category
|
|
157
|
+
((isTravelerCategory(category) &&
|
|
158
|
+
(category.productId == null || category.productId === productId) &&
|
|
144
159
|
(category.optionId == null || category.optionId === optionId)) ||
|
|
145
160
|
referencedCategoryIds.has(category.id)));
|
|
146
161
|
const isPersonOnly = units.length > 0 && units.every((unit) => unit.unitType === "person");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/products-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.104.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -50,26 +50,26 @@
|
|
|
50
50
|
"react-dom": "^19.0.0",
|
|
51
51
|
"react-hook-form": "^7.60.0",
|
|
52
52
|
"zod": "^4.3.6",
|
|
53
|
-
"@voyantjs/availability": "0.
|
|
54
|
-
"@voyantjs/availability-react": "0.
|
|
55
|
-
"@voyantjs/catalog-react": "0.
|
|
56
|
-
"@voyantjs/extras-react": "0.
|
|
57
|
-
"@voyantjs/finance": "0.
|
|
58
|
-
"@voyantjs/finance-ui": "0.
|
|
59
|
-
"@voyantjs/markets-react": "0.
|
|
60
|
-
"@voyantjs/pricing-react": "0.
|
|
61
|
-
"@voyantjs/pricing-ui": "0.
|
|
62
|
-
"@voyantjs/products-react": "0.
|
|
63
|
-
"@voyantjs/suppliers-react": "0.
|
|
64
|
-
"@voyantjs/ui": "0.
|
|
65
|
-
"@voyantjs/utils": "0.
|
|
53
|
+
"@voyantjs/availability": "0.104.1",
|
|
54
|
+
"@voyantjs/availability-react": "0.104.1",
|
|
55
|
+
"@voyantjs/catalog-react": "0.104.1",
|
|
56
|
+
"@voyantjs/extras-react": "0.104.1",
|
|
57
|
+
"@voyantjs/finance": "0.104.1",
|
|
58
|
+
"@voyantjs/finance-ui": "0.104.1",
|
|
59
|
+
"@voyantjs/markets-react": "0.104.1",
|
|
60
|
+
"@voyantjs/pricing-react": "0.104.1",
|
|
61
|
+
"@voyantjs/pricing-ui": "0.104.1",
|
|
62
|
+
"@voyantjs/products-react": "0.104.1",
|
|
63
|
+
"@voyantjs/suppliers-react": "0.104.1",
|
|
64
|
+
"@voyantjs/ui": "0.104.1",
|
|
65
|
+
"@voyantjs/utils": "0.104.1"
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"date-fns": "^4.1.0",
|
|
69
69
|
"motion": "^12.38.0",
|
|
70
70
|
"react-day-picker": "^9.8.0",
|
|
71
71
|
"sonner": "^2.0.7",
|
|
72
|
-
"@voyantjs/i18n": "0.
|
|
72
|
+
"@voyantjs/i18n": "0.104.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@tanstack/react-query": "^5.100.11",
|
|
@@ -82,20 +82,20 @@
|
|
|
82
82
|
"typescript": "^6.0.2",
|
|
83
83
|
"vitest": "^4.1.2",
|
|
84
84
|
"zod": "^4.3.6",
|
|
85
|
-
"@voyantjs/availability": "0.
|
|
86
|
-
"@voyantjs/availability-react": "0.
|
|
87
|
-
"@voyantjs/catalog-react": "0.
|
|
88
|
-
"@voyantjs/extras-react": "0.
|
|
89
|
-
"@voyantjs/finance": "0.
|
|
90
|
-
"@voyantjs/finance-ui": "0.
|
|
91
|
-
"@voyantjs/i18n": "0.
|
|
92
|
-
"@voyantjs/markets-react": "0.
|
|
93
|
-
"@voyantjs/pricing-react": "0.
|
|
94
|
-
"@voyantjs/pricing-ui": "0.
|
|
95
|
-
"@voyantjs/products-react": "0.
|
|
96
|
-
"@voyantjs/suppliers-react": "0.
|
|
97
|
-
"@voyantjs/ui": "0.
|
|
98
|
-
"@voyantjs/utils": "0.
|
|
85
|
+
"@voyantjs/availability": "0.104.1",
|
|
86
|
+
"@voyantjs/availability-react": "0.104.1",
|
|
87
|
+
"@voyantjs/catalog-react": "0.104.1",
|
|
88
|
+
"@voyantjs/extras-react": "0.104.1",
|
|
89
|
+
"@voyantjs/finance": "0.104.1",
|
|
90
|
+
"@voyantjs/finance-ui": "0.104.1",
|
|
91
|
+
"@voyantjs/i18n": "0.104.1",
|
|
92
|
+
"@voyantjs/markets-react": "0.104.1",
|
|
93
|
+
"@voyantjs/pricing-react": "0.104.1",
|
|
94
|
+
"@voyantjs/pricing-ui": "0.104.1",
|
|
95
|
+
"@voyantjs/products-react": "0.104.1",
|
|
96
|
+
"@voyantjs/suppliers-react": "0.104.1",
|
|
97
|
+
"@voyantjs/ui": "0.104.1",
|
|
98
|
+
"@voyantjs/utils": "0.104.1",
|
|
99
99
|
"@voyantjs/voyant-typescript-config": "0.1.0"
|
|
100
100
|
},
|
|
101
101
|
"files": [
|