@open-mercato/core 0.9.1-develop.7473.1.de5b22888f → 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,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { CrudForm } from "@open-mercato/ui/backend/CrudForm";
|
|
5
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
6
|
+
import { updateCrud } from "@open-mercato/ui/backend/utils/crud";
|
|
7
|
+
import { createCrudFormError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
8
|
+
import { Alert, AlertDescription } from "@open-mercato/ui/primitives/alert";
|
|
9
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@open-mercato/ui/primitives/card";
|
|
10
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
11
|
+
import { STORES_API_PATH } from "./storeAdmin.js";
|
|
12
|
+
import {
|
|
13
|
+
buildStoreSeoInitialValues,
|
|
14
|
+
buildStoreSeoPayload,
|
|
15
|
+
remapStoreSeoFieldErrors,
|
|
16
|
+
STORE_SEO_FIELD_LIMITS,
|
|
17
|
+
storeSeoFormSchema
|
|
18
|
+
} from "./storeSeo.js";
|
|
19
|
+
import { useStoreAccess } from "./useStoreAccess.js";
|
|
20
|
+
function StoreSeoTab({ store, reload }) {
|
|
21
|
+
const t = useT();
|
|
22
|
+
const { canManage } = useStoreAccess();
|
|
23
|
+
const [formKey, setFormKey] = React.useState(0);
|
|
24
|
+
const fields = React.useMemo(
|
|
25
|
+
() => [
|
|
26
|
+
{
|
|
27
|
+
id: "siteName",
|
|
28
|
+
type: "text",
|
|
29
|
+
label: t("ecommerce.backend.store.seo.siteName", "Site name"),
|
|
30
|
+
description: t(
|
|
31
|
+
"ecommerce.backend.store.seo.siteNameHint",
|
|
32
|
+
"The name of your store shown in search results and the browser tab."
|
|
33
|
+
),
|
|
34
|
+
maxLength: STORE_SEO_FIELD_LIMITS.siteName,
|
|
35
|
+
disabled: !canManage
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "defaultMetaDescription",
|
|
39
|
+
type: "textarea",
|
|
40
|
+
label: t("ecommerce.backend.store.seo.defaultMetaDescription", "Default meta description"),
|
|
41
|
+
description: t(
|
|
42
|
+
"ecommerce.backend.store.seo.defaultMetaDescriptionHint",
|
|
43
|
+
"A short description of your store shown in search results when no product description is available."
|
|
44
|
+
),
|
|
45
|
+
maxLength: STORE_SEO_FIELD_LIMITS.defaultMetaDescription,
|
|
46
|
+
disabled: !canManage
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
id: "googleSiteVerification",
|
|
50
|
+
type: "text",
|
|
51
|
+
label: t("ecommerce.backend.store.seo.googleSiteVerification", "Google site verification token"),
|
|
52
|
+
description: t(
|
|
53
|
+
"ecommerce.backend.store.seo.googleSiteVerificationHint",
|
|
54
|
+
"The token provided by Google Search Console to verify site ownership."
|
|
55
|
+
),
|
|
56
|
+
maxLength: STORE_SEO_FIELD_LIMITS.googleSiteVerification,
|
|
57
|
+
disabled: !canManage
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "robotsTxt",
|
|
61
|
+
type: "textarea",
|
|
62
|
+
label: t("ecommerce.backend.store.seo.robotsTxt", "robots.txt"),
|
|
63
|
+
description: t(
|
|
64
|
+
"ecommerce.backend.store.seo.robotsTxtHint",
|
|
65
|
+
"Instructions for search engine crawlers on which parts of your store to index."
|
|
66
|
+
),
|
|
67
|
+
maxLength: STORE_SEO_FIELD_LIMITS.robotsTxt,
|
|
68
|
+
disabled: !canManage
|
|
69
|
+
}
|
|
70
|
+
],
|
|
71
|
+
[canManage, t]
|
|
72
|
+
);
|
|
73
|
+
const initialValues = React.useMemo(() => buildStoreSeoInitialValues(store), [store]);
|
|
74
|
+
const handleSubmit = React.useCallback(
|
|
75
|
+
async (values) => {
|
|
76
|
+
try {
|
|
77
|
+
await updateCrud(STORES_API_PATH, buildStoreSeoPayload(store.id, values), {
|
|
78
|
+
errorMessage: t("ecommerce.backend.store.seo.errors.save", "Failed to save the SEO settings.")
|
|
79
|
+
});
|
|
80
|
+
} catch (error) {
|
|
81
|
+
const failure = error;
|
|
82
|
+
const fieldErrors = remapStoreSeoFieldErrors(failure.fieldErrors);
|
|
83
|
+
if (!fieldErrors) throw error;
|
|
84
|
+
throw createCrudFormError(failure.message, fieldErrors, { status: failure.status, details: failure.details });
|
|
85
|
+
}
|
|
86
|
+
flash(t("ecommerce.backend.store.seo.flash.saved", "SEO settings saved"), "success");
|
|
87
|
+
await reload();
|
|
88
|
+
},
|
|
89
|
+
[reload, store.id, t]
|
|
90
|
+
);
|
|
91
|
+
const resetForm = React.useCallback(() => setFormKey((current) => current + 1), []);
|
|
92
|
+
const handleKeyDown = React.useCallback(
|
|
93
|
+
(event) => {
|
|
94
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
95
|
+
resetForm();
|
|
96
|
+
},
|
|
97
|
+
[resetForm]
|
|
98
|
+
);
|
|
99
|
+
return /* @__PURE__ */ jsx("div", { className: "space-y-6", children: /* @__PURE__ */ jsxs(Card, { children: [
|
|
100
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
101
|
+
/* @__PURE__ */ jsx(CardTitle, { children: t("ecommerce.backend.store.seo.title", "Search engine optimization") }),
|
|
102
|
+
/* @__PURE__ */ jsx(CardDescription, { children: t(
|
|
103
|
+
"ecommerce.backend.store.seo.description",
|
|
104
|
+
"Configure how your store appears in search results and to automated crawlers."
|
|
105
|
+
) })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
108
|
+
canManage ? null : /* @__PURE__ */ jsx(Alert, { status: "information", children: /* @__PURE__ */ jsx(AlertDescription, { children: t(
|
|
109
|
+
"ecommerce.backend.store.seo.readOnly",
|
|
110
|
+
"You can view these SEO settings but not change them. Changing them requires permission to manage stores."
|
|
111
|
+
) }) }),
|
|
112
|
+
/* @__PURE__ */ jsx("div", { onKeyDown: handleKeyDown, children: /* @__PURE__ */ jsx(
|
|
113
|
+
CrudForm,
|
|
114
|
+
{
|
|
115
|
+
schema: storeSeoFormSchema,
|
|
116
|
+
fields,
|
|
117
|
+
initialValues,
|
|
118
|
+
optimisticLockUpdatedAt: store.updatedAt,
|
|
119
|
+
submitLabel: t("ecommerce.backend.store.seo.save", "Save SEO settings"),
|
|
120
|
+
onSubmit: handleSubmit,
|
|
121
|
+
hideFooterActions: !canManage,
|
|
122
|
+
embedded: true
|
|
123
|
+
},
|
|
124
|
+
`${formKey}:${store.updatedAt ?? "new"}`
|
|
125
|
+
) })
|
|
126
|
+
] })
|
|
127
|
+
] }) });
|
|
128
|
+
}
|
|
129
|
+
export {
|
|
130
|
+
StoreSeoTab
|
|
131
|
+
};
|
|
132
|
+
//# sourceMappingURL=StoreSeoTab.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/StoreSeoTab.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { CrudForm, type CrudField } from '@open-mercato/ui/backend/CrudForm'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { updateCrud } from '@open-mercato/ui/backend/utils/crud'\nimport { createCrudFormError, type CrudFormError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { Alert, AlertDescription } from '@open-mercato/ui/primitives/alert'\nimport { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@open-mercato/ui/primitives/card'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { STORES_API_PATH, type StoreAdminRecord } from './storeAdmin'\nimport {\n buildStoreSeoInitialValues,\n buildStoreSeoPayload,\n remapStoreSeoFieldErrors,\n STORE_SEO_FIELD_LIMITS,\n storeSeoFormSchema,\n type StoreSeoFormValues,\n} from './storeSeo'\nimport { useStoreAccess } from './useStoreAccess'\n\ntype StoreSeoTabProps = {\n store: StoreAdminRecord\n reload: () => Promise<void>\n}\n\nexport function StoreSeoTab({ store, reload }: StoreSeoTabProps) {\n const t = useT()\n const { canManage } = useStoreAccess()\n const [formKey, setFormKey] = React.useState(0)\n\n const fields = React.useMemo<CrudField[]>(\n () => [\n {\n id: 'siteName',\n type: 'text',\n label: t('ecommerce.backend.store.seo.siteName', 'Site name'),\n description: t(\n 'ecommerce.backend.store.seo.siteNameHint',\n 'The name of your store shown in search results and the browser tab.',\n ),\n maxLength: STORE_SEO_FIELD_LIMITS.siteName,\n disabled: !canManage,\n },\n {\n id: 'defaultMetaDescription',\n type: 'textarea',\n label: t('ecommerce.backend.store.seo.defaultMetaDescription', 'Default meta description'),\n description: t(\n 'ecommerce.backend.store.seo.defaultMetaDescriptionHint',\n 'A short description of your store shown in search results when no product description is available.',\n ),\n maxLength: STORE_SEO_FIELD_LIMITS.defaultMetaDescription,\n disabled: !canManage,\n },\n {\n id: 'googleSiteVerification',\n type: 'text',\n label: t('ecommerce.backend.store.seo.googleSiteVerification', 'Google site verification token'),\n description: t(\n 'ecommerce.backend.store.seo.googleSiteVerificationHint',\n 'The token provided by Google Search Console to verify site ownership.',\n ),\n maxLength: STORE_SEO_FIELD_LIMITS.googleSiteVerification,\n disabled: !canManage,\n },\n {\n id: 'robotsTxt',\n type: 'textarea',\n label: t('ecommerce.backend.store.seo.robotsTxt', 'robots.txt'),\n description: t(\n 'ecommerce.backend.store.seo.robotsTxtHint',\n 'Instructions for search engine crawlers on which parts of your store to index.',\n ),\n maxLength: STORE_SEO_FIELD_LIMITS.robotsTxt,\n disabled: !canManage,\n },\n ],\n [canManage, t],\n )\n\n const initialValues = React.useMemo(() => buildStoreSeoInitialValues(store), [store])\n\n const handleSubmit = React.useCallback(\n async (values: StoreSeoFormValues) => {\n try {\n await updateCrud(STORES_API_PATH, buildStoreSeoPayload(store.id, values), {\n errorMessage: t('ecommerce.backend.store.seo.errors.save', 'Failed to save the SEO settings.'),\n })\n } catch (error) {\n const failure = error as CrudFormError\n const fieldErrors = remapStoreSeoFieldErrors(failure.fieldErrors)\n if (!fieldErrors) throw error\n throw createCrudFormError(failure.message, fieldErrors, { status: failure.status, details: failure.details })\n }\n flash(t('ecommerce.backend.store.seo.flash.saved', 'SEO settings saved'), 'success')\n await reload()\n },\n [reload, store.id, t],\n )\n\n const resetForm = React.useCallback(() => setFormKey((current) => current + 1), [])\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLDivElement>) => {\n if (event.key !== 'Escape' || event.defaultPrevented) return\n resetForm()\n },\n [resetForm],\n )\n\n return (\n <div className=\"space-y-6\">\n <Card>\n <CardHeader>\n <CardTitle>{t('ecommerce.backend.store.seo.title', 'Search engine optimization')}</CardTitle>\n <CardDescription>\n {t(\n 'ecommerce.backend.store.seo.description',\n 'Configure how your store appears in search results and to automated crawlers.',\n )}\n </CardDescription>\n </CardHeader>\n <CardContent className=\"space-y-4\">\n {canManage ? null : (\n <Alert status=\"information\">\n <AlertDescription>\n {t(\n 'ecommerce.backend.store.seo.readOnly',\n 'You can view these SEO settings but not change them. Changing them requires permission to manage stores.',\n )}\n </AlertDescription>\n </Alert>\n )}\n <div onKeyDown={handleKeyDown}>\n <CrudForm<StoreSeoFormValues>\n key={`${formKey}:${store.updatedAt ?? 'new'}`}\n schema={storeSeoFormSchema}\n fields={fields}\n initialValues={initialValues}\n optimisticLockUpdatedAt={store.updatedAt}\n submitLabel={t('ecommerce.backend.store.seo.save', 'Save SEO settings')}\n onSubmit={handleSubmit}\n hideFooterActions={!canManage}\n embedded\n />\n </div>\n </CardContent>\n </Card>\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
4
|
+
import { StatusBadge } from "@open-mercato/ui/primitives/status-badge";
|
|
5
|
+
import { STORE_STATUS_VARIANTS } from "./storeAdmin.js";
|
|
6
|
+
const STORE_STATUS_LABELS = {
|
|
7
|
+
draft: { key: "ecommerce.backend.stores.status.draft", fallback: "Draft" },
|
|
8
|
+
active: { key: "ecommerce.backend.stores.status.active", fallback: "Active" },
|
|
9
|
+
archived: { key: "ecommerce.backend.stores.status.archived", fallback: "Archived" }
|
|
10
|
+
};
|
|
11
|
+
function StoreStatusBadge({ status }) {
|
|
12
|
+
const t = useT();
|
|
13
|
+
const label = STORE_STATUS_LABELS[status];
|
|
14
|
+
return /* @__PURE__ */ jsx(StatusBadge, { variant: STORE_STATUS_VARIANTS[status] ?? "neutral", dot: true, children: label ? t(label.key, label.fallback) : status });
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
STORE_STATUS_LABELS,
|
|
18
|
+
StoreStatusBadge
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=StoreStatusBadge.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/StoreStatusBadge.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useT } from '@open-mercato/shared/lib/i18n/context'\nimport { StatusBadge } from '@open-mercato/ui/primitives/status-badge'\nimport { STORE_STATUS_VARIANTS, type StoreStatus } from './storeAdmin'\n\nexport const STORE_STATUS_LABELS: Record<StoreStatus, { key: string; fallback: string }> = {\n draft: { key: 'ecommerce.backend.stores.status.draft', fallback: 'Draft' },\n active: { key: 'ecommerce.backend.stores.status.active', fallback: 'Active' },\n archived: { key: 'ecommerce.backend.stores.status.archived', fallback: 'Archived' },\n}\n\nexport function StoreStatusBadge({ status }: { status: StoreStatus }) {\n const t = useT()\n const label = STORE_STATUS_LABELS[status]\n return (\n <StatusBadge variant={STORE_STATUS_VARIANTS[status] ?? 'neutral'} dot>\n {label ? t(label.key, label.fallback) : status}\n </StatusBadge>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAiBI;AAdJ,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B,SAAS,6BAA+C;AAEjD,MAAM,sBAA8E;AAAA,EACzF,OAAO,EAAE,KAAK,yCAAyC,UAAU,QAAQ;AAAA,EACzE,QAAQ,EAAE,KAAK,0CAA0C,UAAU,SAAS;AAAA,EAC5E,UAAU,EAAE,KAAK,4CAA4C,UAAU,WAAW;AACpF;AAEO,SAAS,iBAAiB,EAAE,OAAO,GAA4B;AACpE,QAAM,IAAI,KAAK;AACf,QAAM,QAAQ,oBAAoB,MAAM;AACxC,SACE,oBAAC,eAAY,SAAS,sBAAsB,MAAM,KAAK,WAAW,KAAG,MAClE,kBAAQ,EAAE,MAAM,KAAK,MAAM,QAAQ,IAAI,QAC1C;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createIdsLookupSource,
|
|
3
|
+
lookupLabelWithCode,
|
|
4
|
+
pickLookupString
|
|
5
|
+
} from "@open-mercato/ui/backend/inputs/lookupSources";
|
|
6
|
+
import {
|
|
7
|
+
categoryLookupSource,
|
|
8
|
+
productLookupSource,
|
|
9
|
+
tagLookupSource
|
|
10
|
+
} from "@open-mercato/core/modules/catalog/components/lookupSources";
|
|
11
|
+
const salesChannelLookupSource = createIdsLookupSource("sales-channels", "/api/sales/channels", (item) => {
|
|
12
|
+
const value = pickLookupString(item, "id");
|
|
13
|
+
if (!value) return null;
|
|
14
|
+
return { value, label: lookupLabelWithCode(pickLookupString(item, "name") || value, pickLookupString(item, "code")) };
|
|
15
|
+
});
|
|
16
|
+
const priceKindLookupSource = createIdsLookupSource("price-kinds", "/api/catalog/price-kinds", (item) => {
|
|
17
|
+
const value = pickLookupString(item, "id");
|
|
18
|
+
if (!value) return null;
|
|
19
|
+
return { value, label: lookupLabelWithCode(pickLookupString(item, "title", "name") || value, pickLookupString(item, "code")) };
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
categoryLookupSource,
|
|
23
|
+
priceKindLookupSource,
|
|
24
|
+
productLookupSource,
|
|
25
|
+
salesChannelLookupSource,
|
|
26
|
+
tagLookupSource
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=channelLookups.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/channelLookups.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n createIdsLookupSource,\n lookupLabelWithCode,\n pickLookupString,\n} from '@open-mercato/ui/backend/inputs/lookupSources'\n\nexport type { LookupOption, LookupSource } from '@open-mercato/ui/backend/inputs/lookupSources'\nexport {\n categoryLookupSource,\n productLookupSource,\n tagLookupSource,\n} from '@open-mercato/core/modules/catalog/components/lookupSources'\n\nexport const salesChannelLookupSource = createIdsLookupSource('sales-channels', '/api/sales/channels', (item) => {\n const value = pickLookupString(item, 'id')\n if (!value) return null\n return { value, label: lookupLabelWithCode(pickLookupString(item, 'name') || value, pickLookupString(item, 'code')) }\n})\n\nexport const priceKindLookupSource = createIdsLookupSource('price-kinds', '/api/catalog/price-kinds', (item) => {\n const value = pickLookupString(item, 'id')\n if (!value) return null\n return { value, label: lookupLabelWithCode(pickLookupString(item, 'title', 'name') || value, pickLookupString(item, 'code')) }\n})\n"],
|
|
5
|
+
"mappings": "AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,MAAM,2BAA2B,sBAAsB,kBAAkB,uBAAuB,CAAC,SAAS;AAC/G,QAAM,QAAQ,iBAAiB,MAAM,IAAI;AACzC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,EAAE,OAAO,OAAO,oBAAoB,iBAAiB,MAAM,MAAM,KAAK,OAAO,iBAAiB,MAAM,MAAM,CAAC,EAAE;AACtH,CAAC;AAEM,MAAM,wBAAwB,sBAAsB,eAAe,4BAA4B,CAAC,SAAS;AAC9G,QAAM,QAAQ,iBAAiB,MAAM,IAAI;AACzC,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,EAAE,OAAO,OAAO,oBAAoB,iBAAiB,MAAM,SAAS,MAAM,KAAK,OAAO,iBAAiB,MAAM,MAAM,CAAC,EAAE;AAC/H,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const STORE_STATUSES = ["draft", "active", "archived"];
|
|
2
|
+
const STORES_API_PATH = "ecommerce/stores";
|
|
3
|
+
const STORES_API_URL = `/api/${STORES_API_PATH}`;
|
|
4
|
+
const STORE_LIST_HREF = "/backend/config/ecommerce";
|
|
5
|
+
const STORE_MANAGE_FEATURE = "ecommerce.stores.manage";
|
|
6
|
+
const STORE_VIEW_FEATURE = "ecommerce.stores.view";
|
|
7
|
+
const BRANDING_MANAGE_FEATURE = "ecommerce.branding.manage";
|
|
8
|
+
const DOMAINS_MANAGE_FEATURE = "ecommerce.domains.manage";
|
|
9
|
+
const CHANNELS_MANAGE_FEATURE = "ecommerce.channels.manage";
|
|
10
|
+
const AVAILABILITY_POLICIES_API_PATH = "availability/policies";
|
|
11
|
+
const AVAILABILITY_POLICIES_API_URL = `/api/${AVAILABILITY_POLICIES_API_PATH}`;
|
|
12
|
+
const AVAILABILITY_VIEW_FEATURE = "availability.policies.view";
|
|
13
|
+
const AVAILABILITY_MANAGE_FEATURE = "availability.policies.manage";
|
|
14
|
+
const STORE_STATUS_VARIANTS = {
|
|
15
|
+
draft: "neutral",
|
|
16
|
+
active: "success",
|
|
17
|
+
archived: "warning"
|
|
18
|
+
};
|
|
19
|
+
function formatPrimaryDomain(summary) {
|
|
20
|
+
const domain = summary?.primaryDomain;
|
|
21
|
+
if (!domain) return null;
|
|
22
|
+
return `${domain.hostname}${domain.pathPrefix ?? ""}`;
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
AVAILABILITY_MANAGE_FEATURE,
|
|
26
|
+
AVAILABILITY_POLICIES_API_PATH,
|
|
27
|
+
AVAILABILITY_POLICIES_API_URL,
|
|
28
|
+
AVAILABILITY_VIEW_FEATURE,
|
|
29
|
+
BRANDING_MANAGE_FEATURE,
|
|
30
|
+
CHANNELS_MANAGE_FEATURE,
|
|
31
|
+
DOMAINS_MANAGE_FEATURE,
|
|
32
|
+
STORES_API_PATH,
|
|
33
|
+
STORES_API_URL,
|
|
34
|
+
STORE_LIST_HREF,
|
|
35
|
+
STORE_MANAGE_FEATURE,
|
|
36
|
+
STORE_STATUSES,
|
|
37
|
+
STORE_STATUS_VARIANTS,
|
|
38
|
+
STORE_VIEW_FEATURE,
|
|
39
|
+
formatPrimaryDomain
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=storeAdmin.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/storeAdmin.ts"],
|
|
4
|
+
"sourcesContent": ["import type { StatusBadgeVariant } from '@open-mercato/ui/primitives/status-badge'\nimport type { StoreListBindingSummary } from '../data/enrichers'\n\nexport const STORE_STATUSES = ['draft', 'active', 'archived'] as const\n\nexport type StoreStatus = (typeof STORE_STATUSES)[number]\n\nexport type StoreAdminRecord = {\n id: string\n organizationId?: string | null\n tenantId?: string | null\n code: string\n name: string\n slug: string\n status: StoreStatus\n defaultLocale: string\n supportedLocales: string[]\n defaultCurrencyCode: string\n isPrimary: boolean\n settings?: Record<string, unknown> | null\n createdAt: string | null\n updatedAt: string | null\n _ecommerce?: StoreListBindingSummary\n}\n\nexport type StoreListResponse = {\n items: StoreAdminRecord[]\n total: number\n totalPages: number\n totalIsCapped?: boolean\n}\n\nexport const STORES_API_PATH = 'ecommerce/stores'\nexport const STORES_API_URL = `/api/${STORES_API_PATH}`\nexport const STORE_LIST_HREF = '/backend/config/ecommerce'\nexport const STORE_MANAGE_FEATURE = 'ecommerce.stores.manage'\nexport const STORE_VIEW_FEATURE = 'ecommerce.stores.view'\nexport const BRANDING_MANAGE_FEATURE = 'ecommerce.branding.manage'\nexport const DOMAINS_MANAGE_FEATURE = 'ecommerce.domains.manage'\nexport const CHANNELS_MANAGE_FEATURE = 'ecommerce.channels.manage'\nexport const AVAILABILITY_POLICIES_API_PATH = 'availability/policies'\nexport const AVAILABILITY_POLICIES_API_URL = `/api/${AVAILABILITY_POLICIES_API_PATH}`\nexport const AVAILABILITY_VIEW_FEATURE = 'availability.policies.view'\nexport const AVAILABILITY_MANAGE_FEATURE = 'availability.policies.manage'\n\nexport const STORE_STATUS_VARIANTS: Record<StoreStatus, StatusBadgeVariant> = {\n draft: 'neutral',\n active: 'success',\n archived: 'warning',\n}\n\nexport function formatPrimaryDomain(summary: StoreListBindingSummary | undefined): string | null {\n const domain = summary?.primaryDomain\n if (!domain) return null\n return `${domain.hostname}${domain.pathPrefix ?? ''}`\n}\n"],
|
|
5
|
+
"mappings": "AAGO,MAAM,iBAAiB,CAAC,SAAS,UAAU,UAAU;AA6BrD,MAAM,kBAAkB;AACxB,MAAM,iBAAiB,QAAQ,eAAe;AAC9C,MAAM,kBAAkB;AACxB,MAAM,uBAAuB;AAC7B,MAAM,qBAAqB;AAC3B,MAAM,0BAA0B;AAChC,MAAM,yBAAyB;AAC/B,MAAM,0BAA0B;AAChC,MAAM,iCAAiC;AACvC,MAAM,gCAAgC,QAAQ,8BAA8B;AAC5E,MAAM,4BAA4B;AAClC,MAAM,8BAA8B;AAEpC,MAAM,wBAAiE;AAAA,EAC5E,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,UAAU;AACZ;AAEO,SAAS,oBAAoB,SAA6D;AAC/F,QAAM,SAAS,SAAS;AACxB,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,GAAG,OAAO,QAAQ,GAAG,OAAO,cAAc,EAAE;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ecommerceStoreBrandingSchema, isSafeAssetUrl } from "../data/validators.js";
|
|
3
|
+
import {
|
|
4
|
+
ECOMMERCE_BRANDING_COLOR_KEYS,
|
|
5
|
+
ECOMMERCE_BRANDING_DEFAULTS,
|
|
6
|
+
ECOMMERCE_BRANDING_FONT_KEYS,
|
|
7
|
+
findEcommerceBrandingFont,
|
|
8
|
+
isValidBorderRadius,
|
|
9
|
+
normalizeBrandingColor,
|
|
10
|
+
renderBrandingRootRule
|
|
11
|
+
} from "../lib/brandingStyles.js";
|
|
12
|
+
const BRANDING_COLOR_KEYS = ECOMMERCE_BRANDING_COLOR_KEYS;
|
|
13
|
+
const BRANDING_FONT_KEYS = ECOMMERCE_BRANDING_FONT_KEYS;
|
|
14
|
+
const BRANDING_ASSET_KEYS = ["logoUrl", "faviconUrl"];
|
|
15
|
+
const BRANDING_FONT_INHERIT = "inherit";
|
|
16
|
+
const DEFAULT_BASE_FONT_ID = "inter";
|
|
17
|
+
const RADIUS_SLIDER_MIN = 0;
|
|
18
|
+
const RADIUS_SLIDER_MAX = 5;
|
|
19
|
+
const RADIUS_SLIDER_STEP = 0.125;
|
|
20
|
+
const PX_PER_REM = 16;
|
|
21
|
+
const STORE_BRANDING_API_PATH = (storeId) => `/api/ecommerce/stores/${encodeURIComponent(storeId)}/branding`;
|
|
22
|
+
const ALL_KEYS = [
|
|
23
|
+
...BRANDING_COLOR_KEYS,
|
|
24
|
+
"borderRadius",
|
|
25
|
+
...BRANDING_FONT_KEYS,
|
|
26
|
+
...BRANDING_ASSET_KEYS
|
|
27
|
+
];
|
|
28
|
+
function readStoredBranding(store) {
|
|
29
|
+
const branding = store.settings?.branding;
|
|
30
|
+
return typeof branding === "object" && branding !== null && !Array.isArray(branding) ? branding : {};
|
|
31
|
+
}
|
|
32
|
+
function readStoredString(stored, key) {
|
|
33
|
+
const value = stored[key];
|
|
34
|
+
return typeof value === "string" ? value : "";
|
|
35
|
+
}
|
|
36
|
+
function buildStoreBrandingInitialValues(store) {
|
|
37
|
+
const stored = readStoredBranding(store);
|
|
38
|
+
const values = {};
|
|
39
|
+
for (const key of BRANDING_COLOR_KEYS) {
|
|
40
|
+
values[key] = readStoredString(stored, key) || ECOMMERCE_BRANDING_DEFAULTS[key];
|
|
41
|
+
}
|
|
42
|
+
values.borderRadius = readStoredString(stored, "borderRadius") || ECOMMERCE_BRANDING_DEFAULTS.borderRadius;
|
|
43
|
+
values.fontFamilyBase = readStoredString(stored, "fontFamilyBase") || DEFAULT_BASE_FONT_ID;
|
|
44
|
+
values.fontFamilyHeading = readStoredString(stored, "fontFamilyHeading") || BRANDING_FONT_INHERIT;
|
|
45
|
+
values.logoUrl = readStoredString(stored, "logoUrl");
|
|
46
|
+
values.faviconUrl = readStoredString(stored, "faviconUrl");
|
|
47
|
+
return values;
|
|
48
|
+
}
|
|
49
|
+
function readFormString(values, key) {
|
|
50
|
+
const value = values[key];
|
|
51
|
+
return typeof value === "string" ? value.trim() : "";
|
|
52
|
+
}
|
|
53
|
+
function defaultValueFor(key) {
|
|
54
|
+
if (key === "fontFamilyBase") return DEFAULT_BASE_FONT_ID;
|
|
55
|
+
if (key === "fontFamilyHeading") return BRANDING_FONT_INHERIT;
|
|
56
|
+
if (key === "logoUrl" || key === "faviconUrl") return null;
|
|
57
|
+
return ECOMMERCE_BRANDING_DEFAULTS[key];
|
|
58
|
+
}
|
|
59
|
+
function buildStoreBrandingInput(values) {
|
|
60
|
+
const input = {};
|
|
61
|
+
for (const key of ALL_KEYS) {
|
|
62
|
+
const value = readFormString(values, key);
|
|
63
|
+
if (value === "" || value === BRANDING_FONT_INHERIT) continue;
|
|
64
|
+
input[key] = value;
|
|
65
|
+
}
|
|
66
|
+
return input;
|
|
67
|
+
}
|
|
68
|
+
function buildStoreBrandingPayload(values, store) {
|
|
69
|
+
const stored = readStoredBranding(store);
|
|
70
|
+
const input = buildStoreBrandingInput(values);
|
|
71
|
+
const payload = {};
|
|
72
|
+
for (const key of ALL_KEYS) {
|
|
73
|
+
const value = input[key];
|
|
74
|
+
if (value === void 0) continue;
|
|
75
|
+
const wasStored = readStoredString(stored, key) !== "";
|
|
76
|
+
if (!wasStored && value === defaultValueFor(key)) continue;
|
|
77
|
+
payload[key] = value;
|
|
78
|
+
}
|
|
79
|
+
return payload;
|
|
80
|
+
}
|
|
81
|
+
const brandingFormShape = {
|
|
82
|
+
primaryColor: z.string(),
|
|
83
|
+
primaryForeground: z.string(),
|
|
84
|
+
accentColor: z.string(),
|
|
85
|
+
accentForeground: z.string(),
|
|
86
|
+
backgroundColor: z.string(),
|
|
87
|
+
foregroundColor: z.string(),
|
|
88
|
+
borderRadius: z.string(),
|
|
89
|
+
fontFamilyBase: z.string(),
|
|
90
|
+
fontFamilyHeading: z.string(),
|
|
91
|
+
logoUrl: z.string(),
|
|
92
|
+
faviconUrl: z.string()
|
|
93
|
+
};
|
|
94
|
+
const storeBrandingFormSchema = z.object(brandingFormShape).superRefine((values, context) => {
|
|
95
|
+
const result = ecommerceStoreBrandingSchema.safeParse(buildStoreBrandingInput(values));
|
|
96
|
+
if (result.success) return;
|
|
97
|
+
for (const issue of result.error.issues) {
|
|
98
|
+
context.addIssue({ code: "custom", path: issue.path, message: issue.message });
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
function parseRadiusRem(value) {
|
|
102
|
+
const trimmed = value.trim();
|
|
103
|
+
if (trimmed === "0") return 0;
|
|
104
|
+
const match = /^(\d+(?:\.\d+)?|\.\d+)(rem|px)$/.exec(trimmed);
|
|
105
|
+
if (!match) return parseRadiusRem(ECOMMERCE_BRANDING_DEFAULTS.borderRadius);
|
|
106
|
+
const amount = Number(match[1]);
|
|
107
|
+
const rem = match[2] === "px" ? amount / PX_PER_REM : amount;
|
|
108
|
+
return Math.min(RADIUS_SLIDER_MAX, Math.max(RADIUS_SLIDER_MIN, rem));
|
|
109
|
+
}
|
|
110
|
+
function formatRadiusRem(rem) {
|
|
111
|
+
if (rem <= 0) return "0";
|
|
112
|
+
return `${Number(rem.toFixed(3))}rem`;
|
|
113
|
+
}
|
|
114
|
+
function sanitizePreviewBranding(values) {
|
|
115
|
+
const input = buildStoreBrandingInput(values);
|
|
116
|
+
const sanitized = {};
|
|
117
|
+
for (const key of BRANDING_COLOR_KEYS) {
|
|
118
|
+
const raw = input[key];
|
|
119
|
+
const normalized = raw === void 0 ? null : normalizeBrandingColor(raw);
|
|
120
|
+
if (normalized !== null) sanitized[key] = normalized;
|
|
121
|
+
}
|
|
122
|
+
const radius = input.borderRadius;
|
|
123
|
+
if (radius !== void 0 && isValidBorderRadius(radius)) sanitized.borderRadius = radius;
|
|
124
|
+
for (const key of BRANDING_FONT_KEYS) {
|
|
125
|
+
const raw = input[key];
|
|
126
|
+
if (raw !== void 0 && findEcommerceBrandingFont(raw)) sanitized[key] = raw;
|
|
127
|
+
}
|
|
128
|
+
const logo = input.logoUrl;
|
|
129
|
+
if (logo !== void 0 && isSafeAssetUrl(logo)) sanitized.logoUrl = logo;
|
|
130
|
+
return sanitized;
|
|
131
|
+
}
|
|
132
|
+
const HTML_ESCAPES = {
|
|
133
|
+
"&": "&",
|
|
134
|
+
"<": "<",
|
|
135
|
+
">": ">",
|
|
136
|
+
'"': """,
|
|
137
|
+
"'": "'"
|
|
138
|
+
};
|
|
139
|
+
function escapeHtml(value) {
|
|
140
|
+
return value.replace(/[&<>"']/g, (character) => HTML_ESCAPES[character] ?? character);
|
|
141
|
+
}
|
|
142
|
+
const PREVIEW_CONTENT_SECURITY_POLICY = "default-src 'none'; style-src 'unsafe-inline'; img-src http: https:";
|
|
143
|
+
const PREVIEW_STATIC_CSS = [
|
|
144
|
+
"*{box-sizing:border-box}",
|
|
145
|
+
"body{margin:0;background:var(--background);color:var(--foreground);font-family:var(--font-base);font-size:14px;line-height:1.5}",
|
|
146
|
+
"h1,.brand{font-family:var(--font-heading)}",
|
|
147
|
+
".bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 20px;border-bottom:1px solid color-mix(in oklch,var(--foreground) 15%,transparent)}",
|
|
148
|
+
".brand{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:700}",
|
|
149
|
+
".brand img{max-width:120px;max-height:28px}",
|
|
150
|
+
"nav{display:flex;gap:16px;opacity:.7}",
|
|
151
|
+
".hero{padding:28px 20px;background:var(--accent);color:var(--accent-foreground)}",
|
|
152
|
+
".hero h1{margin:0 0 8px;font-size:24px;line-height:1.2}",
|
|
153
|
+
".hero p{margin:0 0 16px;max-width:36ch}",
|
|
154
|
+
".btn{display:inline-block;padding:8px 16px;border-radius:var(--radius);background:var(--primary);color:var(--primary-foreground);font-weight:600}",
|
|
155
|
+
".grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:20px}",
|
|
156
|
+
".card{overflow:hidden;border:1px solid color-mix(in oklch,var(--foreground) 15%,transparent);border-radius:var(--radius)}",
|
|
157
|
+
".thumb{height:56px;background:color-mix(in oklch,var(--primary) 20%,var(--background))}",
|
|
158
|
+
".card-body{padding:10px}",
|
|
159
|
+
".price{font-weight:600}"
|
|
160
|
+
].join("");
|
|
161
|
+
function buildBrandingPreviewDocument(values, labels) {
|
|
162
|
+
const branding = sanitizePreviewBranding(values);
|
|
163
|
+
const rootRule = renderBrandingRootRule(branding);
|
|
164
|
+
const logo = branding.logoUrl ? `<img src="${escapeHtml(branding.logoUrl)}" alt="">` : "";
|
|
165
|
+
const card = `<div class="card"><div class="thumb"></div><div class="card-body"><div>${escapeHtml(labels.productName)}</div><div class="price">${escapeHtml(labels.productPrice)}</div></div></div>`;
|
|
166
|
+
return [
|
|
167
|
+
'<!doctype html><html><head><meta charset="utf-8">',
|
|
168
|
+
`<meta http-equiv="Content-Security-Policy" content="${PREVIEW_CONTENT_SECURITY_POLICY}">`,
|
|
169
|
+
`<style>${rootRule}</style><style>${PREVIEW_STATIC_CSS}</style></head><body>`,
|
|
170
|
+
`<header class="bar"><div class="brand">${logo}<span>${escapeHtml(labels.storeName)}</span></div>`,
|
|
171
|
+
`<nav><span>${escapeHtml(labels.navShop)}</span><span>${escapeHtml(labels.navCategories)}</span><span>${escapeHtml(labels.navCart)}</span></nav></header>`,
|
|
172
|
+
`<section class="hero"><h1>${escapeHtml(labels.heroTitle)}</h1><p>${escapeHtml(labels.heroText)}</p><span class="btn">${escapeHtml(labels.heroButton)}</span></section>`,
|
|
173
|
+
`<section class="grid">${card}${card}${card}</section>`,
|
|
174
|
+
"</body></html>"
|
|
175
|
+
].join("");
|
|
176
|
+
}
|
|
177
|
+
export {
|
|
178
|
+
BRANDING_ASSET_KEYS,
|
|
179
|
+
BRANDING_COLOR_KEYS,
|
|
180
|
+
BRANDING_FONT_INHERIT,
|
|
181
|
+
BRANDING_FONT_KEYS,
|
|
182
|
+
DEFAULT_BASE_FONT_ID,
|
|
183
|
+
RADIUS_SLIDER_MAX,
|
|
184
|
+
RADIUS_SLIDER_MIN,
|
|
185
|
+
RADIUS_SLIDER_STEP,
|
|
186
|
+
STORE_BRANDING_API_PATH,
|
|
187
|
+
buildBrandingPreviewDocument,
|
|
188
|
+
buildStoreBrandingInitialValues,
|
|
189
|
+
buildStoreBrandingInput,
|
|
190
|
+
buildStoreBrandingPayload,
|
|
191
|
+
escapeHtml,
|
|
192
|
+
formatRadiusRem,
|
|
193
|
+
parseRadiusRem,
|
|
194
|
+
sanitizePreviewBranding,
|
|
195
|
+
storeBrandingFormSchema
|
|
196
|
+
};
|
|
197
|
+
//# sourceMappingURL=storeBrandingForm.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/storeBrandingForm.ts"],
|
|
4
|
+
"sourcesContent": ["import { z } from 'zod'\nimport { ecommerceStoreBrandingSchema, isSafeAssetUrl } from '../data/validators'\nimport {\n ECOMMERCE_BRANDING_COLOR_KEYS,\n ECOMMERCE_BRANDING_DEFAULTS,\n ECOMMERCE_BRANDING_FONT_KEYS,\n findEcommerceBrandingFont,\n isValidBorderRadius,\n normalizeBrandingColor,\n renderBrandingRootRule,\n type EcommerceBrandingColorKey,\n type EcommerceBrandingFontKey,\n} from '../lib/brandingStyles'\nimport type { StoreAdminRecord } from './storeAdmin'\n\nexport const BRANDING_COLOR_KEYS = ECOMMERCE_BRANDING_COLOR_KEYS\nexport const BRANDING_FONT_KEYS = ECOMMERCE_BRANDING_FONT_KEYS\nexport const BRANDING_ASSET_KEYS = ['logoUrl', 'faviconUrl'] as const\n\nexport type BrandingAssetKey = (typeof BRANDING_ASSET_KEYS)[number]\nexport type StoreBrandingFormKey =\n | EcommerceBrandingColorKey\n | EcommerceBrandingFontKey\n | BrandingAssetKey\n | 'borderRadius'\n\nexport type StoreBrandingFormValues = Record<StoreBrandingFormKey, string>\n\nexport type StoreBrandingPayload = Partial<Record<StoreBrandingFormKey, string>>\n\nexport const BRANDING_FONT_INHERIT = 'inherit'\nexport const DEFAULT_BASE_FONT_ID = 'inter'\nexport const RADIUS_SLIDER_MIN = 0\nexport const RADIUS_SLIDER_MAX = 5\nexport const RADIUS_SLIDER_STEP = 0.125\nconst PX_PER_REM = 16\n\nexport const STORE_BRANDING_API_PATH = (storeId: string) => `/api/ecommerce/stores/${encodeURIComponent(storeId)}/branding`\n\nconst ALL_KEYS: readonly StoreBrandingFormKey[] = [\n ...BRANDING_COLOR_KEYS,\n 'borderRadius',\n ...BRANDING_FONT_KEYS,\n ...BRANDING_ASSET_KEYS,\n]\n\nfunction readStoredBranding(store: Pick<StoreAdminRecord, 'settings'>): Record<string, unknown> {\n const branding = store.settings?.branding\n return typeof branding === 'object' && branding !== null && !Array.isArray(branding)\n ? (branding as Record<string, unknown>)\n : {}\n}\n\nfunction readStoredString(stored: Record<string, unknown>, key: string): string {\n const value = stored[key]\n return typeof value === 'string' ? value : ''\n}\n\nexport function buildStoreBrandingInitialValues(store: Pick<StoreAdminRecord, 'settings'>): StoreBrandingFormValues {\n const stored = readStoredBranding(store)\n const values = {} as StoreBrandingFormValues\n for (const key of BRANDING_COLOR_KEYS) {\n values[key] = readStoredString(stored, key) || ECOMMERCE_BRANDING_DEFAULTS[key]\n }\n values.borderRadius = readStoredString(stored, 'borderRadius') || ECOMMERCE_BRANDING_DEFAULTS.borderRadius\n values.fontFamilyBase = readStoredString(stored, 'fontFamilyBase') || DEFAULT_BASE_FONT_ID\n values.fontFamilyHeading = readStoredString(stored, 'fontFamilyHeading') || BRANDING_FONT_INHERIT\n values.logoUrl = readStoredString(stored, 'logoUrl')\n values.faviconUrl = readStoredString(stored, 'faviconUrl')\n return values\n}\n\nfunction readFormString(values: Record<string, unknown>, key: string): string {\n const value = values[key]\n return typeof value === 'string' ? value.trim() : ''\n}\n\nfunction defaultValueFor(key: StoreBrandingFormKey): string | null {\n if (key === 'fontFamilyBase') return DEFAULT_BASE_FONT_ID\n if (key === 'fontFamilyHeading') return BRANDING_FONT_INHERIT\n if (key === 'logoUrl' || key === 'faviconUrl') return null\n return ECOMMERCE_BRANDING_DEFAULTS[key]\n}\n\nexport function buildStoreBrandingInput(values: Record<string, unknown>): StoreBrandingPayload {\n const input: StoreBrandingPayload = {}\n for (const key of ALL_KEYS) {\n const value = readFormString(values, key)\n if (value === '' || value === BRANDING_FONT_INHERIT) continue\n input[key] = value\n }\n return input\n}\n\nexport function buildStoreBrandingPayload(\n values: Record<string, unknown>,\n store: Pick<StoreAdminRecord, 'settings'>,\n): StoreBrandingPayload {\n const stored = readStoredBranding(store)\n const input = buildStoreBrandingInput(values)\n const payload: StoreBrandingPayload = {}\n for (const key of ALL_KEYS) {\n const value = input[key]\n if (value === undefined) continue\n const wasStored = readStoredString(stored, key) !== ''\n if (!wasStored && value === defaultValueFor(key)) continue\n payload[key] = value\n }\n return payload\n}\n\nconst brandingFormShape = {\n primaryColor: z.string(),\n primaryForeground: z.string(),\n accentColor: z.string(),\n accentForeground: z.string(),\n backgroundColor: z.string(),\n foregroundColor: z.string(),\n borderRadius: z.string(),\n fontFamilyBase: z.string(),\n fontFamilyHeading: z.string(),\n logoUrl: z.string(),\n faviconUrl: z.string(),\n} satisfies Record<StoreBrandingFormKey, z.ZodString>\n\nexport const storeBrandingFormSchema = z.object(brandingFormShape).superRefine((values, context) => {\n const result = ecommerceStoreBrandingSchema.safeParse(buildStoreBrandingInput(values))\n if (result.success) return\n for (const issue of result.error.issues) {\n context.addIssue({ code: 'custom', path: issue.path, message: issue.message })\n }\n})\n\nexport function parseRadiusRem(value: string): number {\n const trimmed = value.trim()\n if (trimmed === '0') return 0\n const match = /^(\\d+(?:\\.\\d+)?|\\.\\d+)(rem|px)$/.exec(trimmed)\n if (!match) return parseRadiusRem(ECOMMERCE_BRANDING_DEFAULTS.borderRadius)\n const amount = Number(match[1])\n const rem = match[2] === 'px' ? amount / PX_PER_REM : amount\n return Math.min(RADIUS_SLIDER_MAX, Math.max(RADIUS_SLIDER_MIN, rem))\n}\n\nexport function formatRadiusRem(rem: number): string {\n if (rem <= 0) return '0'\n return `${Number(rem.toFixed(3))}rem`\n}\n\nexport type SanitizedPreviewBranding = Partial<Record<StoreBrandingFormKey, string>>\n\nexport function sanitizePreviewBranding(values: Record<string, unknown>): SanitizedPreviewBranding {\n const input = buildStoreBrandingInput(values)\n const sanitized: SanitizedPreviewBranding = {}\n for (const key of BRANDING_COLOR_KEYS) {\n const raw = input[key]\n const normalized = raw === undefined ? null : normalizeBrandingColor(raw)\n if (normalized !== null) sanitized[key] = normalized\n }\n const radius = input.borderRadius\n if (radius !== undefined && isValidBorderRadius(radius)) sanitized.borderRadius = radius\n for (const key of BRANDING_FONT_KEYS) {\n const raw = input[key]\n if (raw !== undefined && findEcommerceBrandingFont(raw)) sanitized[key] = raw\n }\n const logo = input.logoUrl\n if (logo !== undefined && isSafeAssetUrl(logo)) sanitized.logoUrl = logo\n return sanitized\n}\n\nexport type BrandingPreviewLabels = {\n storeName: string\n navShop: string\n navCategories: string\n navCart: string\n heroTitle: string\n heroText: string\n heroButton: string\n productName: string\n productPrice: string\n}\n\nconst HTML_ESCAPES: Readonly<Record<string, string>> = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n}\n\nexport function escapeHtml(value: string): string {\n return value.replace(/[&<>\"']/g, (character) => HTML_ESCAPES[character] ?? character)\n}\n\nconst PREVIEW_CONTENT_SECURITY_POLICY = \"default-src 'none'; style-src 'unsafe-inline'; img-src http: https:\"\n\nconst PREVIEW_STATIC_CSS = [\n '*{box-sizing:border-box}',\n 'body{margin:0;background:var(--background);color:var(--foreground);font-family:var(--font-base);font-size:14px;line-height:1.5}',\n 'h1,.brand{font-family:var(--font-heading)}',\n '.bar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 20px;border-bottom:1px solid color-mix(in oklch,var(--foreground) 15%,transparent)}',\n '.brand{display:flex;align-items:center;gap:8px;font-size:16px;font-weight:700}',\n '.brand img{max-width:120px;max-height:28px}',\n 'nav{display:flex;gap:16px;opacity:.7}',\n '.hero{padding:28px 20px;background:var(--accent);color:var(--accent-foreground)}',\n '.hero h1{margin:0 0 8px;font-size:24px;line-height:1.2}',\n '.hero p{margin:0 0 16px;max-width:36ch}',\n '.btn{display:inline-block;padding:8px 16px;border-radius:var(--radius);background:var(--primary);color:var(--primary-foreground);font-weight:600}',\n '.grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;padding:20px}',\n '.card{overflow:hidden;border:1px solid color-mix(in oklch,var(--foreground) 15%,transparent);border-radius:var(--radius)}',\n '.thumb{height:56px;background:color-mix(in oklch,var(--primary) 20%,var(--background))}',\n '.card-body{padding:10px}',\n '.price{font-weight:600}',\n].join('')\n\nexport function buildBrandingPreviewDocument(values: Record<string, unknown>, labels: BrandingPreviewLabels): string {\n const branding = sanitizePreviewBranding(values)\n const rootRule = renderBrandingRootRule(branding)\n const logo = branding.logoUrl ? `<img src=\"${escapeHtml(branding.logoUrl)}\" alt=\"\">` : ''\n const card = `<div class=\"card\"><div class=\"thumb\"></div><div class=\"card-body\"><div>${escapeHtml(labels.productName)}</div><div class=\"price\">${escapeHtml(labels.productPrice)}</div></div></div>`\n return [\n '<!doctype html><html><head><meta charset=\"utf-8\">',\n `<meta http-equiv=\"Content-Security-Policy\" content=\"${PREVIEW_CONTENT_SECURITY_POLICY}\">`,\n `<style>${rootRule}</style><style>${PREVIEW_STATIC_CSS}</style></head><body>`,\n `<header class=\"bar\"><div class=\"brand\">${logo}<span>${escapeHtml(labels.storeName)}</span></div>`,\n `<nav><span>${escapeHtml(labels.navShop)}</span><span>${escapeHtml(labels.navCategories)}</span><span>${escapeHtml(labels.navCart)}</span></nav></header>`,\n `<section class=\"hero\"><h1>${escapeHtml(labels.heroTitle)}</h1><p>${escapeHtml(labels.heroText)}</p><span class=\"btn\">${escapeHtml(labels.heroButton)}</span></section>`,\n `<section class=\"grid\">${card}${card}${card}</section>`,\n '</body></html>',\n ].join('')\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|