@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,167 @@
|
|
|
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 { Alert, AlertDescription } from "@open-mercato/ui/primitives/alert";
|
|
8
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@open-mercato/ui/primitives/card";
|
|
9
|
+
import { useT } from "@open-mercato/shared/lib/i18n/context";
|
|
10
|
+
import { STORE_STATUS_LABELS } from "./StoreStatusBadge.js";
|
|
11
|
+
import { StoreAvailabilityDefaultsSection } from "./StoreAvailabilityDefaultsSection.js";
|
|
12
|
+
import { STORES_API_PATH } from "./storeAdmin.js";
|
|
13
|
+
import {
|
|
14
|
+
buildStoreGeneralInitialValues,
|
|
15
|
+
buildStoreGeneralPayload,
|
|
16
|
+
storeGeneralFormSchema
|
|
17
|
+
} from "./storeGeneral.js";
|
|
18
|
+
import { useStoreAccess } from "./useStoreAccess.js";
|
|
19
|
+
function selectableStatuses(current) {
|
|
20
|
+
return current === "archived" ? ["archived"] : ["draft", "active"];
|
|
21
|
+
}
|
|
22
|
+
function StoreGeneralTab({ store, reload }) {
|
|
23
|
+
const t = useT();
|
|
24
|
+
const { canManage } = useStoreAccess();
|
|
25
|
+
const [formKey, setFormKey] = React.useState(0);
|
|
26
|
+
const fields = React.useMemo(
|
|
27
|
+
() => [
|
|
28
|
+
{
|
|
29
|
+
id: "name",
|
|
30
|
+
type: "text",
|
|
31
|
+
label: t("ecommerce.backend.stores.form.name", "Name"),
|
|
32
|
+
required: true,
|
|
33
|
+
maxLength: 200,
|
|
34
|
+
disabled: !canManage
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "code",
|
|
38
|
+
type: "text",
|
|
39
|
+
label: t("ecommerce.backend.stores.form.code", "Code"),
|
|
40
|
+
description: t(
|
|
41
|
+
"ecommerce.backend.stores.form.codeHint",
|
|
42
|
+
"Internal identifier, unique in the workspace. Lowercase letters, digits, dashes and underscores."
|
|
43
|
+
),
|
|
44
|
+
required: true,
|
|
45
|
+
maxLength: 80,
|
|
46
|
+
layout: "half",
|
|
47
|
+
disabled: !canManage
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "slug",
|
|
51
|
+
type: "text",
|
|
52
|
+
label: t("ecommerce.backend.stores.form.slug", "Slug"),
|
|
53
|
+
description: t(
|
|
54
|
+
"ecommerce.backend.stores.form.slugHint",
|
|
55
|
+
"Short name used in store addresses, unique in the workspace. Lowercase letters, digits and dashes."
|
|
56
|
+
),
|
|
57
|
+
required: true,
|
|
58
|
+
maxLength: 120,
|
|
59
|
+
layout: "half",
|
|
60
|
+
disabled: !canManage
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: "status",
|
|
64
|
+
type: "select",
|
|
65
|
+
label: t("ecommerce.backend.store.general.status", "Status"),
|
|
66
|
+
description: store.status === "archived" ? t("ecommerce.backend.store.general.statusArchivedHint", "An archived store cannot be unarchived.") : t(
|
|
67
|
+
"ecommerce.backend.store.general.statusHint",
|
|
68
|
+
"A draft store does not serve its storefront. Archive a store from the store list."
|
|
69
|
+
),
|
|
70
|
+
options: selectableStatuses(store.status).map((value) => ({
|
|
71
|
+
value,
|
|
72
|
+
label: t(STORE_STATUS_LABELS[value].key, STORE_STATUS_LABELS[value].fallback)
|
|
73
|
+
})),
|
|
74
|
+
required: true,
|
|
75
|
+
layout: "half",
|
|
76
|
+
disabled: !canManage || store.status === "archived"
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: "defaultCurrencyCode",
|
|
80
|
+
type: "text",
|
|
81
|
+
label: t("ecommerce.backend.stores.form.currency", "Currency"),
|
|
82
|
+
description: t("ecommerce.backend.stores.form.currencyHint", "Three-letter ISO code, for example EUR."),
|
|
83
|
+
placeholder: "EUR",
|
|
84
|
+
required: true,
|
|
85
|
+
maxLength: 3,
|
|
86
|
+
layout: "half",
|
|
87
|
+
disabled: !canManage
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "defaultLocale",
|
|
91
|
+
type: "text",
|
|
92
|
+
label: t("ecommerce.backend.stores.form.defaultLocale", "Default language"),
|
|
93
|
+
description: t("ecommerce.backend.stores.form.defaultLocaleHint", "A language code such as en or pl-PL."),
|
|
94
|
+
required: true,
|
|
95
|
+
layout: "half",
|
|
96
|
+
disabled: !canManage
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
id: "supportedLocales",
|
|
100
|
+
type: "tags",
|
|
101
|
+
label: t("ecommerce.backend.stores.form.supportedLocales", "Supported languages"),
|
|
102
|
+
description: t(
|
|
103
|
+
"ecommerce.backend.stores.form.supportedLocalesHint",
|
|
104
|
+
"Languages the store can be shown in. Must include the default language."
|
|
105
|
+
),
|
|
106
|
+
required: true,
|
|
107
|
+
disabled: !canManage
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
[canManage, store.status, t]
|
|
111
|
+
);
|
|
112
|
+
const initialValues = React.useMemo(() => buildStoreGeneralInitialValues(store), [store]);
|
|
113
|
+
const handleSubmit = React.useCallback(
|
|
114
|
+
async (values) => {
|
|
115
|
+
await updateCrud(STORES_API_PATH, buildStoreGeneralPayload(store.id, values), {
|
|
116
|
+
errorMessage: t("ecommerce.backend.store.general.errors.save", "Failed to save the store.")
|
|
117
|
+
});
|
|
118
|
+
flash(t("ecommerce.backend.store.general.flash.saved", "Store saved"), "success");
|
|
119
|
+
await reload();
|
|
120
|
+
},
|
|
121
|
+
[reload, store.id, t]
|
|
122
|
+
);
|
|
123
|
+
const resetForm = React.useCallback(() => setFormKey((current) => current + 1), []);
|
|
124
|
+
const handleKeyDown = React.useCallback(
|
|
125
|
+
(event) => {
|
|
126
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
127
|
+
resetForm();
|
|
128
|
+
},
|
|
129
|
+
[resetForm]
|
|
130
|
+
);
|
|
131
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
132
|
+
/* @__PURE__ */ jsxs(Card, { children: [
|
|
133
|
+
/* @__PURE__ */ jsxs(CardHeader, { children: [
|
|
134
|
+
/* @__PURE__ */ jsx(CardTitle, { children: t("ecommerce.backend.store.general.title", "Identity and localization") }),
|
|
135
|
+
/* @__PURE__ */ jsx(CardDescription, { children: t(
|
|
136
|
+
"ecommerce.backend.store.general.description",
|
|
137
|
+
"The store name, its identifiers, the languages it is shown in and its currency."
|
|
138
|
+
) })
|
|
139
|
+
] }),
|
|
140
|
+
/* @__PURE__ */ jsxs(CardContent, { className: "space-y-4", children: [
|
|
141
|
+
canManage ? null : /* @__PURE__ */ jsx(Alert, { status: "information", children: /* @__PURE__ */ jsx(AlertDescription, { children: t(
|
|
142
|
+
"ecommerce.backend.store.general.readOnly",
|
|
143
|
+
"You can view this store but not change it. Changing it requires permission to manage stores."
|
|
144
|
+
) }) }),
|
|
145
|
+
/* @__PURE__ */ jsx("div", { onKeyDown: handleKeyDown, children: /* @__PURE__ */ jsx(
|
|
146
|
+
CrudForm,
|
|
147
|
+
{
|
|
148
|
+
schema: storeGeneralFormSchema,
|
|
149
|
+
fields,
|
|
150
|
+
initialValues,
|
|
151
|
+
optimisticLockUpdatedAt: store.updatedAt,
|
|
152
|
+
submitLabel: t("ecommerce.backend.store.general.save", "Save changes"),
|
|
153
|
+
onSubmit: handleSubmit,
|
|
154
|
+
hideFooterActions: !canManage,
|
|
155
|
+
embedded: true
|
|
156
|
+
},
|
|
157
|
+
`${formKey}:${store.updatedAt ?? "new"}`
|
|
158
|
+
) })
|
|
159
|
+
] })
|
|
160
|
+
] }),
|
|
161
|
+
/* @__PURE__ */ jsx(StoreAvailabilityDefaultsSection, { store })
|
|
162
|
+
] });
|
|
163
|
+
}
|
|
164
|
+
export {
|
|
165
|
+
StoreGeneralTab
|
|
166
|
+
};
|
|
167
|
+
//# sourceMappingURL=StoreGeneralTab.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/StoreGeneralTab.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 { 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 { STORE_STATUS_LABELS } from './StoreStatusBadge'\nimport { StoreAvailabilityDefaultsSection } from './StoreAvailabilityDefaultsSection'\nimport { STORES_API_PATH, type StoreAdminRecord, type StoreStatus } from './storeAdmin'\nimport {\n buildStoreGeneralInitialValues,\n buildStoreGeneralPayload,\n storeGeneralFormSchema,\n type StoreGeneralFormValues,\n} from './storeGeneral'\nimport { useStoreAccess } from './useStoreAccess'\n\ntype StoreGeneralTabProps = {\n store: StoreAdminRecord\n reload: () => Promise<void>\n}\n\nfunction selectableStatuses(current: StoreStatus): StoreStatus[] {\n return current === 'archived' ? ['archived'] : ['draft', 'active']\n}\n\nexport function StoreGeneralTab({ store, reload }: StoreGeneralTabProps) {\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: 'name',\n type: 'text',\n label: t('ecommerce.backend.stores.form.name', 'Name'),\n required: true,\n maxLength: 200,\n disabled: !canManage,\n },\n {\n id: 'code',\n type: 'text',\n label: t('ecommerce.backend.stores.form.code', 'Code'),\n description: t(\n 'ecommerce.backend.stores.form.codeHint',\n 'Internal identifier, unique in the workspace. Lowercase letters, digits, dashes and underscores.',\n ),\n required: true,\n maxLength: 80,\n layout: 'half',\n disabled: !canManage,\n },\n {\n id: 'slug',\n type: 'text',\n label: t('ecommerce.backend.stores.form.slug', 'Slug'),\n description: t(\n 'ecommerce.backend.stores.form.slugHint',\n 'Short name used in store addresses, unique in the workspace. Lowercase letters, digits and dashes.',\n ),\n required: true,\n maxLength: 120,\n layout: 'half',\n disabled: !canManage,\n },\n {\n id: 'status',\n type: 'select',\n label: t('ecommerce.backend.store.general.status', 'Status'),\n description:\n store.status === 'archived'\n ? t('ecommerce.backend.store.general.statusArchivedHint', 'An archived store cannot be unarchived.')\n : t(\n 'ecommerce.backend.store.general.statusHint',\n 'A draft store does not serve its storefront. Archive a store from the store list.',\n ),\n options: selectableStatuses(store.status).map((value) => ({\n value,\n label: t(STORE_STATUS_LABELS[value].key, STORE_STATUS_LABELS[value].fallback),\n })),\n required: true,\n layout: 'half',\n disabled: !canManage || store.status === 'archived',\n },\n {\n id: 'defaultCurrencyCode',\n type: 'text',\n label: t('ecommerce.backend.stores.form.currency', 'Currency'),\n description: t('ecommerce.backend.stores.form.currencyHint', 'Three-letter ISO code, for example EUR.'),\n placeholder: 'EUR',\n required: true,\n maxLength: 3,\n layout: 'half',\n disabled: !canManage,\n },\n {\n id: 'defaultLocale',\n type: 'text',\n label: t('ecommerce.backend.stores.form.defaultLocale', 'Default language'),\n description: t('ecommerce.backend.stores.form.defaultLocaleHint', 'A language code such as en or pl-PL.'),\n required: true,\n layout: 'half',\n disabled: !canManage,\n },\n {\n id: 'supportedLocales',\n type: 'tags',\n label: t('ecommerce.backend.stores.form.supportedLocales', 'Supported languages'),\n description: t(\n 'ecommerce.backend.stores.form.supportedLocalesHint',\n 'Languages the store can be shown in. Must include the default language.',\n ),\n required: true,\n disabled: !canManage,\n },\n ],\n [canManage, store.status, t],\n )\n\n const initialValues = React.useMemo(() => buildStoreGeneralInitialValues(store), [store])\n\n const handleSubmit = React.useCallback(\n async (values: StoreGeneralFormValues) => {\n await updateCrud(STORES_API_PATH, buildStoreGeneralPayload(store.id, values), {\n errorMessage: t('ecommerce.backend.store.general.errors.save', 'Failed to save the store.'),\n })\n flash(t('ecommerce.backend.store.general.flash.saved', 'Store 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.general.title', 'Identity and localization')}</CardTitle>\n <CardDescription>\n {t(\n 'ecommerce.backend.store.general.description',\n 'The store name, its identifiers, the languages it is shown in and its currency.',\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.general.readOnly',\n 'You can view this store but not change it. Changing it requires permission to manage stores.',\n )}\n </AlertDescription>\n </Alert>\n )}\n <div onKeyDown={handleKeyDown}>\n <CrudForm<StoreGeneralFormValues>\n key={`${formKey}:${store.updatedAt ?? 'new'}`}\n schema={storeGeneralFormSchema}\n fields={fields}\n initialValues={initialValues}\n optimisticLockUpdatedAt={store.updatedAt}\n submitLabel={t('ecommerce.backend.store.general.save', 'Save changes')}\n onSubmit={handleSubmit}\n hideFooterActions={!canManage}\n embedded\n />\n </div>\n </CardContent>\n </Card>\n <StoreAvailabilityDefaultsSection store={store} />\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAsJQ,SACE,KADF;AApJR,YAAY,WAAW;AACvB,SAAS,gBAAgC;AACzC,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAC3B,SAAS,OAAO,wBAAwB;AACxC,SAAS,MAAM,aAAa,iBAAiB,YAAY,iBAAiB;AAC1E,SAAS,YAAY;AACrB,SAAS,2BAA2B;AACpC,SAAS,wCAAwC;AACjD,SAAS,uBAAgE;AACzE;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,sBAAsB;AAO/B,SAAS,mBAAmB,SAAqC;AAC/D,SAAO,YAAY,aAAa,CAAC,UAAU,IAAI,CAAC,SAAS,QAAQ;AACnE;AAEO,SAAS,gBAAgB,EAAE,OAAO,OAAO,GAAyB;AACvE,QAAM,IAAI,KAAK;AACf,QAAM,EAAE,UAAU,IAAI,eAAe;AACrC,QAAM,CAAC,SAAS,UAAU,IAAI,MAAM,SAAS,CAAC;AAE9C,QAAM,SAAS,MAAM;AAAA,IACnB,MAAM;AAAA,MACJ;AAAA,QACE,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,OAAO,EAAE,sCAAsC,MAAM;AAAA,QACrD,UAAU;AAAA,QACV,WAAW;AAAA,QACX,UAAU,CAAC;AAAA,MACb;AAAA,MACA;AAAA,QACE,IAAI;AAAA,QACJ,MAAM;AAAA,QACN,OAAO,EAAE,sCAAsC,MAAM;AAAA,QACrD,aAAa;AAAA,UACX;AAAA,UACA;AAAA,QACF;AAAA,QACA,UAAU;AAAA,QACV,WAAW;AAAA,QACX,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AAE,wCAAwC,cAAc;AAAA,YACrE,UAAU;AAAA,YACV,mBAAmB,CAAC;AAAA,YACpB,UAAQ;AAAA;AAAA,UARH,GAAG,OAAO,IAAI,MAAM,aAAa,KAAK;AAAA,QAS7C,GACF;AAAA,SACF;AAAA,OACF;AAAA,IACA,oBAAC,oCAAiC,OAAc;AAAA,KAClD;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { useRouter } from "next/navigation";
|
|
5
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { Page, PageBody } from "@open-mercato/ui/backend/Page";
|
|
7
|
+
import { DataTable } from "@open-mercato/ui/backend/DataTable";
|
|
8
|
+
import { ListEmptyState } from "@open-mercato/ui/backend/filters/ListEmptyState";
|
|
9
|
+
import { RowActions } from "@open-mercato/ui/backend/RowActions";
|
|
10
|
+
import { useConfirmDialog } from "@open-mercato/ui/backend/confirm-dialog";
|
|
11
|
+
import { flash } from "@open-mercato/ui/backend/FlashMessages";
|
|
12
|
+
import { useGuardedMutation } from "@open-mercato/ui/backend/injection/useGuardedMutation";
|
|
13
|
+
import { clearAllOperations } from "@open-mercato/ui/backend/operations/store";
|
|
14
|
+
import { apiCall, withScopedApiRequestHeaders } from "@open-mercato/ui/backend/utils/apiCall";
|
|
15
|
+
import { updateCrud } from "@open-mercato/ui/backend/utils/crud";
|
|
16
|
+
import { buildOptimisticLockHeader, extractOptimisticLockConflict } from "@open-mercato/ui/backend/utils/optimisticLock";
|
|
17
|
+
import { raiseCrudError } from "@open-mercato/ui/backend/utils/serverErrors";
|
|
18
|
+
import { Button } from "@open-mercato/ui/primitives/button";
|
|
19
|
+
import { useLocale, useT } from "@open-mercato/shared/lib/i18n/context";
|
|
20
|
+
import { StoreCreateDialog } from "./StoreCreateDialog.js";
|
|
21
|
+
import { STORE_STATUS_LABELS, StoreStatusBadge } from "./StoreStatusBadge.js";
|
|
22
|
+
import {
|
|
23
|
+
STORE_STATUSES,
|
|
24
|
+
STORES_API_PATH,
|
|
25
|
+
STORES_API_URL,
|
|
26
|
+
formatPrimaryDomain
|
|
27
|
+
} from "./storeAdmin.js";
|
|
28
|
+
import { buildStoreEditHref } from "./storeEditTabs.js";
|
|
29
|
+
import { useStoreAccess } from "./useStoreAccess.js";
|
|
30
|
+
const STORE_LIST_PAGE_SIZE = 25;
|
|
31
|
+
const STORE_LIST_QUERY_KEY = ["ecommerce", "stores", "list"];
|
|
32
|
+
function isStoreStatus(value) {
|
|
33
|
+
return typeof value === "string" && STORE_STATUSES.includes(value);
|
|
34
|
+
}
|
|
35
|
+
function readStatusFilter(values) {
|
|
36
|
+
const value = values.status;
|
|
37
|
+
return isStoreStatus(value) ? value : null;
|
|
38
|
+
}
|
|
39
|
+
function buildListQuery(input) {
|
|
40
|
+
const params = new URLSearchParams();
|
|
41
|
+
params.set("page", String(input.page));
|
|
42
|
+
params.set("pageSize", String(STORE_LIST_PAGE_SIZE));
|
|
43
|
+
const search = input.search.trim();
|
|
44
|
+
if (search) params.set("search", search);
|
|
45
|
+
if (input.status) params.set("status", input.status);
|
|
46
|
+
const sort = input.sorting[0];
|
|
47
|
+
if (sort) {
|
|
48
|
+
params.set("sortField", sort.id);
|
|
49
|
+
params.set("sortDir", sort.desc ? "desc" : "asc");
|
|
50
|
+
}
|
|
51
|
+
return params.toString();
|
|
52
|
+
}
|
|
53
|
+
function StoreListPage() {
|
|
54
|
+
const t = useT();
|
|
55
|
+
const locale = useLocale();
|
|
56
|
+
const router = useRouter();
|
|
57
|
+
const queryClient = useQueryClient();
|
|
58
|
+
const { confirm, ConfirmDialogElement } = useConfirmDialog();
|
|
59
|
+
const { runMutation, retryLastMutation } = useGuardedMutation({
|
|
60
|
+
contextId: "ecommerce-store-list"
|
|
61
|
+
});
|
|
62
|
+
const { canManage } = useStoreAccess();
|
|
63
|
+
const [page, setPage] = React.useState(1);
|
|
64
|
+
const [search, setSearch] = React.useState("");
|
|
65
|
+
const [filterValues, setFilterValues] = React.useState({});
|
|
66
|
+
const [sorting, setSorting] = React.useState([{ id: "name", desc: false }]);
|
|
67
|
+
const [createOpen, setCreateOpen] = React.useState(false);
|
|
68
|
+
const status = readStatusFilter(filterValues);
|
|
69
|
+
const query = buildListQuery({ page, search, status, sorting });
|
|
70
|
+
const storesQuery = useQuery({
|
|
71
|
+
queryKey: [...STORE_LIST_QUERY_KEY, query],
|
|
72
|
+
queryFn: async () => {
|
|
73
|
+
const call = await apiCall(`${STORES_API_URL}?${query}`, { cache: "no-store" });
|
|
74
|
+
if (!call.ok) {
|
|
75
|
+
await raiseCrudError(call.response, t("ecommerce.backend.stores.errors.load", "Failed to load stores."));
|
|
76
|
+
}
|
|
77
|
+
return call.result ?? { items: [], total: 0, totalPages: 1 };
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
const refresh = React.useCallback(async () => {
|
|
81
|
+
await queryClient.invalidateQueries({ queryKey: STORE_LIST_QUERY_KEY });
|
|
82
|
+
}, [queryClient]);
|
|
83
|
+
const dateFormatter = React.useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: "medium" }), [locale]);
|
|
84
|
+
const filters = React.useMemo(
|
|
85
|
+
() => [
|
|
86
|
+
{
|
|
87
|
+
id: "status",
|
|
88
|
+
type: "select",
|
|
89
|
+
label: t("ecommerce.backend.stores.filters.status", "Status"),
|
|
90
|
+
options: STORE_STATUSES.map((value) => ({
|
|
91
|
+
value,
|
|
92
|
+
label: t(STORE_STATUS_LABELS[value].key, STORE_STATUS_LABELS[value].fallback)
|
|
93
|
+
}))
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
[t]
|
|
97
|
+
);
|
|
98
|
+
const hasActiveFilters = status !== null || search.trim().length > 0;
|
|
99
|
+
const clearFilters = React.useCallback(() => {
|
|
100
|
+
setFilterValues({});
|
|
101
|
+
setSearch("");
|
|
102
|
+
setPage(1);
|
|
103
|
+
}, []);
|
|
104
|
+
const handleArchive = React.useCallback(
|
|
105
|
+
async (row) => {
|
|
106
|
+
const confirmed = await confirm({
|
|
107
|
+
title: t("ecommerce.backend.stores.archive.confirmTitle", 'Archive store "{name}"?', { name: row.name }),
|
|
108
|
+
text: t(
|
|
109
|
+
"ecommerce.backend.stores.archive.confirmText",
|
|
110
|
+
"An archived store stops serving its storefront (HTTP 410). Its configuration and history are kept, but it cannot be unarchived."
|
|
111
|
+
),
|
|
112
|
+
confirmText: t("ecommerce.backend.stores.archive.confirmButton", "Archive store"),
|
|
113
|
+
variant: "destructive"
|
|
114
|
+
});
|
|
115
|
+
if (!confirmed) return;
|
|
116
|
+
const archiveError = t("ecommerce.backend.stores.errors.archive", "Failed to archive the store.");
|
|
117
|
+
try {
|
|
118
|
+
await runMutation({
|
|
119
|
+
operation: () => withScopedApiRequestHeaders(
|
|
120
|
+
buildOptimisticLockHeader(row.updatedAt),
|
|
121
|
+
() => updateCrud(STORES_API_PATH, { id: row.id, status: "archived" }, { errorMessage: archiveError })
|
|
122
|
+
),
|
|
123
|
+
context: { retryLastMutation },
|
|
124
|
+
mutationPayload: { id: row.id, status: "archived" }
|
|
125
|
+
});
|
|
126
|
+
clearAllOperations();
|
|
127
|
+
flash(t("ecommerce.backend.stores.flash.archived", "Store archived"), "success");
|
|
128
|
+
await refresh();
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (extractOptimisticLockConflict(error)) return;
|
|
131
|
+
flash(error instanceof Error && error.message ? error.message : archiveError, "error");
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
[confirm, refresh, retryLastMutation, runMutation, t]
|
|
135
|
+
);
|
|
136
|
+
const columns = React.useMemo(
|
|
137
|
+
() => [
|
|
138
|
+
{
|
|
139
|
+
accessorKey: "name",
|
|
140
|
+
header: t("ecommerce.backend.stores.columns.name", "Name"),
|
|
141
|
+
enableSorting: true,
|
|
142
|
+
cell: ({ row }) => row.original.name
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
accessorKey: "code",
|
|
146
|
+
header: t("ecommerce.backend.stores.columns.code", "Code"),
|
|
147
|
+
enableSorting: true
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
accessorKey: "status",
|
|
151
|
+
header: t("ecommerce.backend.stores.columns.status", "Status"),
|
|
152
|
+
enableSorting: true,
|
|
153
|
+
cell: ({ row }) => /* @__PURE__ */ jsx(StoreStatusBadge, { status: row.original.status })
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
id: "primaryDomain",
|
|
157
|
+
header: t("ecommerce.backend.stores.columns.primaryDomain", "Primary domain"),
|
|
158
|
+
enableSorting: false,
|
|
159
|
+
cell: ({ row }) => formatPrimaryDomain(row.original._ecommerce) ?? "\u2014"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
id: "channel",
|
|
163
|
+
header: t("ecommerce.backend.stores.columns.channel", "Channel"),
|
|
164
|
+
enableSorting: false,
|
|
165
|
+
cell: ({ row }) => {
|
|
166
|
+
const channel = row.original._ecommerce?.defaultChannel;
|
|
167
|
+
if (channel) return channel.name;
|
|
168
|
+
return /* @__PURE__ */ jsx("span", { className: "text-muted-foreground", children: t("ecommerce.backend.stores.columns.noDefaultChannel", "No default channel") });
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
accessorKey: "createdAt",
|
|
173
|
+
header: t("ecommerce.backend.stores.columns.created", "Created"),
|
|
174
|
+
enableSorting: true,
|
|
175
|
+
cell: ({ row }) => {
|
|
176
|
+
const value = row.original.createdAt;
|
|
177
|
+
return value ? dateFormatter.format(new Date(value)) : "\u2014";
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
],
|
|
181
|
+
[dateFormatter, t]
|
|
182
|
+
);
|
|
183
|
+
const buildRowActions = React.useCallback(
|
|
184
|
+
(row) => {
|
|
185
|
+
const items = [
|
|
186
|
+
{ id: "edit", label: t("ecommerce.backend.stores.actions.edit", "Edit"), href: buildStoreEditHref(row.id, "general") },
|
|
187
|
+
{ id: "domains", label: t("ecommerce.backend.stores.actions.domains", "Domains"), href: buildStoreEditHref(row.id, "domains") },
|
|
188
|
+
{ id: "channels", label: t("ecommerce.backend.stores.actions.channels", "Channels"), href: buildStoreEditHref(row.id, "channels") }
|
|
189
|
+
];
|
|
190
|
+
if (canManage && row.status !== "archived") {
|
|
191
|
+
items.push({
|
|
192
|
+
id: "archive",
|
|
193
|
+
label: t("ecommerce.backend.stores.actions.archive", "Archive"),
|
|
194
|
+
destructive: true,
|
|
195
|
+
onSelect: () => {
|
|
196
|
+
void handleArchive(row);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return items;
|
|
201
|
+
},
|
|
202
|
+
[canManage, handleArchive, t]
|
|
203
|
+
);
|
|
204
|
+
const createAction = canManage ? /* @__PURE__ */ jsx(Button, { type: "button", onClick: () => setCreateOpen(true), children: t("ecommerce.backend.stores.actions.create", "Create store") }) : null;
|
|
205
|
+
const emptyState = /* @__PURE__ */ jsx(
|
|
206
|
+
ListEmptyState,
|
|
207
|
+
{
|
|
208
|
+
entityName: t("ecommerce.backend.stores.entityPlural", "stores"),
|
|
209
|
+
title: t("ecommerce.backend.stores.empty.title", "No stores yet"),
|
|
210
|
+
description: canManage ? t(
|
|
211
|
+
"ecommerce.backend.stores.empty.description",
|
|
212
|
+
"A new workspace gets one draft store automatically. If this workspace existed before the Stores module was enabled, run the pending upgrade action from the dashboard to create it, or create a store now."
|
|
213
|
+
) : t(
|
|
214
|
+
"ecommerce.backend.stores.empty.descriptionReadOnly",
|
|
215
|
+
"A new workspace gets one draft store automatically. If this workspace existed before the Stores module was enabled, an administrator needs to run the pending upgrade action from the dashboard."
|
|
216
|
+
),
|
|
217
|
+
onCreate: canManage ? () => setCreateOpen(true) : void 0,
|
|
218
|
+
createLabel: t("ecommerce.backend.stores.actions.create", "Create store")
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
return /* @__PURE__ */ jsx(Page, { children: /* @__PURE__ */ jsxs(PageBody, { children: [
|
|
222
|
+
/* @__PURE__ */ jsx(
|
|
223
|
+
DataTable,
|
|
224
|
+
{
|
|
225
|
+
title: t("ecommerce.module.title", "Stores"),
|
|
226
|
+
titleHeadingLevel: 1,
|
|
227
|
+
columns,
|
|
228
|
+
data: storesQuery.data?.items ?? [],
|
|
229
|
+
isLoading: storesQuery.isLoading,
|
|
230
|
+
error: storesQuery.isError ? t("ecommerce.backend.stores.errors.load", "Failed to load stores.") : null,
|
|
231
|
+
actions: createAction,
|
|
232
|
+
searchValue: search,
|
|
233
|
+
onSearchChange: (value) => {
|
|
234
|
+
setSearch(value);
|
|
235
|
+
setPage(1);
|
|
236
|
+
},
|
|
237
|
+
searchPlaceholder: t("ecommerce.backend.stores.search.placeholder", "Search by name, code or slug"),
|
|
238
|
+
filters,
|
|
239
|
+
filterValues,
|
|
240
|
+
onFiltersApply: (values) => {
|
|
241
|
+
setFilterValues(values);
|
|
242
|
+
setPage(1);
|
|
243
|
+
},
|
|
244
|
+
onFiltersClear: clearFilters,
|
|
245
|
+
filterAwareEmptyState: {
|
|
246
|
+
active: hasActiveFilters,
|
|
247
|
+
entityNamePlural: t("ecommerce.backend.stores.entityPlural", "stores"),
|
|
248
|
+
canRemoveLast: status !== null,
|
|
249
|
+
onClearAll: clearFilters,
|
|
250
|
+
onRemoveLast: clearFilters
|
|
251
|
+
},
|
|
252
|
+
sorting,
|
|
253
|
+
onSortingChange: (next) => {
|
|
254
|
+
setSorting(next);
|
|
255
|
+
setPage(1);
|
|
256
|
+
},
|
|
257
|
+
sortable: true,
|
|
258
|
+
manualSorting: true,
|
|
259
|
+
rowActions: (row) => /* @__PURE__ */ jsx(RowActions, { items: buildRowActions(row) }),
|
|
260
|
+
onRowClick: (row) => router.push(buildStoreEditHref(row.id, "general")),
|
|
261
|
+
emptyState,
|
|
262
|
+
pagination: {
|
|
263
|
+
page,
|
|
264
|
+
pageSize: STORE_LIST_PAGE_SIZE,
|
|
265
|
+
total: storesQuery.data?.total ?? 0,
|
|
266
|
+
totalPages: storesQuery.data?.totalPages ?? 1,
|
|
267
|
+
totalIsCapped: storesQuery.data?.totalIsCapped === true,
|
|
268
|
+
onPageChange: setPage
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
),
|
|
272
|
+
canManage ? /* @__PURE__ */ jsx(
|
|
273
|
+
StoreCreateDialog,
|
|
274
|
+
{
|
|
275
|
+
open: createOpen,
|
|
276
|
+
onOpenChange: setCreateOpen,
|
|
277
|
+
onCreated: async () => {
|
|
278
|
+
clearFilters();
|
|
279
|
+
await refresh();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
) : null,
|
|
283
|
+
ConfirmDialogElement
|
|
284
|
+
] }) });
|
|
285
|
+
}
|
|
286
|
+
export {
|
|
287
|
+
STORE_LIST_PAGE_SIZE,
|
|
288
|
+
StoreListPage
|
|
289
|
+
};
|
|
290
|
+
//# sourceMappingURL=StoreListPage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/ecommerce/components/StoreListPage.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { useRouter } from 'next/navigation'\nimport { useQuery, useQueryClient } from '@tanstack/react-query'\nimport type { LegacyColumnDef as ColumnDef } from '@tanstack/react-table/legacy'\nimport type { SortingState } from '@tanstack/react-table'\nimport { Page, PageBody } from '@open-mercato/ui/backend/Page'\nimport { DataTable } from '@open-mercato/ui/backend/DataTable'\nimport type { FilterDef, FilterValues } from '@open-mercato/ui/backend/FilterBar'\nimport { ListEmptyState } from '@open-mercato/ui/backend/filters/ListEmptyState'\nimport { RowActions, type RowActionItem } from '@open-mercato/ui/backend/RowActions'\nimport { useConfirmDialog } from '@open-mercato/ui/backend/confirm-dialog'\nimport { flash } from '@open-mercato/ui/backend/FlashMessages'\nimport { useGuardedMutation } from '@open-mercato/ui/backend/injection/useGuardedMutation'\nimport { clearAllOperations } from '@open-mercato/ui/backend/operations/store'\nimport { apiCall, withScopedApiRequestHeaders } from '@open-mercato/ui/backend/utils/apiCall'\nimport { updateCrud } from '@open-mercato/ui/backend/utils/crud'\nimport { buildOptimisticLockHeader, extractOptimisticLockConflict } from '@open-mercato/ui/backend/utils/optimisticLock'\nimport { raiseCrudError } from '@open-mercato/ui/backend/utils/serverErrors'\nimport { Button } from '@open-mercato/ui/primitives/button'\nimport { useLocale, useT } from '@open-mercato/shared/lib/i18n/context'\nimport { StoreCreateDialog } from './StoreCreateDialog'\nimport { STORE_STATUS_LABELS, StoreStatusBadge } from './StoreStatusBadge'\nimport {\n STORE_STATUSES,\n STORES_API_PATH,\n STORES_API_URL,\n formatPrimaryDomain,\n type StoreAdminRecord,\n type StoreListResponse,\n type StoreStatus,\n} from './storeAdmin'\nimport { buildStoreEditHref } from './storeEditTabs'\nimport { useStoreAccess } from './useStoreAccess'\n\nexport const STORE_LIST_PAGE_SIZE = 25\n\nconst STORE_LIST_QUERY_KEY = ['ecommerce', 'stores', 'list'] as const\n\nfunction isStoreStatus(value: unknown): value is StoreStatus {\n return typeof value === 'string' && (STORE_STATUSES as readonly string[]).includes(value)\n}\n\nfunction readStatusFilter(values: FilterValues): StoreStatus | null {\n const value = values.status\n return isStoreStatus(value) ? value : null\n}\n\nfunction buildListQuery(input: {\n page: number\n search: string\n status: StoreStatus | null\n sorting: SortingState\n}): string {\n const params = new URLSearchParams()\n params.set('page', String(input.page))\n params.set('pageSize', String(STORE_LIST_PAGE_SIZE))\n const search = input.search.trim()\n if (search) params.set('search', search)\n if (input.status) params.set('status', input.status)\n const sort = input.sorting[0]\n if (sort) {\n params.set('sortField', sort.id)\n params.set('sortDir', sort.desc ? 'desc' : 'asc')\n }\n return params.toString()\n}\n\nexport function StoreListPage() {\n const t = useT()\n const locale = useLocale()\n const router = useRouter()\n const queryClient = useQueryClient()\n const { confirm, ConfirmDialogElement } = useConfirmDialog()\n const { runMutation, retryLastMutation } = useGuardedMutation<Record<string, unknown>>({\n contextId: 'ecommerce-store-list',\n })\n const { canManage } = useStoreAccess()\n const [page, setPage] = React.useState(1)\n const [search, setSearch] = React.useState('')\n const [filterValues, setFilterValues] = React.useState<FilterValues>({})\n const [sorting, setSorting] = React.useState<SortingState>([{ id: 'name', desc: false }])\n const [createOpen, setCreateOpen] = React.useState(false)\n\n const status = readStatusFilter(filterValues)\n const query = buildListQuery({ page, search, status, sorting })\n\n const storesQuery = useQuery({\n queryKey: [...STORE_LIST_QUERY_KEY, query],\n queryFn: async (): Promise<StoreListResponse> => {\n const call = await apiCall<StoreListResponse>(`${STORES_API_URL}?${query}`, { cache: 'no-store' })\n if (!call.ok) {\n await raiseCrudError(call.response, t('ecommerce.backend.stores.errors.load', 'Failed to load stores.'))\n }\n return call.result ?? { items: [], total: 0, totalPages: 1 }\n },\n })\n\n const refresh = React.useCallback(async () => {\n await queryClient.invalidateQueries({ queryKey: STORE_LIST_QUERY_KEY })\n }, [queryClient])\n\n const dateFormatter = React.useMemo(() => new Intl.DateTimeFormat(locale, { dateStyle: 'medium' }), [locale])\n\n const filters = React.useMemo<FilterDef[]>(\n () => [\n {\n id: 'status',\n type: 'select',\n label: t('ecommerce.backend.stores.filters.status', 'Status'),\n options: STORE_STATUSES.map((value) => ({\n value,\n label: t(STORE_STATUS_LABELS[value].key, STORE_STATUS_LABELS[value].fallback),\n })),\n },\n ],\n [t],\n )\n\n const hasActiveFilters = status !== null || search.trim().length > 0\n\n const clearFilters = React.useCallback(() => {\n setFilterValues({})\n setSearch('')\n setPage(1)\n }, [])\n\n const handleArchive = React.useCallback(\n async (row: StoreAdminRecord) => {\n const confirmed = await confirm({\n title: t('ecommerce.backend.stores.archive.confirmTitle', 'Archive store \"{name}\"?', { name: row.name }),\n text: t(\n 'ecommerce.backend.stores.archive.confirmText',\n 'An archived store stops serving its storefront (HTTP 410). Its configuration and history are kept, but it cannot be unarchived.',\n ),\n confirmText: t('ecommerce.backend.stores.archive.confirmButton', 'Archive store'),\n variant: 'destructive',\n })\n if (!confirmed) return\n const archiveError = t('ecommerce.backend.stores.errors.archive', 'Failed to archive the store.')\n try {\n await runMutation({\n operation: () =>\n withScopedApiRequestHeaders(buildOptimisticLockHeader(row.updatedAt), () =>\n updateCrud(STORES_API_PATH, { id: row.id, status: 'archived' }, { errorMessage: archiveError }),\n ),\n context: { retryLastMutation },\n mutationPayload: { id: row.id, status: 'archived' },\n })\n clearAllOperations()\n flash(t('ecommerce.backend.stores.flash.archived', 'Store archived'), 'success')\n await refresh()\n } catch (error) {\n if (extractOptimisticLockConflict(error)) return\n flash(error instanceof Error && error.message ? error.message : archiveError, 'error')\n }\n },\n [confirm, refresh, retryLastMutation, runMutation, t],\n )\n\n const columns = React.useMemo<ColumnDef<StoreAdminRecord>[]>(\n () => [\n {\n accessorKey: 'name',\n header: t('ecommerce.backend.stores.columns.name', 'Name'),\n enableSorting: true,\n cell: ({ row }) => row.original.name,\n },\n {\n accessorKey: 'code',\n header: t('ecommerce.backend.stores.columns.code', 'Code'),\n enableSorting: true,\n },\n {\n accessorKey: 'status',\n header: t('ecommerce.backend.stores.columns.status', 'Status'),\n enableSorting: true,\n cell: ({ row }) => <StoreStatusBadge status={row.original.status} />,\n },\n {\n id: 'primaryDomain',\n header: t('ecommerce.backend.stores.columns.primaryDomain', 'Primary domain'),\n enableSorting: false,\n cell: ({ row }) => formatPrimaryDomain(row.original._ecommerce) ?? '\u2014',\n },\n {\n id: 'channel',\n header: t('ecommerce.backend.stores.columns.channel', 'Channel'),\n enableSorting: false,\n cell: ({ row }) => {\n const channel = row.original._ecommerce?.defaultChannel\n if (channel) return channel.name\n return (\n <span className=\"text-muted-foreground\">\n {t('ecommerce.backend.stores.columns.noDefaultChannel', 'No default channel')}\n </span>\n )\n },\n },\n {\n accessorKey: 'createdAt',\n header: t('ecommerce.backend.stores.columns.created', 'Created'),\n enableSorting: true,\n cell: ({ row }) => {\n const value = row.original.createdAt\n return value ? dateFormatter.format(new Date(value)) : '\u2014'\n },\n },\n ],\n [dateFormatter, t],\n )\n\n const buildRowActions = React.useCallback(\n (row: StoreAdminRecord): RowActionItem[] => {\n const items: RowActionItem[] = [\n { id: 'edit', label: t('ecommerce.backend.stores.actions.edit', 'Edit'), href: buildStoreEditHref(row.id, 'general') },\n { id: 'domains', label: t('ecommerce.backend.stores.actions.domains', 'Domains'), href: buildStoreEditHref(row.id, 'domains') },\n { id: 'channels', label: t('ecommerce.backend.stores.actions.channels', 'Channels'), href: buildStoreEditHref(row.id, 'channels') },\n ]\n if (canManage && row.status !== 'archived') {\n items.push({\n id: 'archive',\n label: t('ecommerce.backend.stores.actions.archive', 'Archive'),\n destructive: true,\n onSelect: () => {\n void handleArchive(row)\n },\n })\n }\n return items\n },\n [canManage, handleArchive, t],\n )\n\n const createAction = canManage ? (\n <Button type=\"button\" onClick={() => setCreateOpen(true)}>\n {t('ecommerce.backend.stores.actions.create', 'Create store')}\n </Button>\n ) : null\n\n const emptyState = (\n <ListEmptyState\n entityName={t('ecommerce.backend.stores.entityPlural', 'stores')}\n title={t('ecommerce.backend.stores.empty.title', 'No stores yet')}\n description={\n canManage\n ? t(\n 'ecommerce.backend.stores.empty.description',\n 'A new workspace gets one draft store automatically. If this workspace existed before the Stores module was enabled, run the pending upgrade action from the dashboard to create it, or create a store now.',\n )\n : t(\n 'ecommerce.backend.stores.empty.descriptionReadOnly',\n 'A new workspace gets one draft store automatically. If this workspace existed before the Stores module was enabled, an administrator needs to run the pending upgrade action from the dashboard.',\n )\n }\n onCreate={canManage ? () => setCreateOpen(true) : undefined}\n createLabel={t('ecommerce.backend.stores.actions.create', 'Create store')}\n />\n )\n\n return (\n <Page>\n <PageBody>\n <DataTable<StoreAdminRecord>\n title={t('ecommerce.module.title', 'Stores')}\n titleHeadingLevel={1}\n columns={columns}\n data={storesQuery.data?.items ?? []}\n isLoading={storesQuery.isLoading}\n error={storesQuery.isError ? t('ecommerce.backend.stores.errors.load', 'Failed to load stores.') : null}\n actions={createAction}\n searchValue={search}\n onSearchChange={(value) => {\n setSearch(value)\n setPage(1)\n }}\n searchPlaceholder={t('ecommerce.backend.stores.search.placeholder', 'Search by name, code or slug')}\n filters={filters}\n filterValues={filterValues}\n onFiltersApply={(values) => {\n setFilterValues(values)\n setPage(1)\n }}\n onFiltersClear={clearFilters}\n filterAwareEmptyState={{\n active: hasActiveFilters,\n entityNamePlural: t('ecommerce.backend.stores.entityPlural', 'stores'),\n canRemoveLast: status !== null,\n onClearAll: clearFilters,\n onRemoveLast: clearFilters,\n }}\n sorting={sorting}\n onSortingChange={(next) => {\n setSorting(next)\n setPage(1)\n }}\n sortable\n manualSorting\n rowActions={(row) => <RowActions items={buildRowActions(row)} />}\n onRowClick={(row) => router.push(buildStoreEditHref(row.id, 'general'))}\n emptyState={emptyState}\n pagination={{\n page,\n pageSize: STORE_LIST_PAGE_SIZE,\n total: storesQuery.data?.total ?? 0,\n totalPages: storesQuery.data?.totalPages ?? 1,\n totalIsCapped: storesQuery.data?.totalIsCapped === true,\n onPageChange: setPage,\n }}\n />\n {canManage ? (\n <StoreCreateDialog\n open={createOpen}\n onOpenChange={setCreateOpen}\n onCreated={async () => {\n clearFilters()\n await refresh()\n }}\n />\n ) : null}\n {ConfirmDialogElement}\n </PageBody>\n </Page>\n )\n}\n"],
|
|
5
|
+
"mappings": ";AAkL2B,cAqFrB,YArFqB;AAhL3B,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAC1B,SAAS,UAAU,sBAAsB;AAGzC,SAAS,MAAM,gBAAgB;AAC/B,SAAS,iBAAiB;AAE1B,SAAS,sBAAsB;AAC/B,SAAS,kBAAsC;AAC/C,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,0BAA0B;AACnC,SAAS,0BAA0B;AACnC,SAAS,SAAS,mCAAmC;AACrD,SAAS,kBAAkB;AAC3B,SAAS,2BAA2B,qCAAqC;AACzE,SAAS,s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