@open-mercato/core 0.9.1-develop.7474.1.51db10479d → 0.9.1-develop.7475.1.28ca93ed97
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/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/catalog_price_history_entry/index.js +53 -0
- package/dist/generated/entities/catalog_price_history_entry/index.js.map +7 -0
- package/dist/generated/entities/customer_group_terms/index.js +2 -0
- package/dist/generated/entities/customer_group_terms/index.js.map +2 -2
- package/dist/generated/entities/ecommerce_store/index.js +33 -0
- package/dist/generated/entities/ecommerce_store/index.js.map +7 -0
- package/dist/generated/entities/ecommerce_store_channel_binding/index.js +29 -0
- package/dist/generated/entities/ecommerce_store_channel_binding/index.js.map +7 -0
- package/dist/generated/entities/ecommerce_store_domain_binding/index.js +23 -0
- package/dist/generated/entities/ecommerce_store_domain_binding/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +8 -1
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +72 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/helpers/integration/customerGroupsFixtures.js.map +2 -2
- package/dist/modules/catalog/acl.js +8 -1
- package/dist/modules/catalog/acl.js.map +2 -2
- package/dist/modules/catalog/api/config/omnibus/route.js +184 -0
- package/dist/modules/catalog/api/config/omnibus/route.js.map +7 -0
- package/dist/modules/catalog/api/prices/history/route.js +131 -0
- package/dist/modules/catalog/api/prices/history/route.js.map +7 -0
- package/dist/modules/catalog/api/prices/omnibus-preview/route.js +184 -0
- package/dist/modules/catalog/api/prices/omnibus-preview/route.js.map +7 -0
- package/dist/modules/catalog/api/products/route.js +54 -245
- package/dist/modules/catalog/api/products/route.js.map +3 -3
- package/dist/modules/catalog/api/tags/route.js +6 -0
- package/dist/modules/catalog/api/tags/route.js.map +2 -2
- package/dist/modules/catalog/backend/config/catalog/page.js +3 -1
- package/dist/modules/catalog/backend/config/catalog/page.js.map +2 -2
- package/dist/modules/catalog/cli.js +80 -2
- package/dist/modules/catalog/cli.js.map +2 -2
- package/dist/modules/catalog/commands/categories.js +51 -2
- package/dist/modules/catalog/commands/categories.js.map +2 -2
- package/dist/modules/catalog/commands/prices.js +43 -1
- package/dist/modules/catalog/commands/prices.js.map +2 -2
- package/dist/modules/catalog/commands/products.js +71 -0
- package/dist/modules/catalog/commands/products.js.map +2 -2
- package/dist/modules/catalog/commands/variants.js +7 -0
- package/dist/modules/catalog/commands/variants.js.map +2 -2
- package/dist/modules/catalog/components/OmnibusSettings.js +703 -0
- package/dist/modules/catalog/components/OmnibusSettings.js.map +7 -0
- package/dist/modules/catalog/components/PriceEditorOmnibusRow.js +152 -0
- package/dist/modules/catalog/components/PriceEditorOmnibusRow.js.map +7 -0
- package/dist/modules/catalog/components/lookupSources.js +31 -0
- package/dist/modules/catalog/components/lookupSources.js.map +7 -0
- package/dist/modules/catalog/components/prices/PriceScopeSelectors.js +8 -2
- package/dist/modules/catalog/components/prices/PriceScopeSelectors.js.map +2 -2
- package/dist/modules/catalog/components/products/VariantBuilder.js +11 -1
- package/dist/modules/catalog/components/products/VariantBuilder.js.map +2 -2
- package/dist/modules/catalog/data/entities.js +122 -1
- package/dist/modules/catalog/data/entities.js.map +2 -2
- package/dist/modules/catalog/data/validators.js +78 -0
- package/dist/modules/catalog/data/validators.js.map +2 -2
- package/dist/modules/catalog/di.js +18 -0
- package/dist/modules/catalog/di.js.map +2 -2
- package/dist/modules/catalog/lib/omnibus.js +285 -0
- package/dist/modules/catalog/lib/omnibus.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusBackfill.js +146 -0
- package/dist/modules/catalog/lib/omnibusBackfill.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusCache.js +89 -0
- package/dist/modules/catalog/lib/omnibusCache.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusConfig.js +64 -0
- package/dist/modules/catalog/lib/omnibusConfig.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusHistoryQueries.js +191 -0
- package/dist/modules/catalog/lib/omnibusHistoryQueries.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusPresentedEntry.js +73 -0
- package/dist/modules/catalog/lib/omnibusPresentedEntry.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusProductListEnrichment.js +94 -0
- package/dist/modules/catalog/lib/omnibusProductListEnrichment.js.map +7 -0
- package/dist/modules/catalog/lib/omnibusTypes.js +115 -0
- package/dist/modules/catalog/lib/omnibusTypes.js.map +7 -0
- package/dist/modules/catalog/lib/optionSchemaTranslations.js +55 -0
- package/dist/modules/catalog/lib/optionSchemaTranslations.js.map +7 -0
- package/dist/modules/catalog/lib/priceHistoryQuery.js +103 -0
- package/dist/modules/catalog/lib/priceHistoryQuery.js.map +7 -0
- package/dist/modules/catalog/lib/pricing.js +26 -2
- package/dist/modules/catalog/lib/pricing.js.map +2 -2
- package/dist/modules/catalog/lib/productFilters.js +273 -0
- package/dist/modules/catalog/lib/productFilters.js.map +7 -0
- package/dist/modules/catalog/lib/productScopeKeys.js +105 -0
- package/dist/modules/catalog/lib/productScopeKeys.js.map +7 -0
- package/dist/modules/catalog/lib/productScopeReindex.js +73 -0
- package/dist/modules/catalog/lib/productScopeReindex.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20261005105352_catalog.js +39 -0
- package/dist/modules/catalog/migrations/Migration20261005105352_catalog.js.map +7 -0
- package/dist/modules/catalog/migrations/Migration20261005150824_catalog.js +39 -0
- package/dist/modules/catalog/migrations/Migration20261005150824_catalog.js.map +7 -0
- package/dist/modules/catalog/services/catalogOmnibusService.js +480 -0
- package/dist/modules/catalog/services/catalogOmnibusService.js.map +7 -0
- package/dist/modules/catalog/setup.js +3 -1
- package/dist/modules/catalog/setup.js.map +2 -2
- package/dist/modules/catalog/subscribers/product-scope-keys-category-deleted.js +16 -0
- package/dist/modules/catalog/subscribers/product-scope-keys-category-deleted.js.map +7 -0
- package/dist/modules/catalog/subscribers/product-scope-keys-category-updated.js +17 -0
- package/dist/modules/catalog/subscribers/product-scope-keys-category-updated.js.map +7 -0
- package/dist/modules/catalog/translations.js +10 -0
- package/dist/modules/catalog/translations.js.map +2 -2
- package/dist/modules/configs/lib/upgrade-actions.js +28 -0
- package/dist/modules/configs/lib/upgrade-actions.js.map +2 -2
- package/dist/modules/customer_groups/api/customer-groups/[id]/terms/route.js +5 -0
- package/dist/modules/customer_groups/api/customer-groups/[id]/terms/route.js.map +2 -2
- package/dist/modules/customer_groups/components/CustomerGroupTermsSection.js +111 -3
- package/dist/modules/customer_groups/components/CustomerGroupTermsSection.js.map +2 -2
- package/dist/modules/customer_groups/components/customerGroupAssortmentScope.js +43 -0
- package/dist/modules/customer_groups/components/customerGroupAssortmentScope.js.map +7 -0
- package/dist/modules/customer_groups/data/entities.js +3 -0
- package/dist/modules/customer_groups/data/entities.js.map +2 -2
- package/dist/modules/customer_groups/data/validators.js +9 -0
- package/dist/modules/customer_groups/data/validators.js.map +2 -2
- package/dist/modules/customer_groups/migrations/Migration20261005110250_customer_groups.js +17 -0
- package/dist/modules/customer_groups/migrations/Migration20261005110250_customer_groups.js.map +7 -0
- package/dist/modules/customer_groups/services/customerGroupsService.js +62 -15
- package/dist/modules/customer_groups/services/customerGroupsService.js.map +2 -2
- package/dist/modules/ecommerce/acl.js +13 -0
- package/dist/modules/ecommerce/acl.js.map +7 -0
- package/dist/modules/ecommerce/api/domain-mappings/route.js +72 -0
- package/dist/modules/ecommerce/api/domain-mappings/route.js.map +7 -0
- package/dist/modules/ecommerce/api/openapi.js +27 -0
- package/dist/modules/ecommerce/api/openapi.js.map +7 -0
- package/dist/modules/ecommerce/api/store-channel-bindings/[id]/assortment-count/route.js +109 -0
- package/dist/modules/ecommerce/api/store-channel-bindings/[id]/assortment-count/route.js.map +7 -0
- package/dist/modules/ecommerce/api/store-channel-bindings/crud.js +265 -0
- package/dist/modules/ecommerce/api/store-channel-bindings/crud.js.map +7 -0
- package/dist/modules/ecommerce/api/store-channel-bindings/route.js +67 -0
- package/dist/modules/ecommerce/api/store-channel-bindings/route.js.map +7 -0
- package/dist/modules/ecommerce/api/store-domain-bindings/crud.js +296 -0
- package/dist/modules/ecommerce/api/store-domain-bindings/crud.js.map +7 -0
- package/dist/modules/ecommerce/api/store-domain-bindings/route.js +73 -0
- package/dist/modules/ecommerce/api/store-domain-bindings/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/categories/[slug]/route.js +87 -0
- package/dist/modules/ecommerce/api/storefront/categories/[slug]/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/categories/openapiSchemas.js +50 -0
- package/dist/modules/ecommerce/api/storefront/categories/openapiSchemas.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/categories/route.js +75 -0
- package/dist/modules/ecommerce/api/storefront/categories/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/context/route.js +163 -0
- package/dist/modules/ecommerce/api/storefront/context/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/products/[idOrHandle]/route.js +87 -0
- package/dist/modules/ecommerce/api/storefront/products/[idOrHandle]/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/products/openapiSchemas.js +177 -0
- package/dist/modules/ecommerce/api/storefront/products/openapiSchemas.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/products/route.js +78 -0
- package/dist/modules/ecommerce/api/storefront/products/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/search/suggest/openapiSchemas.js +25 -0
- package/dist/modules/ecommerce/api/storefront/search/suggest/openapiSchemas.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/search/suggest/route.js +75 -0
- package/dist/modules/ecommerce/api/storefront/search/suggest/route.js.map +7 -0
- package/dist/modules/ecommerce/api/storefront/storefrontRouteSupport.js +58 -0
- package/dist/modules/ecommerce/api/storefront/storefrontRouteSupport.js.map +7 -0
- package/dist/modules/ecommerce/api/stores/[id]/branding/route.js +183 -0
- package/dist/modules/ecommerce/api/stores/[id]/branding/route.js.map +7 -0
- package/dist/modules/ecommerce/api/stores/[id]/preview-branding/route.js +92 -0
- package/dist/modules/ecommerce/api/stores/[id]/preview-branding/route.js.map +7 -0
- package/dist/modules/ecommerce/api/stores/crud.js +401 -0
- package/dist/modules/ecommerce/api/stores/crud.js.map +7 -0
- package/dist/modules/ecommerce/api/stores/route.js +64 -0
- package/dist/modules/ecommerce/api/stores/route.js.map +7 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/[id]/page.js +9 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/[id]/page.js.map +7 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/[id]/page.meta.js +16 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/[id]/page.meta.js.map +7 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/page.js +9 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/page.js.map +7 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/page.meta.js +16 -0
- package/dist/modules/ecommerce/backend/config/ecommerce/page.meta.js.map +7 -0
- package/dist/modules/ecommerce/commands/stores.js +110 -0
- package/dist/modules/ecommerce/commands/stores.js.map +7 -0
- package/dist/modules/ecommerce/components/ChannelAssortmentCount.js +90 -0
- package/dist/modules/ecommerce/components/ChannelAssortmentCount.js.map +7 -0
- package/dist/modules/ecommerce/components/ChannelBindingFormSections.js +33 -0
- package/dist/modules/ecommerce/components/ChannelBindingFormSections.js.map +7 -0
- package/dist/modules/ecommerce/components/ChannelLookupPicker.js +11 -0
- package/dist/modules/ecommerce/components/ChannelLookupPicker.js.map +7 -0
- package/dist/modules/ecommerce/components/DomainStatusWarning.js +24 -0
- package/dist/modules/ecommerce/components/DomainStatusWarning.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreAvailabilityDefaultsSection.js +190 -0
- package/dist/modules/ecommerce/components/StoreAvailabilityDefaultsSection.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreBrandingControls.js +67 -0
- package/dist/modules/ecommerce/components/StoreBrandingControls.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreBrandingPreview.js +69 -0
- package/dist/modules/ecommerce/components/StoreBrandingPreview.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreBrandingTab.js +218 -0
- package/dist/modules/ecommerce/components/StoreBrandingTab.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreChannelBindingDialog.js +270 -0
- package/dist/modules/ecommerce/components/StoreChannelBindingDialog.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreChannelsTab.js +313 -0
- package/dist/modules/ecommerce/components/StoreChannelsTab.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreCreateDialog.js +164 -0
- package/dist/modules/ecommerce/components/StoreCreateDialog.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreDomainBindingDialog.js +162 -0
- package/dist/modules/ecommerce/components/StoreDomainBindingDialog.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreDomainsTab.js +357 -0
- package/dist/modules/ecommerce/components/StoreDomainsTab.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreEditPage.js +155 -0
- package/dist/modules/ecommerce/components/StoreEditPage.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreGeneralTab.js +167 -0
- package/dist/modules/ecommerce/components/StoreGeneralTab.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreListPage.js +290 -0
- package/dist/modules/ecommerce/components/StoreListPage.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreSeoTab.js +132 -0
- package/dist/modules/ecommerce/components/StoreSeoTab.js.map +7 -0
- package/dist/modules/ecommerce/components/StoreStatusBadge.js +20 -0
- package/dist/modules/ecommerce/components/StoreStatusBadge.js.map +7 -0
- package/dist/modules/ecommerce/components/channelLookups.js +28 -0
- package/dist/modules/ecommerce/components/channelLookups.js.map +7 -0
- package/dist/modules/ecommerce/components/storeAdmin.js +41 -0
- package/dist/modules/ecommerce/components/storeAdmin.js.map +7 -0
- package/dist/modules/ecommerce/components/storeBrandingForm.js +197 -0
- package/dist/modules/ecommerce/components/storeBrandingForm.js.map +7 -0
- package/dist/modules/ecommerce/components/storeChannels.js +140 -0
- package/dist/modules/ecommerce/components/storeChannels.js.map +7 -0
- package/dist/modules/ecommerce/components/storeDomains.js +167 -0
- package/dist/modules/ecommerce/components/storeDomains.js.map +7 -0
- package/dist/modules/ecommerce/components/storeEditTabs.js +62 -0
- package/dist/modules/ecommerce/components/storeEditTabs.js.map +7 -0
- package/dist/modules/ecommerce/components/storeGeneral.js +95 -0
- package/dist/modules/ecommerce/components/storeGeneral.js.map +7 -0
- package/dist/modules/ecommerce/components/storeSeo.js +69 -0
- package/dist/modules/ecommerce/components/storeSeo.js.map +7 -0
- package/dist/modules/ecommerce/components/useChannelAssortmentCount.js +45 -0
- package/dist/modules/ecommerce/components/useChannelAssortmentCount.js.map +7 -0
- package/dist/modules/ecommerce/components/useStoreAccess.js +28 -0
- package/dist/modules/ecommerce/components/useStoreAccess.js.map +7 -0
- package/dist/modules/ecommerce/data/enrichers.js +157 -0
- package/dist/modules/ecommerce/data/enrichers.js.map +7 -0
- package/dist/modules/ecommerce/data/entities.js +197 -0
- package/dist/modules/ecommerce/data/entities.js.map +7 -0
- package/dist/modules/ecommerce/data/validators.js +406 -0
- package/dist/modules/ecommerce/data/validators.js.map +7 -0
- package/dist/modules/ecommerce/di.js +11 -0
- package/dist/modules/ecommerce/di.js.map +7 -0
- package/dist/modules/ecommerce/events.js +27 -0
- package/dist/modules/ecommerce/events.js.map +7 -0
- package/dist/modules/ecommerce/index.js +16 -0
- package/dist/modules/ecommerce/index.js.map +7 -0
- package/dist/modules/ecommerce/lib/assortmentCount.js +112 -0
- package/dist/modules/ecommerce/lib/assortmentCount.js.map +7 -0
- package/dist/modules/ecommerce/lib/brandingStyles.js +184 -0
- package/dist/modules/ecommerce/lib/brandingStyles.js.map +7 -0
- package/dist/modules/ecommerce/lib/buyerContext.js +284 -0
- package/dist/modules/ecommerce/lib/buyerContext.js.map +7 -0
- package/dist/modules/ecommerce/lib/cacheInvalidation.js +186 -0
- package/dist/modules/ecommerce/lib/cacheInvalidation.js.map +7 -0
- package/dist/modules/ecommerce/lib/cacheKeys.js +236 -0
- package/dist/modules/ecommerce/lib/cacheKeys.js.map +7 -0
- package/dist/modules/ecommerce/lib/createConflictRecheck.js +29 -0
- package/dist/modules/ecommerce/lib/createConflictRecheck.js.map +7 -0
- package/dist/modules/ecommerce/lib/crudEvents.js +94 -0
- package/dist/modules/ecommerce/lib/crudEvents.js.map +7 -0
- package/dist/modules/ecommerce/lib/crudSupport.js +64 -0
- package/dist/modules/ecommerce/lib/crudSupport.js.map +7 -0
- package/dist/modules/ecommerce/lib/domainBindingRebind.js +99 -0
- package/dist/modules/ecommerce/lib/domainBindingRebind.js.map +7 -0
- package/dist/modules/ecommerce/lib/domainMappingSummaries.js +39 -0
- package/dist/modules/ecommerce/lib/domainMappingSummaries.js.map +7 -0
- package/dist/modules/ecommerce/lib/exclusiveFlag.js +57 -0
- package/dist/modules/ecommerce/lib/exclusiveFlag.js.map +7 -0
- package/dist/modules/ecommerce/lib/references.js +70 -0
- package/dist/modules/ecommerce/lib/references.js.map +7 -0
- package/dist/modules/ecommerce/lib/seedDraftStore.js +99 -0
- package/dist/modules/ecommerce/lib/seedDraftStore.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeBindingCascade.js +109 -0
- package/dist/modules/ecommerce/lib/storeBindingCascade.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeBranding.js +40 -0
- package/dist/modules/ecommerce/lib/storeBranding.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeBrandingRoute.js +76 -0
- package/dist/modules/ecommerce/lib/storeBrandingRoute.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeContext.js +393 -0
- package/dist/modules/ecommerce/lib/storeContext.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeContextService.js +43 -0
- package/dist/modules/ecommerce/lib/storeContextService.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeLocale.js +60 -0
- package/dist/modules/ecommerce/lib/storeLocale.js.map +7 -0
- package/dist/modules/ecommerce/lib/storeNotifications.js +41 -0
- package/dist/modules/ecommerce/lib/storeNotifications.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontCatalogSupport.js +248 -0
- package/dist/modules/ecommerce/lib/storefrontCatalogSupport.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontCategories.js +241 -0
- package/dist/modules/ecommerce/lib/storefrontCategories.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontCategoryCache.js +71 -0
- package/dist/modules/ecommerce/lib/storefrontCategoryCache.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontDetail.js +447 -0
- package/dist/modules/ecommerce/lib/storefrontDetail.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontFacets.js +441 -0
- package/dist/modules/ecommerce/lib/storefrontFacets.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontOptionFilter.js +15 -0
- package/dist/modules/ecommerce/lib/storefrontOptionFilter.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontPricing.js +393 -0
- package/dist/modules/ecommerce/lib/storefrontPricing.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontProductCache.js +90 -0
- package/dist/modules/ecommerce/lib/storefrontProductCache.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontProductScope.js +107 -0
- package/dist/modules/ecommerce/lib/storefrontProductScope.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontProducts.js +670 -0
- package/dist/modules/ecommerce/lib/storefrontProducts.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontQuery.js +156 -0
- package/dist/modules/ecommerce/lib/storefrontQuery.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontRateLimit.js +99 -0
- package/dist/modules/ecommerce/lib/storefrontRateLimit.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontSearch.js +303 -0
- package/dist/modules/ecommerce/lib/storefrontSearch.js.map +7 -0
- package/dist/modules/ecommerce/lib/storefrontSearchCache.js +35 -0
- package/dist/modules/ecommerce/lib/storefrontSearchCache.js.map +7 -0
- package/dist/modules/ecommerce/lib/subscriberSupport.js +33 -0
- package/dist/modules/ecommerce/lib/subscriberSupport.js.map +7 -0
- package/dist/modules/ecommerce/lib/types.js +1 -0
- package/dist/modules/ecommerce/lib/types.js.map +7 -0
- package/dist/modules/ecommerce/migrations/Migration20261005113233_ecommerce.js +32 -0
- package/dist/modules/ecommerce/migrations/Migration20261005113233_ecommerce.js.map +7 -0
- package/dist/modules/ecommerce/migrations/Migration20261006112733_ecommerce.js +17 -0
- package/dist/modules/ecommerce/migrations/Migration20261006112733_ecommerce.js.map +7 -0
- package/dist/modules/ecommerce/notifications.client.js +47 -0
- package/dist/modules/ecommerce/notifications.client.js.map +7 -0
- package/dist/modules/ecommerce/notifications.js +48 -0
- package/dist/modules/ecommerce/notifications.js.map +7 -0
- package/dist/modules/ecommerce/search.js +83 -0
- package/dist/modules/ecommerce/search.js.map +7 -0
- package/dist/modules/ecommerce/setup.js +17 -0
- package/dist/modules/ecommerce/setup.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/assortment-empty-notifications.js +14 -0
- package/dist/modules/ecommerce/subscribers/assortment-empty-notifications.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/availability-policy-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/availability-policy-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/catalog-category-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/catalog-category-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/catalog-price-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/catalog-price-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/catalog-product-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/catalog-product-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/catalog-variant-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/catalog-variant-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/customer-group-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/customer-group-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/customer-group-membership-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/customer-group-membership-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/customer-group-terms-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/customer-group-terms-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/customer-user-deleted-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/customer-user-deleted-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/customer-user-updated-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/customer-user-updated-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/domain-binding-rebind.js +16 -0
- package/dist/modules/ecommerce/subscribers/domain-binding-rebind.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/domain-mapping-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/domain-mapping-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/store-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/store-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/store-channel-binding-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/store-channel-binding-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/store-domain-binding-cache-invalidation.js +14 -0
- package/dist/modules/ecommerce/subscribers/store-domain-binding-cache-invalidation.js.map +7 -0
- package/dist/modules/ecommerce/subscribers/store-notifications.js +14 -0
- package/dist/modules/ecommerce/subscribers/store-notifications.js.map +7 -0
- package/dist/modules/query_index/lib/batch.js +23 -9
- package/dist/modules/query_index/lib/batch.js.map +2 -2
- package/dist/modules/query_index/lib/doc-enrichers.js +212 -0
- package/dist/modules/query_index/lib/doc-enrichers.js.map +7 -0
- package/dist/modules/query_index/lib/document.js +2 -0
- package/dist/modules/query_index/lib/document.js.map +2 -2
- package/dist/modules/query_index/lib/engine.js +68 -1
- package/dist/modules/query_index/lib/engine.js.map +2 -2
- package/dist/modules/query_index/lib/indexer.js +7 -0
- package/dist/modules/query_index/lib/indexer.js.map +2 -2
- package/dist/modules/query_index/lib/search-tokens.js +2 -0
- package/dist/modules/query_index/lib/search-tokens.js.map +2 -2
- package/dist/modules/query_index/migrations/Migration20261005201500_query_index.js +17 -0
- package/dist/modules/query_index/migrations/Migration20261005201500_query_index.js.map +7 -0
- package/dist/modules/translations/components/TranslationManager.js +3 -3
- package/dist/modules/translations/components/TranslationManager.js.map +2 -2
- package/dist/modules/translations/data/validators.js +1 -1
- package/dist/modules/translations/data/validators.js.map +1 -1
- package/dist/modules/translations/lib/batch.js +21 -1
- package/dist/modules/translations/lib/batch.js.map +2 -2
- package/dist/modules/translations/lib/helpers.js +3 -0
- package/dist/modules/translations/lib/helpers.js.map +2 -2
- package/dist/modules/translations/lib/resolve-field-list.js +14 -2
- package/dist/modules/translations/lib/resolve-field-list.js.map +2 -2
- package/generated/entities/catalog_price_history_entry/index.ts +25 -0
- package/generated/entities/customer_group_terms/index.ts +1 -0
- package/generated/entities/ecommerce_store/index.ts +15 -0
- package/generated/entities/ecommerce_store_channel_binding/index.ts +13 -0
- package/generated/entities/ecommerce_store_domain_binding/index.ts +10 -0
- package/generated/entities.ids.generated.ts +8 -1
- package/generated/entity-fields-registry.ts +72 -0
- package/package.json +7 -7
- package/src/helpers/integration/customerGroupsFixtures.ts +2 -0
- package/src/modules/auth/i18n/de.json +8 -0
- package/src/modules/auth/i18n/en.json +8 -0
- package/src/modules/auth/i18n/es.json +8 -0
- package/src/modules/auth/i18n/ko.json +8 -0
- package/src/modules/auth/i18n/pl.json +8 -0
- package/src/modules/catalog/AGENTS.md +5 -2
- package/src/modules/catalog/acl.ts +7 -0
- package/src/modules/catalog/api/config/omnibus/route.ts +204 -0
- package/src/modules/catalog/api/prices/history/route.ts +139 -0
- package/src/modules/catalog/api/prices/omnibus-preview/route.ts +202 -0
- package/src/modules/catalog/api/products/route.ts +53 -308
- package/src/modules/catalog/api/tags/route.ts +6 -0
- package/src/modules/catalog/backend/config/catalog/page.tsx +2 -0
- package/src/modules/catalog/cli.ts +84 -1
- package/src/modules/catalog/commands/categories.ts +54 -2
- package/src/modules/catalog/commands/prices.ts +43 -1
- package/src/modules/catalog/commands/products.ts +84 -1
- package/src/modules/catalog/commands/variants.ts +7 -0
- package/src/modules/catalog/components/OmnibusSettings.tsx +832 -0
- package/src/modules/catalog/components/PriceEditorOmnibusRow.tsx +219 -0
- package/src/modules/catalog/components/lookupSources.ts +29 -0
- package/src/modules/catalog/components/prices/PriceScopeSelectors.tsx +9 -0
- package/src/modules/catalog/components/products/VariantBuilder.tsx +9 -0
- package/src/modules/catalog/data/entities.ts +123 -1
- package/src/modules/catalog/data/validators.ts +118 -0
- package/src/modules/catalog/di.ts +23 -0
- package/src/modules/catalog/i18n/de.json +77 -0
- package/src/modules/catalog/i18n/en.json +77 -0
- package/src/modules/catalog/i18n/es.json +77 -0
- package/src/modules/catalog/i18n/ko.json +77 -0
- package/src/modules/catalog/i18n/pl.json +77 -0
- package/src/modules/catalog/lib/omnibus.ts +406 -0
- package/src/modules/catalog/lib/omnibusBackfill.ts +198 -0
- package/src/modules/catalog/lib/omnibusCache.ts +111 -0
- package/src/modules/catalog/lib/omnibusConfig.ts +73 -0
- package/src/modules/catalog/lib/omnibusHistoryQueries.ts +248 -0
- package/src/modules/catalog/lib/omnibusPresentedEntry.ts +76 -0
- package/src/modules/catalog/lib/omnibusProductListEnrichment.ts +125 -0
- package/src/modules/catalog/lib/omnibusTypes.ts +202 -0
- package/src/modules/catalog/lib/optionSchemaTranslations.ts +55 -0
- package/src/modules/catalog/lib/priceHistoryQuery.ts +155 -0
- package/src/modules/catalog/lib/pricing.ts +42 -4
- package/src/modules/catalog/lib/productFilters.ts +349 -0
- package/src/modules/catalog/lib/productScopeKeys.ts +162 -0
- package/src/modules/catalog/lib/productScopeReindex.ts +139 -0
- package/src/modules/catalog/migrations/.snapshot-open-mercato.json +572 -0
- package/src/modules/catalog/migrations/Migration20261005105352_catalog.ts +39 -0
- package/src/modules/catalog/migrations/Migration20261005150824_catalog.ts +39 -0
- package/src/modules/catalog/services/catalogOmnibusService.ts +642 -0
- package/src/modules/catalog/setup.ts +2 -0
- package/src/modules/catalog/subscribers/product-scope-keys-category-deleted.ts +18 -0
- package/src/modules/catalog/subscribers/product-scope-keys-category-updated.ts +19 -0
- package/src/modules/catalog/translations.ts +12 -0
- package/src/modules/configs/i18n/de.json +5 -1
- package/src/modules/configs/i18n/en.json +5 -1
- package/src/modules/configs/i18n/es.json +5 -1
- package/src/modules/configs/i18n/ko.json +5 -1
- package/src/modules/configs/i18n/pl.json +5 -1
- package/src/modules/configs/lib/upgrade-actions.ts +35 -0
- package/src/modules/customer_groups/api/customer-groups/[id]/terms/route.ts +7 -0
- package/src/modules/customer_groups/components/CustomerGroupTermsSection.tsx +124 -2
- package/src/modules/customer_groups/components/customerGroupAssortmentScope.ts +46 -0
- package/src/modules/customer_groups/data/entities.ts +4 -0
- package/src/modules/customer_groups/data/validators.ts +14 -0
- package/src/modules/customer_groups/i18n/de.json +12 -0
- package/src/modules/customer_groups/i18n/en.json +12 -0
- package/src/modules/customer_groups/i18n/es.json +12 -0
- package/src/modules/customer_groups/i18n/ko.json +12 -0
- package/src/modules/customer_groups/i18n/pl.json +12 -0
- package/src/modules/customer_groups/migrations/.snapshot-open-mercato.json +17 -0
- package/src/modules/customer_groups/migrations/Migration20261005110250_customer_groups.ts +15 -0
- package/src/modules/customer_groups/services/customerGroupsService.ts +74 -23
- package/src/modules/ecommerce/acl.ts +9 -0
- package/src/modules/ecommerce/api/domain-mappings/route.ts +76 -0
- package/src/modules/ecommerce/api/openapi.ts +28 -0
- package/src/modules/ecommerce/api/store-channel-bindings/[id]/assortment-count/route.ts +141 -0
- package/src/modules/ecommerce/api/store-channel-bindings/crud.ts +283 -0
- package/src/modules/ecommerce/api/store-channel-bindings/route.ts +67 -0
- package/src/modules/ecommerce/api/store-domain-bindings/crud.ts +324 -0
- package/src/modules/ecommerce/api/store-domain-bindings/route.ts +73 -0
- package/src/modules/ecommerce/api/storefront/categories/[slug]/route.ts +94 -0
- package/src/modules/ecommerce/api/storefront/categories/openapiSchemas.ts +63 -0
- package/src/modules/ecommerce/api/storefront/categories/route.ts +78 -0
- package/src/modules/ecommerce/api/storefront/context/route.ts +203 -0
- package/src/modules/ecommerce/api/storefront/products/[idOrHandle]/route.ts +94 -0
- package/src/modules/ecommerce/api/storefront/products/openapiSchemas.ts +193 -0
- package/src/modules/ecommerce/api/storefront/products/route.ts +81 -0
- package/src/modules/ecommerce/api/storefront/search/suggest/openapiSchemas.ts +25 -0
- package/src/modules/ecommerce/api/storefront/search/suggest/route.ts +78 -0
- package/src/modules/ecommerce/api/storefront/storefrontRouteSupport.ts +68 -0
- package/src/modules/ecommerce/api/stores/[id]/branding/route.ts +205 -0
- package/src/modules/ecommerce/api/stores/[id]/preview-branding/route.ts +99 -0
- package/src/modules/ecommerce/api/stores/crud.ts +457 -0
- package/src/modules/ecommerce/api/stores/route.ts +66 -0
- package/src/modules/ecommerce/backend/config/ecommerce/[id]/page.meta.ts +12 -0
- package/src/modules/ecommerce/backend/config/ecommerce/[id]/page.tsx +5 -0
- package/src/modules/ecommerce/backend/config/ecommerce/page.meta.ts +12 -0
- package/src/modules/ecommerce/backend/config/ecommerce/page.tsx +5 -0
- package/src/modules/ecommerce/commands/stores.ts +154 -0
- package/src/modules/ecommerce/components/ChannelAssortmentCount.tsx +138 -0
- package/src/modules/ecommerce/components/ChannelBindingFormSections.tsx +40 -0
- package/src/modules/ecommerce/components/ChannelLookupPicker.tsx +5 -0
- package/src/modules/ecommerce/components/DomainStatusWarning.tsx +32 -0
- package/src/modules/ecommerce/components/StoreAvailabilityDefaultsSection.tsx +219 -0
- package/src/modules/ecommerce/components/StoreBrandingControls.tsx +73 -0
- package/src/modules/ecommerce/components/StoreBrandingPreview.tsx +77 -0
- package/src/modules/ecommerce/components/StoreBrandingTab.tsx +242 -0
- package/src/modules/ecommerce/components/StoreChannelBindingDialog.tsx +306 -0
- package/src/modules/ecommerce/components/StoreChannelsTab.tsx +375 -0
- package/src/modules/ecommerce/components/StoreCreateDialog.tsx +204 -0
- package/src/modules/ecommerce/components/StoreDomainBindingDialog.tsx +198 -0
- package/src/modules/ecommerce/components/StoreDomainsTab.tsx +426 -0
- package/src/modules/ecommerce/components/StoreEditPage.tsx +193 -0
- package/src/modules/ecommerce/components/StoreGeneralTab.tsx +189 -0
- package/src/modules/ecommerce/components/StoreListPage.tsx +326 -0
- package/src/modules/ecommerce/components/StoreSeoTab.tsx +152 -0
- package/src/modules/ecommerce/components/StoreStatusBadge.tsx +22 -0
- package/src/modules/ecommerce/components/channelLookups.ts +24 -0
- package/src/modules/ecommerce/components/storeAdmin.ts +56 -0
- package/src/modules/ecommerce/components/storeBrandingForm.ts +230 -0
- package/src/modules/ecommerce/components/storeChannels.ts +210 -0
- package/src/modules/ecommerce/components/storeDomains.ts +221 -0
- package/src/modules/ecommerce/components/storeEditTabs.tsx +76 -0
- package/src/modules/ecommerce/components/storeGeneral.ts +155 -0
- package/src/modules/ecommerce/components/storeSeo.ts +78 -0
- package/src/modules/ecommerce/components/useChannelAssortmentCount.ts +67 -0
- package/src/modules/ecommerce/components/useStoreAccess.ts +36 -0
- package/src/modules/ecommerce/data/enrichers.ts +213 -0
- package/src/modules/ecommerce/data/entities.ts +168 -0
- package/src/modules/ecommerce/data/validators.ts +587 -0
- package/src/modules/ecommerce/di.ts +9 -0
- package/src/modules/ecommerce/events.ts +27 -0
- package/src/modules/ecommerce/i18n/de.json +341 -0
- package/src/modules/ecommerce/i18n/en.json +341 -0
- package/src/modules/ecommerce/i18n/es.json +341 -0
- package/src/modules/ecommerce/i18n/ko.json +341 -0
- package/src/modules/ecommerce/i18n/pl.json +341 -0
- package/src/modules/ecommerce/index.ts +14 -0
- package/src/modules/ecommerce/lib/assortmentCount.ts +175 -0
- package/src/modules/ecommerce/lib/brandingStyles.ts +215 -0
- package/src/modules/ecommerce/lib/buyerContext.ts +401 -0
- package/src/modules/ecommerce/lib/cacheInvalidation.ts +302 -0
- package/src/modules/ecommerce/lib/cacheKeys.ts +340 -0
- package/src/modules/ecommerce/lib/createConflictRecheck.ts +31 -0
- package/src/modules/ecommerce/lib/crudEvents.ts +128 -0
- package/src/modules/ecommerce/lib/crudSupport.ts +85 -0
- package/src/modules/ecommerce/lib/domainBindingRebind.ts +138 -0
- package/src/modules/ecommerce/lib/domainMappingSummaries.ts +71 -0
- package/src/modules/ecommerce/lib/exclusiveFlag.ts +90 -0
- package/src/modules/ecommerce/lib/references.ts +93 -0
- package/src/modules/ecommerce/lib/seedDraftStore.ts +125 -0
- package/src/modules/ecommerce/lib/storeBindingCascade.ts +138 -0
- package/src/modules/ecommerce/lib/storeBranding.ts +48 -0
- package/src/modules/ecommerce/lib/storeBrandingRoute.ts +91 -0
- package/src/modules/ecommerce/lib/storeContext.ts +669 -0
- package/src/modules/ecommerce/lib/storeContextService.ts +71 -0
- package/src/modules/ecommerce/lib/storeLocale.ts +88 -0
- package/src/modules/ecommerce/lib/storeNotifications.ts +55 -0
- package/src/modules/ecommerce/lib/storefrontCatalogSupport.ts +427 -0
- package/src/modules/ecommerce/lib/storefrontCategories.ts +419 -0
- package/src/modules/ecommerce/lib/storefrontCategoryCache.ts +113 -0
- package/src/modules/ecommerce/lib/storefrontDetail.ts +654 -0
- package/src/modules/ecommerce/lib/storefrontFacets.ts +697 -0
- package/src/modules/ecommerce/lib/storefrontOptionFilter.ts +44 -0
- package/src/modules/ecommerce/lib/storefrontPricing.ts +583 -0
- package/src/modules/ecommerce/lib/storefrontProductCache.ts +126 -0
- package/src/modules/ecommerce/lib/storefrontProductScope.ts +181 -0
- package/src/modules/ecommerce/lib/storefrontProducts.ts +963 -0
- package/src/modules/ecommerce/lib/storefrontQuery.ts +215 -0
- package/src/modules/ecommerce/lib/storefrontRateLimit.ts +126 -0
- package/src/modules/ecommerce/lib/storefrontSearch.ts +454 -0
- package/src/modules/ecommerce/lib/storefrontSearchCache.ts +49 -0
- package/src/modules/ecommerce/lib/subscriberSupport.ts +41 -0
- package/src/modules/ecommerce/lib/types.ts +69 -0
- package/src/modules/ecommerce/migrations/.snapshot-open-mercato.json +829 -0
- package/src/modules/ecommerce/migrations/Migration20261005113233_ecommerce.ts +32 -0
- package/src/modules/ecommerce/migrations/Migration20261006112733_ecommerce.ts +15 -0
- package/src/modules/ecommerce/notifications.client.ts +46 -0
- package/src/modules/ecommerce/notifications.ts +46 -0
- package/src/modules/ecommerce/search.ts +93 -0
- package/src/modules/ecommerce/setup.ts +15 -0
- package/src/modules/ecommerce/subscribers/assortment-empty-notifications.ts +12 -0
- package/src/modules/ecommerce/subscribers/availability-policy-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/catalog-category-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/catalog-price-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/catalog-product-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/catalog-variant-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/customer-group-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/customer-group-membership-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/customer-group-terms-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/customer-user-deleted-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/customer-user-updated-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/domain-binding-rebind.ts +14 -0
- package/src/modules/ecommerce/subscribers/domain-mapping-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/store-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/store-channel-binding-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/store-domain-binding-cache-invalidation.ts +12 -0
- package/src/modules/ecommerce/subscribers/store-notifications.ts +12 -0
- package/src/modules/query_index/lib/batch.ts +25 -9
- package/src/modules/query_index/lib/doc-enrichers.ts +306 -0
- package/src/modules/query_index/lib/document.ts +2 -0
- package/src/modules/query_index/lib/engine.ts +58 -1
- package/src/modules/query_index/lib/indexer.ts +8 -0
- package/src/modules/query_index/lib/search-tokens.ts +2 -0
- package/src/modules/query_index/migrations/Migration20261005201500_query_index.ts +42 -0
- package/src/modules/translations/components/TranslationManager.tsx +3 -3
- package/src/modules/translations/data/validators.ts +1 -1
- package/src/modules/translations/lib/batch.ts +47 -0
- package/src/modules/translations/lib/helpers.ts +4 -0
- package/src/modules/translations/lib/resolve-field-list.ts +16 -2
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { Spinner } from '@open-mercato/ui/primitives/spinner'
|
|
5
|
+
import { StatusBadge, type StatusBadgeVariant } from '@open-mercato/ui/primitives/status-badge'
|
|
6
|
+
import { useBackendChrome } from '@open-mercato/ui/backend/BackendChromeProvider'
|
|
7
|
+
import { apiCall } from '@open-mercato/ui/backend/utils/apiCall'
|
|
8
|
+
import { hasFeature } from '@open-mercato/shared/security/features'
|
|
9
|
+
import { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'
|
|
10
|
+
import { createLogger } from '@open-mercato/shared/lib/logger'
|
|
11
|
+
import { getTelemetryRuntime } from '@open-mercato/shared/lib/telemetry/runtime'
|
|
12
|
+
import type { OmnibusApplicabilityReason, OmnibusBlock } from '../lib/omnibusTypes'
|
|
13
|
+
|
|
14
|
+
const logger = createLogger('catalog').child({ component: 'PriceEditorOmnibusRow' })
|
|
15
|
+
|
|
16
|
+
const PRICE_HISTORY_VIEW_FEATURE = 'catalog.price_history.view'
|
|
17
|
+
|
|
18
|
+
const NOT_APPLICABLE_REASONS: ReadonlySet<OmnibusApplicabilityReason> = new Set([
|
|
19
|
+
'no_history',
|
|
20
|
+
'not_in_eu_market',
|
|
21
|
+
'missing_channel_context',
|
|
22
|
+
'perishable_exempt',
|
|
23
|
+
])
|
|
24
|
+
|
|
25
|
+
const REASON_VARIANTS: Record<OmnibusApplicabilityReason, StatusBadgeVariant> = {
|
|
26
|
+
no_history: 'neutral',
|
|
27
|
+
not_in_eu_market: 'neutral',
|
|
28
|
+
missing_channel_context: 'warning',
|
|
29
|
+
insufficient_history: 'warning',
|
|
30
|
+
announced_promotion: 'info',
|
|
31
|
+
not_announced: 'neutral',
|
|
32
|
+
progressive_reduction_frozen: 'info',
|
|
33
|
+
perishable_exempt: 'neutral',
|
|
34
|
+
perishable_last_price: 'info',
|
|
35
|
+
new_arrival_reduced_window: 'info',
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type PreviewState =
|
|
39
|
+
| { status: 'loading' }
|
|
40
|
+
| { status: 'hidden' }
|
|
41
|
+
| { status: 'error' }
|
|
42
|
+
| { status: 'ready'; block: OmnibusBlock }
|
|
43
|
+
|
|
44
|
+
export type PriceEditorOmnibusRowProps = {
|
|
45
|
+
priceKindId: string
|
|
46
|
+
currencyCode: string | null | undefined
|
|
47
|
+
productId?: string | null
|
|
48
|
+
variantId?: string | null
|
|
49
|
+
offerId?: string | null
|
|
50
|
+
channelId?: string | null
|
|
51
|
+
channelSelectable?: boolean
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function isOmnibusBlock(value: unknown): value is OmnibusBlock {
|
|
55
|
+
if (!value || typeof value !== 'object') return false
|
|
56
|
+
const candidate = value as Partial<OmnibusBlock>
|
|
57
|
+
return typeof candidate.applicabilityReason === 'string' && typeof candidate.lookbackDays === 'number'
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function pickAxisAmount(block: OmnibusBlock, net: string | null, gross: string | null): string | null {
|
|
61
|
+
return block.minimizationAxis === 'net' ? net ?? gross : gross ?? net
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function formatAmount(amount: string | null, currencyCode: string, locale: string): string | null {
|
|
65
|
+
if (!amount) return null
|
|
66
|
+
const numeric = Number(amount)
|
|
67
|
+
const code = currencyCode.toUpperCase()
|
|
68
|
+
if (!Number.isFinite(numeric)) return `${code} ${amount}`
|
|
69
|
+
try {
|
|
70
|
+
return new Intl.NumberFormat(locale, { style: 'currency', currency: code }).format(numeric)
|
|
71
|
+
} catch {
|
|
72
|
+
const formatted = new Intl.NumberFormat(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 }).format(numeric)
|
|
73
|
+
return `${code} ${formatted}`
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function formatDate(value: string | null, locale: string): string | null {
|
|
78
|
+
if (!value) return null
|
|
79
|
+
const date = new Date(value)
|
|
80
|
+
return Number.isNaN(date.getTime()) ? value : new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }).format(date)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function PriceEditorOmnibusRow({
|
|
84
|
+
priceKindId,
|
|
85
|
+
currencyCode,
|
|
86
|
+
productId,
|
|
87
|
+
variantId,
|
|
88
|
+
offerId,
|
|
89
|
+
channelId,
|
|
90
|
+
channelSelectable = true,
|
|
91
|
+
}: PriceEditorOmnibusRowProps) {
|
|
92
|
+
const t = useT()
|
|
93
|
+
const locale = useLocale()
|
|
94
|
+
const { payload: chromePayload, isReady: chromeReady } = useBackendChrome()
|
|
95
|
+
const canView = chromeReady && hasFeature(chromePayload?.grantedFeatures, PRICE_HISTORY_VIEW_FEATURE)
|
|
96
|
+
const normalizedCurrency = typeof currencyCode === 'string' ? currencyCode.trim().toUpperCase() : ''
|
|
97
|
+
const hasTarget = Boolean(productId || variantId || offerId)
|
|
98
|
+
const [state, setState] = React.useState<PreviewState>({ status: 'loading' })
|
|
99
|
+
|
|
100
|
+
React.useEffect(() => {
|
|
101
|
+
if (!canView || !hasTarget || !priceKindId || !normalizedCurrency) {
|
|
102
|
+
setState({ status: 'hidden' })
|
|
103
|
+
return
|
|
104
|
+
}
|
|
105
|
+
let cancelled = false
|
|
106
|
+
setState({ status: 'loading' })
|
|
107
|
+
const params = new URLSearchParams({ priceKindId, currencyCode: normalizedCurrency })
|
|
108
|
+
if (productId) params.set('productId', productId)
|
|
109
|
+
if (variantId) params.set('variantId', variantId)
|
|
110
|
+
if (offerId) params.set('offerId', offerId)
|
|
111
|
+
if (channelId) params.set('channelId', channelId)
|
|
112
|
+
apiCall<unknown>(`/api/catalog/prices/omnibus-preview?${params.toString()}`)
|
|
113
|
+
.then((call) => {
|
|
114
|
+
if (cancelled) return
|
|
115
|
+
if (!call.ok) {
|
|
116
|
+
setState(call.status === 403 || call.status === 404 ? { status: 'hidden' } : { status: 'error' })
|
|
117
|
+
return
|
|
118
|
+
}
|
|
119
|
+
setState(isOmnibusBlock(call.result) ? { status: 'ready', block: call.result } : { status: 'hidden' })
|
|
120
|
+
})
|
|
121
|
+
.catch((err) => {
|
|
122
|
+
logger.error('catalog.omnibus.preview.load failed', { err })
|
|
123
|
+
getTelemetryRuntime()?.reportError(err, { module: 'catalog', code: 'catalog.omnibus_preview_load_failed' })
|
|
124
|
+
if (!cancelled) setState({ status: 'error' })
|
|
125
|
+
})
|
|
126
|
+
return () => {
|
|
127
|
+
cancelled = true
|
|
128
|
+
}
|
|
129
|
+
}, [canView, channelId, hasTarget, normalizedCurrency, offerId, priceKindId, productId, variantId])
|
|
130
|
+
|
|
131
|
+
const reasonLabels = React.useMemo<Record<OmnibusApplicabilityReason, string>>(() => ({
|
|
132
|
+
no_history: t('catalog.omnibus.reason.noHistory', 'No price history'),
|
|
133
|
+
not_in_eu_market: t('catalog.omnibus.reason.notInEuMarket', 'Not an EU market'),
|
|
134
|
+
missing_channel_context: t('catalog.omnibus.reason.missingChannelContext', 'Channel required'),
|
|
135
|
+
insufficient_history: t('catalog.omnibus.reason.insufficientHistory', 'Insufficient history'),
|
|
136
|
+
announced_promotion: t('catalog.omnibus.reason.announcedPromotion', 'Announced promotion'),
|
|
137
|
+
not_announced: t('catalog.omnibus.reason.notAnnounced', 'No announced reduction'),
|
|
138
|
+
progressive_reduction_frozen: t('catalog.omnibus.reason.progressiveReductionFrozen', 'Progressive reduction'),
|
|
139
|
+
perishable_exempt: t('catalog.omnibus.reason.perishableExempt', 'Perishable goods exemption'),
|
|
140
|
+
perishable_last_price: t('catalog.omnibus.reason.perishableLastPrice', 'Perishable goods: last price'),
|
|
141
|
+
new_arrival_reduced_window: t('catalog.omnibus.reason.newArrivalReducedWindow', 'New arrival: shorter window'),
|
|
142
|
+
}), [t])
|
|
143
|
+
|
|
144
|
+
if (state.status === 'hidden') return null
|
|
145
|
+
|
|
146
|
+
if (state.status === 'loading') {
|
|
147
|
+
return (
|
|
148
|
+
<div className="mt-2 flex items-center gap-2 text-xs text-muted-foreground" data-testid="catalog-price-omnibus-row">
|
|
149
|
+
<Spinner className="size-3" />
|
|
150
|
+
{t('catalog.omnibus.priceEditor.loading', 'Loading Omnibus reference price…')}
|
|
151
|
+
</div>
|
|
152
|
+
)
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (state.status === 'error') {
|
|
156
|
+
return (
|
|
157
|
+
<p className="mt-2 text-xs text-status-error-text" data-testid="catalog-price-omnibus-row">
|
|
158
|
+
{t('catalog.omnibus.priceEditor.loadError', 'Could not load the Omnibus reference price.')}
|
|
159
|
+
</p>
|
|
160
|
+
)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
const { block } = state
|
|
164
|
+
const reason = block.applicabilityReason
|
|
165
|
+
const reasonBadge = (
|
|
166
|
+
<StatusBadge variant={REASON_VARIANTS[reason] ?? 'neutral'}>{reasonLabels[reason] ?? reason}</StatusBadge>
|
|
167
|
+
)
|
|
168
|
+
const lowest = formatAmount(pickAxisAmount(block, block.lowestPriceNet, block.lowestPriceGross), block.currencyCode, locale)
|
|
169
|
+
|
|
170
|
+
if (NOT_APPLICABLE_REASONS.has(reason) || !lowest) {
|
|
171
|
+
return (
|
|
172
|
+
<div className="mt-2 space-y-1 text-xs" data-testid="catalog-price-omnibus-row">
|
|
173
|
+
<div className="flex flex-wrap items-center gap-2 text-muted-foreground">
|
|
174
|
+
<span>{t('catalog.omnibus.priceEditor.notApplicable', 'Omnibus reference price not applicable')}</span>
|
|
175
|
+
{reasonBadge}
|
|
176
|
+
</div>
|
|
177
|
+
{reason === 'missing_channel_context' ? (
|
|
178
|
+
<p className="text-status-warning-text">
|
|
179
|
+
{channelSelectable
|
|
180
|
+
? t('catalog.omnibus.priceEditor.missingChannel', 'Select a channel to compute the reference price.')
|
|
181
|
+
: t('catalog.omnibus.priceEditor.perChannelReference', 'The reference price is computed per sales channel.')}
|
|
182
|
+
</p>
|
|
183
|
+
) : null}
|
|
184
|
+
</div>
|
|
185
|
+
)
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const isProgressive = reason === 'progressive_reduction_frozen'
|
|
189
|
+
const previous = isProgressive
|
|
190
|
+
? formatAmount(pickAxisAmount(block, block.previousPriceNet, block.previousPriceGross), block.currencyCode, locale)
|
|
191
|
+
: null
|
|
192
|
+
const coverageStart = reason === 'insufficient_history' ? formatDate(block.coverageStartAt, locale) : null
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<div className="mt-2 space-y-1 text-xs" data-testid="catalog-price-omnibus-row">
|
|
196
|
+
<div className="flex flex-wrap items-center gap-2">
|
|
197
|
+
<span className="text-muted-foreground">
|
|
198
|
+
{isProgressive
|
|
199
|
+
? t('catalog.omnibus.priceEditor.progressiveRef', 'Reference price (frozen for the progressive reduction)')
|
|
200
|
+
: t('catalog.omnibus.priceEditor.lowestInDays', 'Lowest price in the last {{days}} days', { days: block.lookbackDays })}
|
|
201
|
+
</span>
|
|
202
|
+
<span className="font-medium" data-testid="catalog-price-omnibus-reference">{lowest}</span>
|
|
203
|
+
{reasonBadge}
|
|
204
|
+
</div>
|
|
205
|
+
{previous ? (
|
|
206
|
+
<p className="text-muted-foreground">
|
|
207
|
+
{t('catalog.omnibus.priceEditor.previousPrice', 'Price before the reduction: {{price}}', { price: previous })}
|
|
208
|
+
</p>
|
|
209
|
+
) : null}
|
|
210
|
+
{reason === 'insufficient_history' ? (
|
|
211
|
+
<p className="text-status-warning-text">
|
|
212
|
+
{coverageStart
|
|
213
|
+
? t('catalog.omnibus.priceEditor.insufficientHistorySince', 'Price history is only available since {{date}}; the reference may be incomplete.', { date: coverageStart })
|
|
214
|
+
: t('catalog.omnibus.priceEditor.insufficientHistory', 'Price history does not cover the full window; the reference may be incomplete.')}
|
|
215
|
+
</p>
|
|
216
|
+
) : null}
|
|
217
|
+
</div>
|
|
218
|
+
)
|
|
219
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createIdsLookupSource,
|
|
3
|
+
pickLookupString,
|
|
4
|
+
type LookupSource,
|
|
5
|
+
} from '@open-mercato/ui/backend/inputs/lookupSources'
|
|
6
|
+
|
|
7
|
+
export const categoryLookupSource: LookupSource = createIdsLookupSource(
|
|
8
|
+
'categories',
|
|
9
|
+
'/api/catalog/categories',
|
|
10
|
+
(item) => {
|
|
11
|
+
const value = pickLookupString(item, 'id')
|
|
12
|
+
if (!value) return null
|
|
13
|
+
return { value, label: pickLookupString(item, 'pathLabel', 'name') || value }
|
|
14
|
+
},
|
|
15
|
+
{ view: 'manage' },
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
export const productLookupSource: LookupSource = createIdsLookupSource('products', '/api/catalog/products', (item) => {
|
|
19
|
+
const value = pickLookupString(item, 'id')
|
|
20
|
+
if (!value) return null
|
|
21
|
+
const sku = pickLookupString(item, 'sku')
|
|
22
|
+
return { value, label: pickLookupString(item, 'title', 'name') || value, description: sku || null }
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
export const tagLookupSource: LookupSource = createIdsLookupSource('tags', '/api/catalog/tags', (item) => {
|
|
26
|
+
const value = pickLookupString(item, 'id')
|
|
27
|
+
if (!value) return null
|
|
28
|
+
return { value, label: pickLookupString(item, 'label') || value }
|
|
29
|
+
})
|
|
@@ -164,9 +164,11 @@ export function PriceCustomerSelect({
|
|
|
164
164
|
export function PriceChannelSelect({
|
|
165
165
|
value,
|
|
166
166
|
onChange,
|
|
167
|
+
disabled,
|
|
167
168
|
}: {
|
|
168
169
|
value: string
|
|
169
170
|
onChange: (next: string) => void
|
|
171
|
+
disabled?: boolean
|
|
170
172
|
}) {
|
|
171
173
|
const t = useT()
|
|
172
174
|
const mapItem = React.useCallback((item: RemoteItem): ComboboxOption | null => {
|
|
@@ -180,6 +182,7 @@ export function PriceChannelSelect({
|
|
|
180
182
|
<ComboboxInput
|
|
181
183
|
value={value}
|
|
182
184
|
onChange={onChange}
|
|
185
|
+
disabled={disabled}
|
|
183
186
|
allowCustomValues={false}
|
|
184
187
|
clearable
|
|
185
188
|
placeholder={t('catalog.prices.select.channel.placeholder', 'Select a channel…')}
|
|
@@ -192,9 +195,13 @@ export function PriceChannelSelect({
|
|
|
192
195
|
export function PricePriceKindSelect({
|
|
193
196
|
value,
|
|
194
197
|
onChange,
|
|
198
|
+
disabled,
|
|
199
|
+
clearable,
|
|
195
200
|
}: {
|
|
196
201
|
value: string
|
|
197
202
|
onChange: (next: string) => void
|
|
203
|
+
disabled?: boolean
|
|
204
|
+
clearable?: boolean
|
|
198
205
|
}) {
|
|
199
206
|
const t = useT()
|
|
200
207
|
const mapItem = React.useCallback((item: RemoteItem): ComboboxOption | null => {
|
|
@@ -208,7 +215,9 @@ export function PricePriceKindSelect({
|
|
|
208
215
|
<ComboboxInput
|
|
209
216
|
value={value}
|
|
210
217
|
onChange={onChange}
|
|
218
|
+
disabled={disabled}
|
|
211
219
|
allowCustomValues={false}
|
|
220
|
+
clearable={clearable}
|
|
212
221
|
placeholder={t('catalog.prices.select.priceKind.placeholder', 'Select a price kind…')}
|
|
213
222
|
loadSuggestions={(query) => loadOptions('/api/catalog/price-kinds', buildLookupParams(query, '20'), mapItem)}
|
|
214
223
|
resolveLabel={(id) => resolveOne('/api/catalog/price-kinds', 'ids', id, mapItem)}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { Switch } from '@open-mercato/ui/primitives/switch'
|
|
16
16
|
import { ProductMediaManager } from './ProductMediaManager'
|
|
17
17
|
import { MetadataEditor } from './MetadataEditor'
|
|
18
|
+
import { PriceEditorOmnibusRow } from '../PriceEditorOmnibusRow'
|
|
18
19
|
import type { PriceKindSummary, TaxRateSummary } from './productForm'
|
|
19
20
|
import { formatTaxRateLabel } from './productForm'
|
|
20
21
|
import type { OptionDefinition, VariantFormValues, VariantPriceDraft } from './variantForm'
|
|
@@ -444,6 +445,14 @@ export function VariantPricesSection({
|
|
|
444
445
|
onChange={(event) => updatePrice(kind.id, { amount: event.target.value })}
|
|
445
446
|
placeholder="0.00"
|
|
446
447
|
/>
|
|
448
|
+
{values.id && draft?.priceId ? (
|
|
449
|
+
<PriceEditorOmnibusRow
|
|
450
|
+
variantId={values.id}
|
|
451
|
+
priceKindId={kind.id}
|
|
452
|
+
currencyCode={draft.currencyCode ?? kind.currencyCode}
|
|
453
|
+
channelSelectable={false}
|
|
454
|
+
/>
|
|
455
|
+
) : null}
|
|
447
456
|
</div>
|
|
448
457
|
)
|
|
449
458
|
})
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Collection, OptionalProps } from '@mikro-orm/core'
|
|
2
|
-
import { Entity, Index, ManyToOne, OneToMany, PrimaryKey, Property, Unique } from '@mikro-orm/decorators/legacy'
|
|
2
|
+
import { Entity, Enum, Index, ManyToOne, OneToMany, PrimaryKey, Property, Unique } from '@mikro-orm/decorators/legacy'
|
|
3
3
|
import type {
|
|
4
4
|
CatalogExciseCategory,
|
|
5
5
|
CatalogGtinType,
|
|
@@ -10,6 +10,7 @@ import type {
|
|
|
10
10
|
CatalogProductType,
|
|
11
11
|
} from './types'
|
|
12
12
|
import type { ReferenceUnitCode } from '@open-mercato/shared/lib/units/unitCodes'
|
|
13
|
+
import type { PriceHistoryChangeType, PriceHistorySource } from '../lib/omnibusTypes'
|
|
13
14
|
|
|
14
15
|
@Entity({ tableName: 'catalog_product_option_schemas' })
|
|
15
16
|
@Index({
|
|
@@ -785,6 +786,20 @@ export class CatalogPriceKind {
|
|
|
785
786
|
name: 'catalog_product_variant_prices_product_scope_idx',
|
|
786
787
|
properties: ['product', 'organizationId', 'tenantId'],
|
|
787
788
|
})
|
|
789
|
+
@Index({
|
|
790
|
+
name: 'catalog_product_variant_prices_customer_idx',
|
|
791
|
+
expression:
|
|
792
|
+
'create index "catalog_product_variant_prices_customer_idx" on "catalog_product_variant_prices" ("customer_id", "organization_id", "tenant_id") where "customer_id" is not null',
|
|
793
|
+
})
|
|
794
|
+
@Index({
|
|
795
|
+
name: 'catalog_product_variant_prices_customer_group_idx',
|
|
796
|
+
expression:
|
|
797
|
+
'create index "catalog_product_variant_prices_customer_group_idx" on "catalog_product_variant_prices" ("customer_group_id", "organization_id", "tenant_id") where "customer_group_id" is not null',
|
|
798
|
+
})
|
|
799
|
+
@Index({
|
|
800
|
+
name: 'catalog_product_variant_prices_product_lookup_idx',
|
|
801
|
+
properties: ['product', 'currencyCode', 'channelId', 'organizationId', 'tenantId'],
|
|
802
|
+
})
|
|
788
803
|
export class CatalogProductPrice {
|
|
789
804
|
[OptionalProps]?: 'createdAt' | 'updatedAt'
|
|
790
805
|
|
|
@@ -863,3 +878,110 @@ export class CatalogProductPrice {
|
|
|
863
878
|
@Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })
|
|
864
879
|
updatedAt: Date = new Date()
|
|
865
880
|
}
|
|
881
|
+
|
|
882
|
+
@Entity({ tableName: 'catalog_price_history_entries' })
|
|
883
|
+
@Index({
|
|
884
|
+
name: 'catalog_price_history_product_idx',
|
|
885
|
+
properties: ['tenantId', 'organizationId', 'productId', 'priceKindId', 'currencyCode', 'recordedAt'],
|
|
886
|
+
})
|
|
887
|
+
@Index({
|
|
888
|
+
name: 'catalog_price_history_product_channel_idx',
|
|
889
|
+
properties: ['tenantId', 'organizationId', 'productId', 'channelId', 'priceKindId', 'currencyCode', 'recordedAt'],
|
|
890
|
+
})
|
|
891
|
+
@Index({
|
|
892
|
+
name: 'catalog_price_history_variant_idx',
|
|
893
|
+
properties: ['tenantId', 'organizationId', 'variantId', 'priceKindId', 'currencyCode', 'recordedAt'],
|
|
894
|
+
})
|
|
895
|
+
@Index({
|
|
896
|
+
name: 'catalog_price_history_variant_channel_idx',
|
|
897
|
+
properties: ['tenantId', 'organizationId', 'variantId', 'channelId', 'priceKindId', 'currencyCode', 'recordedAt'],
|
|
898
|
+
})
|
|
899
|
+
@Index({
|
|
900
|
+
name: 'catalog_price_history_offer_idx',
|
|
901
|
+
properties: ['tenantId', 'organizationId', 'offerId', 'priceKindId', 'currencyCode', 'recordedAt'],
|
|
902
|
+
})
|
|
903
|
+
@Index({
|
|
904
|
+
name: 'catalog_price_history_price_idx',
|
|
905
|
+
properties: ['tenantId', 'organizationId', 'priceId'],
|
|
906
|
+
})
|
|
907
|
+
@Index({
|
|
908
|
+
name: 'catalog_price_history_idempotency_uq',
|
|
909
|
+
expression:
|
|
910
|
+
'create unique index "catalog_price_history_idempotency_uq" on "catalog_price_history_entries" ("tenant_id", "organization_id", "idempotency_key") where "idempotency_key" is not null',
|
|
911
|
+
})
|
|
912
|
+
export class CatalogPriceHistoryEntry {
|
|
913
|
+
@PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })
|
|
914
|
+
id!: string
|
|
915
|
+
|
|
916
|
+
@Property({ name: 'tenant_id', type: 'uuid' })
|
|
917
|
+
tenantId!: string
|
|
918
|
+
|
|
919
|
+
@Property({ name: 'organization_id', type: 'uuid' })
|
|
920
|
+
organizationId!: string
|
|
921
|
+
|
|
922
|
+
@Property({ name: 'price_id', type: 'uuid' })
|
|
923
|
+
priceId!: string
|
|
924
|
+
|
|
925
|
+
@Property({ name: 'product_id', type: 'uuid' })
|
|
926
|
+
productId!: string
|
|
927
|
+
|
|
928
|
+
@Property({ name: 'variant_id', type: 'uuid', nullable: true })
|
|
929
|
+
variantId?: string | null
|
|
930
|
+
|
|
931
|
+
@Property({ name: 'offer_id', type: 'uuid', nullable: true })
|
|
932
|
+
offerId?: string | null
|
|
933
|
+
|
|
934
|
+
@Property({ name: 'channel_id', type: 'uuid', nullable: true })
|
|
935
|
+
channelId?: string | null
|
|
936
|
+
|
|
937
|
+
@Property({ name: 'price_kind_id', type: 'uuid' })
|
|
938
|
+
priceKindId!: string
|
|
939
|
+
|
|
940
|
+
@Property({ name: 'price_kind_code', type: 'text' })
|
|
941
|
+
priceKindCode!: string
|
|
942
|
+
|
|
943
|
+
@Property({ name: 'currency_code', type: 'varchar', length: 3 })
|
|
944
|
+
currencyCode!: string
|
|
945
|
+
|
|
946
|
+
@Property({ name: 'unit_price_net', type: 'numeric', precision: 16, scale: 4, nullable: true })
|
|
947
|
+
unitPriceNet?: string | null
|
|
948
|
+
|
|
949
|
+
@Property({ name: 'unit_price_gross', type: 'numeric', precision: 16, scale: 4, nullable: true })
|
|
950
|
+
unitPriceGross?: string | null
|
|
951
|
+
|
|
952
|
+
@Property({ name: 'tax_rate', type: 'numeric', precision: 7, scale: 4, nullable: true })
|
|
953
|
+
taxRate?: string | null
|
|
954
|
+
|
|
955
|
+
@Property({ name: 'tax_amount', type: 'numeric', precision: 16, scale: 4, nullable: true })
|
|
956
|
+
taxAmount?: string | null
|
|
957
|
+
|
|
958
|
+
@Property({ name: 'min_quantity', type: 'integer', nullable: true })
|
|
959
|
+
minQuantity?: number | null
|
|
960
|
+
|
|
961
|
+
@Property({ name: 'max_quantity', type: 'integer', nullable: true })
|
|
962
|
+
maxQuantity?: number | null
|
|
963
|
+
|
|
964
|
+
@Property({ name: 'starts_at', type: Date, nullable: true })
|
|
965
|
+
startsAt?: Date | null
|
|
966
|
+
|
|
967
|
+
@Property({ name: 'ends_at', type: Date, nullable: true })
|
|
968
|
+
endsAt?: Date | null
|
|
969
|
+
|
|
970
|
+
@Property({ name: 'recorded_at', type: Date })
|
|
971
|
+
recordedAt!: Date
|
|
972
|
+
|
|
973
|
+
@Enum({ items: ['create', 'update', 'delete', 'undo'], type: 'text', name: 'change_type' })
|
|
974
|
+
changeType!: PriceHistoryChangeType
|
|
975
|
+
|
|
976
|
+
@Enum({ items: ['api', 'system'], type: 'text', name: 'source' })
|
|
977
|
+
source!: PriceHistorySource
|
|
978
|
+
|
|
979
|
+
@Property({ name: 'is_announced', type: 'boolean', nullable: true })
|
|
980
|
+
isAnnounced?: boolean | null
|
|
981
|
+
|
|
982
|
+
@Property({ name: 'idempotency_key', type: 'text', nullable: true })
|
|
983
|
+
idempotencyKey?: string | null
|
|
984
|
+
|
|
985
|
+
@Property({ name: 'metadata', type: 'jsonb', nullable: true })
|
|
986
|
+
metadata?: Record<string, unknown> | null
|
|
987
|
+
}
|
|
@@ -13,6 +13,12 @@ import {
|
|
|
13
13
|
getCatalogPriceAmountValidationMessage,
|
|
14
14
|
validateCatalogPriceAmountInput,
|
|
15
15
|
} from '../lib/priceValidation'
|
|
16
|
+
import { ISO_COUNTRIES } from '@open-mercato/shared/lib/location/countries'
|
|
17
|
+
import {
|
|
18
|
+
omnibusLookbackDaysSchema,
|
|
19
|
+
omnibusMinimizationAxisSchema,
|
|
20
|
+
omnibusNoChannelModeSchema,
|
|
21
|
+
} from '../lib/omnibusTypes'
|
|
16
22
|
|
|
17
23
|
const uuid = () => z.string().uuid()
|
|
18
24
|
|
|
@@ -579,6 +585,113 @@ export const productUnitConversionDeleteSchema = scoped.extend({
|
|
|
579
585
|
id: uuid(),
|
|
580
586
|
})
|
|
581
587
|
|
|
588
|
+
export const PRICE_HISTORY_MAX_PAGE_SIZE = 100
|
|
589
|
+
|
|
590
|
+
export const PRICE_HISTORY_DEFAULT_PAGE_SIZE = 50
|
|
591
|
+
|
|
592
|
+
export const priceHistoryQuerySchema = z
|
|
593
|
+
.object({
|
|
594
|
+
productId: uuid().optional(),
|
|
595
|
+
variantId: uuid().optional(),
|
|
596
|
+
priceKindId: uuid().optional(),
|
|
597
|
+
channelId: uuid().optional(),
|
|
598
|
+
currencyCode: z
|
|
599
|
+
.string()
|
|
600
|
+
.trim()
|
|
601
|
+
.toUpperCase()
|
|
602
|
+
.regex(/^[A-Z]{3}$/, 'currency code must be a three-letter ISO code')
|
|
603
|
+
.optional(),
|
|
604
|
+
from: z.string().datetime({ offset: true }).optional(),
|
|
605
|
+
to: z.string().datetime({ offset: true }).optional(),
|
|
606
|
+
pageSize: z.coerce
|
|
607
|
+
.number()
|
|
608
|
+
.int()
|
|
609
|
+
.min(1)
|
|
610
|
+
.max(PRICE_HISTORY_MAX_PAGE_SIZE)
|
|
611
|
+
.default(PRICE_HISTORY_DEFAULT_PAGE_SIZE),
|
|
612
|
+
cursor: z.string().trim().max(512).optional(),
|
|
613
|
+
includeTotal: z.enum(['true', 'false']).optional(),
|
|
614
|
+
})
|
|
615
|
+
.strict()
|
|
616
|
+
.refine((value) => Boolean(value.productId || value.variantId), {
|
|
617
|
+
message: 'one of productId or variantId is required',
|
|
618
|
+
path: ['productId'],
|
|
619
|
+
})
|
|
620
|
+
.refine(
|
|
621
|
+
(value) => !value.from || !value.to || new Date(value.from).getTime() <= new Date(value.to).getTime(),
|
|
622
|
+
{ message: 'from must not be later than to', path: ['from'] },
|
|
623
|
+
)
|
|
624
|
+
|
|
625
|
+
export const omnibusPreviewQuerySchema = z
|
|
626
|
+
.object({
|
|
627
|
+
priceKindId: uuid(),
|
|
628
|
+
currencyCode: z
|
|
629
|
+
.string()
|
|
630
|
+
.trim()
|
|
631
|
+
.toUpperCase()
|
|
632
|
+
.regex(/^[A-Z]{3}$/, 'currency code must be a three-letter ISO code'),
|
|
633
|
+
productId: uuid().optional(),
|
|
634
|
+
variantId: uuid().optional(),
|
|
635
|
+
offerId: uuid().optional(),
|
|
636
|
+
channelId: uuid().optional(),
|
|
637
|
+
})
|
|
638
|
+
.strict()
|
|
639
|
+
.refine((value) => Boolean(value.productId || value.variantId || value.offerId), {
|
|
640
|
+
message: 'one of productId, variantId or offerId is required',
|
|
641
|
+
path: ['productId'],
|
|
642
|
+
})
|
|
643
|
+
|
|
644
|
+
const ISO_COUNTRY_CODES = new Set(ISO_COUNTRIES.map((country) => country.code))
|
|
645
|
+
|
|
646
|
+
const omnibusConfigCountryCodeSchema = z
|
|
647
|
+
.string()
|
|
648
|
+
.regex(/^[A-Z]{2}$/, 'omnibus_country_code_alpha2_required')
|
|
649
|
+
.refine((value) => value !== 'EU', 'omnibus_country_code_eu_not_allowed')
|
|
650
|
+
.refine((value) => value === 'EU' || ISO_COUNTRY_CODES.has(value), 'omnibus_country_code_unknown')
|
|
651
|
+
|
|
652
|
+
const unsupportedOmnibusField = (code: string) => z.undefined({ error: code }).optional()
|
|
653
|
+
|
|
654
|
+
const omnibusChannelConfigPatchSchema = z
|
|
655
|
+
.object({
|
|
656
|
+
presentedPriceKindId: uuid(),
|
|
657
|
+
countryCode: omnibusConfigCountryCodeSchema.optional(),
|
|
658
|
+
lookbackDays: omnibusLookbackDaysSchema.optional(),
|
|
659
|
+
minimizationAxis: omnibusMinimizationAxisSchema.optional(),
|
|
660
|
+
progressiveReductionRule: unsupportedOmnibusField('omnibus_derogation_not_supported'),
|
|
661
|
+
progressiveMaxGapDays: unsupportedOmnibusField('omnibus_derogation_not_supported'),
|
|
662
|
+
perishableGoodsRule: unsupportedOmnibusField('omnibus_derogation_not_supported'),
|
|
663
|
+
newArrivalRule: unsupportedOmnibusField('omnibus_derogation_not_supported'),
|
|
664
|
+
newArrivalsLookbackDays: unsupportedOmnibusField('omnibus_derogation_not_supported'),
|
|
665
|
+
})
|
|
666
|
+
.strict()
|
|
667
|
+
|
|
668
|
+
export const omnibusConfigPatchSchema = z
|
|
669
|
+
.object({
|
|
670
|
+
enabled: z.boolean().optional(),
|
|
671
|
+
enabledCountryCodes: z.array(omnibusConfigCountryCodeSchema).optional(),
|
|
672
|
+
noChannelMode: omnibusNoChannelModeSchema.optional(),
|
|
673
|
+
lookbackDays: omnibusLookbackDaysSchema.optional(),
|
|
674
|
+
minimizationAxis: omnibusMinimizationAxisSchema.optional(),
|
|
675
|
+
defaultPresentedPriceKindId: uuid().nullable().optional(),
|
|
676
|
+
channels: z.record(uuid(), omnibusChannelConfigPatchSchema).optional(),
|
|
677
|
+
backfillCoverage: unsupportedOmnibusField('omnibus_backfill_coverage_read_only'),
|
|
678
|
+
})
|
|
679
|
+
.strict()
|
|
680
|
+
|
|
681
|
+
export const omnibusBackfillOptionsSchema = z
|
|
682
|
+
.object({
|
|
683
|
+
tenantId: uuid(),
|
|
684
|
+
organizationId: uuid().optional(),
|
|
685
|
+
channelId: uuid().optional(),
|
|
686
|
+
unscoped: z.boolean().default(false),
|
|
687
|
+
batchSize: z.number().int().min(1).max(1000).default(500),
|
|
688
|
+
dryRun: z.boolean().default(false),
|
|
689
|
+
})
|
|
690
|
+
.refine((value) => !(value.channelId && value.unscoped), {
|
|
691
|
+
message: 'omnibus_backfill_channel_and_unscoped_exclusive',
|
|
692
|
+
path: ['unscoped'],
|
|
693
|
+
})
|
|
694
|
+
|
|
582
695
|
export type ProductCreateInput = z.infer<typeof productCreateSchema>
|
|
583
696
|
export type ProductUpdateInput = z.infer<typeof productUpdateSchema>
|
|
584
697
|
export type ProductBulkCreateRow = z.infer<typeof productBulkCreateRowSchema>
|
|
@@ -601,3 +714,8 @@ export type OfferUpdateInput = z.infer<typeof offerUpdateSchema>
|
|
|
601
714
|
export type ProductUnitConversionCreateInput = z.infer<typeof productUnitConversionCreateSchema>
|
|
602
715
|
export type ProductUnitConversionUpdateInput = z.infer<typeof productUnitConversionUpdateSchema>
|
|
603
716
|
export type ProductUnitConversionDeleteInput = z.infer<typeof productUnitConversionDeleteSchema>
|
|
717
|
+
export type PriceHistoryQuery = z.infer<typeof priceHistoryQuerySchema>
|
|
718
|
+
export type OmnibusPreviewQuery = z.infer<typeof omnibusPreviewQuerySchema>
|
|
719
|
+
export type OmnibusConfigPatch = z.infer<typeof omnibusConfigPatchSchema>
|
|
720
|
+
export type OmnibusBackfillOptionsInput = z.input<typeof omnibusBackfillOptionsSchema>
|
|
721
|
+
export type OmnibusBackfillOptions = z.infer<typeof omnibusBackfillOptionsSchema>
|
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
import { asFunction, asValue } from 'awilix'
|
|
2
|
+
import type { CacheStrategy } from '@open-mercato/cache'
|
|
2
3
|
import type { EventBus } from '@open-mercato/events'
|
|
3
4
|
import type { AppContainer } from '@open-mercato/shared/lib/di/container'
|
|
5
|
+
import type { ModuleConfigService } from '@open-mercato/core/modules/configs/lib/module-config-service'
|
|
6
|
+
import { registerIndexDocEnricher } from '@open-mercato/core/modules/query_index/lib/doc-enrichers'
|
|
4
7
|
import { DefaultCatalogPricingService } from './services/catalogPricingService'
|
|
8
|
+
import { DefaultCatalogOmnibusService } from './services/catalogOmnibusService'
|
|
5
9
|
import { CatalogProduct, CatalogProductPrice, CatalogProductVariant } from './data/entities'
|
|
10
|
+
import { catalogProductScopeKeysEnricher } from './lib/productScopeKeys'
|
|
6
11
|
|
|
7
12
|
type AppCradle = AppContainer['cradle'] & {
|
|
8
13
|
eventBus?: EventBus | null
|
|
9
14
|
}
|
|
10
15
|
|
|
16
|
+
function softCradle<T>(cradle: AppCradle, name: string): T | null {
|
|
17
|
+
try {
|
|
18
|
+
const value = (cradle as Record<string, unknown>)[name]
|
|
19
|
+
return value === undefined || value === null ? null : (value as T)
|
|
20
|
+
} catch {
|
|
21
|
+
return null
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
11
25
|
export function register(container: AppContainer) {
|
|
26
|
+
registerIndexDocEnricher(catalogProductScopeKeysEnricher)
|
|
12
27
|
container.register({
|
|
13
28
|
catalogPricingService: asFunction(({ eventBus }: AppCradle) => {
|
|
14
29
|
return new DefaultCatalogPricingService(eventBus ?? null)
|
|
15
30
|
})
|
|
16
31
|
.singleton()
|
|
17
32
|
.proxy(),
|
|
33
|
+
catalogOmnibusService: asFunction((cradle: AppCradle) => {
|
|
34
|
+
return new DefaultCatalogOmnibusService(
|
|
35
|
+
softCradle<ModuleConfigService>(cradle, 'moduleConfigService'),
|
|
36
|
+
softCradle<CacheStrategy>(cradle, 'cache'),
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
.scoped()
|
|
40
|
+
.proxy(),
|
|
18
41
|
CatalogProduct: asValue(CatalogProduct),
|
|
19
42
|
CatalogProductPrice: asValue(CatalogProductPrice),
|
|
20
43
|
CatalogProductVariant: asValue(CatalogProductVariant),
|