@open-mercato/core 0.6.6-develop.6406.1.a0bd770daf → 0.6.6-develop.6408.1.0cbfbd7476

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 (27) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/dist/modules/catalog/api/settings/route.js +142 -0
  3. package/dist/modules/catalog/api/settings/route.js.map +7 -0
  4. package/dist/modules/catalog/backend/config/catalog/page.js +6 -2
  5. package/dist/modules/catalog/backend/config/catalog/page.js.map +2 -2
  6. package/dist/modules/catalog/components/UnitPriceDisplaySettings.js +89 -0
  7. package/dist/modules/catalog/components/UnitPriceDisplaySettings.js.map +7 -0
  8. package/dist/modules/catalog/components/products/ProductUomSection.js +4 -2
  9. package/dist/modules/catalog/components/products/ProductUomSection.js.map +2 -2
  10. package/dist/modules/catalog/components/products/hooks/useUnitPriceDisplayEnabled.js +25 -0
  11. package/dist/modules/catalog/components/products/hooks/useUnitPriceDisplayEnabled.js.map +7 -0
  12. package/dist/modules/catalog/lib/settings.js +9 -0
  13. package/dist/modules/catalog/lib/settings.js.map +7 -0
  14. package/dist/modules/customers/backend/customers/deals/map/components/DealsMapCanvasImpl.js +9 -1
  15. package/dist/modules/customers/backend/customers/deals/map/components/DealsMapCanvasImpl.js.map +2 -2
  16. package/package.json +12 -12
  17. package/src/modules/catalog/api/settings/route.ts +165 -0
  18. package/src/modules/catalog/backend/config/catalog/page.tsx +2 -0
  19. package/src/modules/catalog/components/UnitPriceDisplaySettings.tsx +106 -0
  20. package/src/modules/catalog/components/products/ProductUomSection.tsx +4 -0
  21. package/src/modules/catalog/components/products/hooks/useUnitPriceDisplayEnabled.ts +39 -0
  22. package/src/modules/catalog/i18n/de.json +8 -0
  23. package/src/modules/catalog/i18n/en.json +8 -0
  24. package/src/modules/catalog/i18n/es.json +8 -0
  25. package/src/modules/catalog/i18n/pl.json +8 -0
  26. package/src/modules/catalog/lib/settings.ts +8 -0
  27. package/src/modules/customers/backend/customers/deals/map/components/DealsMapCanvasImpl.tsx +12 -2
@@ -0,0 +1,8 @@
1
+ export const CATALOG_SETTINGS_MODULE_ID = 'catalog'
2
+
3
+ // Controls whether the EU unit-price presentation feature is exposed at all.
4
+ // Default ON so existing tenants keep the current behavior; manufacturers or
5
+ // other non-retail tenants can turn it off to remove the settings from the
6
+ // product form entirely.
7
+ export const UNIT_PRICE_DISPLAY_ENABLED_KEY = 'unit_price_display_enabled'
8
+ export const UNIT_PRICE_DISPLAY_ENABLED_DEFAULT = true
@@ -29,8 +29,18 @@ const TILE_ATTRIBUTION =
29
29
  '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
30
30
  // True whenever the EFFECTIVE tile URL targets OSM's public CDN — whether from the bundled default
31
31
  // (env unset) OR an env value pointed back at the same public host. OSM's tile usage policy
32
- // prohibits production/commercial traffic against it.
33
- const USING_PUBLIC_OSM_TILES = TILE_URL.includes('tile.openstreetmap.org')
32
+ // prohibits production/commercial traffic against it. Match on the parsed hostname rather than a raw
33
+ // substring so a lookalike host (e.g. `tile.openstreetmap.org.example.com`) is not mistaken for OSM.
34
+ function targetsPublicOsmTileHost(tileUrl: string): boolean {
35
+ try {
36
+ const { hostname } = new URL(tileUrl)
37
+ return hostname === 'openstreetmap.org' || hostname.endsWith('.openstreetmap.org')
38
+ } catch {
39
+ return false
40
+ }
41
+ }
42
+
43
+ const USING_PUBLIC_OSM_TILES = targetsPublicOsmTileHost(TILE_URL)
34
44
 
35
45
  let publicOsmTileWarningEmitted = false
36
46
  // Warn once (per session) so deployments point NEXT_PUBLIC_OM_DEALS_MAP_TILE_URL at a self-hosted or