tripstorekrabi-shared 1.26.1 → 1.26.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/product.js +10 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripstorekrabi-shared",
3
- "version": "1.26.1",
3
+ "version": "1.26.3",
4
4
  "description": "Shared library for Trip Store Krabi",
5
5
  "author": "Stefan Sommer <tonprince@gmail.com>",
6
6
  "repository": {
package/product.js CHANGED
@@ -68,7 +68,7 @@ export function buildIndex(id, product) {
68
68
  const isTransfer = Boolean(product.from && product.to);
69
69
 
70
70
  if (isTransfer) {
71
- // For transfers, always derive destinations directly from `from` and `to`
71
+ // For transfers, derive destinations directly from `from` and `to`
72
72
  const transferDestinations = Array.from(
73
73
  new Set([product.from, product.to].map((d) => String(d || '').trim()).filter(Boolean))
74
74
  );
@@ -76,12 +76,13 @@ export function buildIndex(id, product) {
76
76
  document.destinations = transferDestinations;
77
77
  }
78
78
  } else {
79
- // For activities, clean and deduplicate `destinations` (or fallback to `destination`)
80
- const rawDestinations = Array.isArray(product.destinations)
81
- ? product.destinations
82
- : product.destination
83
- ? [product.destination]
84
- : [];
79
+ // 1. Assign new `places` array directly
80
+ if (Array.isArray(product.places) && product.places.length > 0) {
81
+ document.places = product.places;
82
+ }
83
+
84
+ // 2. Keep legacy `destinations` array populated during transition
85
+ const rawDestinations = Array.isArray(product.destinations) ? product.destinations : [];
85
86
 
86
87
  const cleanedDestinations = Array.from(
87
88
  new Set(rawDestinations.map((d) => String(d || '').trim()).filter(Boolean))
@@ -92,19 +93,12 @@ export function buildIndex(id, product) {
92
93
  }
93
94
  }
94
95
 
95
- // Populate unified keywords array (falls back to legacy tags if keywords has no valid entries)
96
+ // Populate keywords array
96
97
  const validKeywords = Array.isArray(product.keywords)
97
98
  ? product.keywords.map((k) => String(k || '').trim()).filter(Boolean)
98
99
  : [];
99
100
 
100
- const validTags = Array.isArray(product.tags)
101
- ? product.tags.map((t) => String(t || '').trim()).filter(Boolean)
102
- : [];
103
-
104
- document.keywords = Array.from(new Set(validKeywords.length > 0 ? validKeywords : validTags));
105
-
106
- // TODO stef Keep legacy tags synced for backward compatibility until tags is fully removed from frontend
107
- document.tags = validTags.length > 0 ? Array.from(new Set(validTags)) : document.keywords;
101
+ document.keywords = Array.from(new Set(validKeywords));
108
102
 
109
103
  if (isTransfer) {
110
104
  document.from = String(product.from).trim();