@endora-commerce/admin-kit 0.0.0-stage → 0.100.0
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/LICENSE +21 -0
- package/README.md +212 -2
- package/dist/components/FileDropzone.d.ts +13 -0
- package/dist/components/FileDropzone.d.ts.map +1 -0
- package/dist/components/FileDropzone.js +39 -0
- package/dist/components/FileDropzone.js.map +1 -0
- package/dist/components/PaginationFooter.d.ts +25 -0
- package/dist/components/PaginationFooter.d.ts.map +1 -0
- package/dist/components/PaginationFooter.js +33 -0
- package/dist/components/PaginationFooter.js.map +1 -0
- package/dist/components/ResponsiveTable.d.ts +26 -0
- package/dist/components/ResponsiveTable.d.ts.map +1 -0
- package/dist/components/ResponsiveTable.js +34 -0
- package/dist/components/ResponsiveTable.js.map +1 -0
- package/dist/components/RowActionMenu.d.ts +40 -0
- package/dist/components/RowActionMenu.d.ts.map +1 -0
- package/dist/components/RowActionMenu.js +15 -0
- package/dist/components/RowActionMenu.js.map +1 -0
- package/dist/components/StickyFormActions.d.ts +10 -0
- package/dist/components/StickyFormActions.d.ts.map +1 -0
- package/dist/components/StickyFormActions.js +10 -0
- package/dist/components/StickyFormActions.js.map +1 -0
- package/dist/components/TouchReorderButtons.d.ts +13 -0
- package/dist/components/TouchReorderButtons.d.ts.map +1 -0
- package/dist/components/TouchReorderButtons.js +12 -0
- package/dist/components/TouchReorderButtons.js.map +1 -0
- package/dist/components/admin-user-picker/AdminUserPicker.d.ts +14 -0
- package/dist/components/admin-user-picker/AdminUserPicker.d.ts.map +1 -0
- package/dist/components/admin-user-picker/AdminUserPicker.js +68 -0
- package/dist/components/admin-user-picker/AdminUserPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetFieldPicker.d.ts +32 -0
- package/dist/components/asset-picker/AssetFieldPicker.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetFieldPicker.js +42 -0
- package/dist/components/asset-picker/AssetFieldPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetPicker.d.ts +31 -0
- package/dist/components/asset-picker/AssetPicker.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetPicker.js +68 -0
- package/dist/components/asset-picker/AssetPicker.js.map +1 -0
- package/dist/components/asset-picker/AssetUploader.d.ts +15 -0
- package/dist/components/asset-picker/AssetUploader.d.ts.map +1 -0
- package/dist/components/asset-picker/AssetUploader.js +61 -0
- package/dist/components/asset-picker/AssetUploader.js.map +1 -0
- package/dist/components/asset-picker/assets-api.d.ts +49 -0
- package/dist/components/asset-picker/assets-api.d.ts.map +1 -0
- package/dist/components/asset-picker/assets-api.js +67 -0
- package/dist/components/asset-picker/assets-api.js.map +1 -0
- package/dist/components/category-picker/CategorySelect.d.ts +14 -0
- package/dist/components/category-picker/CategorySelect.d.ts.map +1 -0
- package/dist/components/category-picker/CategorySelect.js +41 -0
- package/dist/components/category-picker/CategorySelect.js.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.d.ts +18 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.d.ts.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.js +19 -0
- package/dist/components/category-tree-picker/CategoryTreeNodeRow.js.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.d.ts +23 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.d.ts.map +1 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.js +82 -0
- package/dist/components/category-tree-picker/CategoryTreePicker.js.map +1 -0
- package/dist/components/category-tree-picker/category-tree-utils.d.ts +35 -0
- package/dist/components/category-tree-picker/category-tree-utils.d.ts.map +1 -0
- package/dist/components/category-tree-picker/category-tree-utils.js +140 -0
- package/dist/components/category-tree-picker/category-tree-utils.js.map +1 -0
- package/dist/components/category-tree-picker/index.d.ts +4 -0
- package/dist/components/category-tree-picker/index.d.ts.map +1 -0
- package/dist/components/category-tree-picker/index.js +2 -0
- package/dist/components/category-tree-picker/index.js.map +1 -0
- package/dist/components/charts/echart.d.ts +17 -0
- package/dist/components/charts/echart.d.ts.map +1 -0
- package/dist/components/charts/echart.js +61 -0
- package/dist/components/charts/echart.js.map +1 -0
- package/dist/components/cms-picker/CmsBlockPicker.d.ts +14 -0
- package/dist/components/cms-picker/CmsBlockPicker.d.ts.map +1 -0
- package/dist/components/cms-picker/CmsBlockPicker.js +40 -0
- package/dist/components/cms-picker/CmsBlockPicker.js.map +1 -0
- package/dist/components/cms-picker/CmsPagePicker.d.ts +15 -0
- package/dist/components/cms-picker/CmsPagePicker.d.ts.map +1 -0
- package/dist/components/cms-picker/CmsPagePicker.js +80 -0
- package/dist/components/cms-picker/CmsPagePicker.js.map +1 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.d.ts +30 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.d.ts.map +1 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.js +14 -0
- package/dist/components/content-language-tabs/ContentLanguageTabs.js.map +1 -0
- package/dist/components/country-select/CountrySelect.d.ts +29 -0
- package/dist/components/country-select/CountrySelect.d.ts.map +1 -0
- package/dist/components/country-select/CountrySelect.js +40 -0
- package/dist/components/country-select/CountrySelect.js.map +1 -0
- package/dist/components/country-select/index.d.ts +3 -0
- package/dist/components/country-select/index.d.ts.map +1 -0
- package/dist/components/country-select/index.js +3 -0
- package/dist/components/country-select/index.js.map +1 -0
- package/dist/components/country-select/useCountriesQuery.d.ts +12 -0
- package/dist/components/country-select/useCountriesQuery.d.ts.map +1 -0
- package/dist/components/country-select/useCountriesQuery.js +69 -0
- package/dist/components/country-select/useCountriesQuery.js.map +1 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.d.ts +48 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.d.ts.map +1 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.js +122 -0
- package/dist/components/custom-field-values/CustomFieldValuesPanel.js.map +1 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts +14 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts.map +1 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.js +36 -0
- package/dist/components/customer-group-picker/CustomerGroupPicker.js.map +1 -0
- package/dist/components/customer-picker/CustomerPicker.d.ts +18 -0
- package/dist/components/customer-picker/CustomerPicker.d.ts.map +1 -0
- package/dist/components/customer-picker/CustomerPicker.js +85 -0
- package/dist/components/customer-picker/CustomerPicker.js.map +1 -0
- package/dist/components/dictionary-picker/CountryPicker.d.ts +26 -0
- package/dist/components/dictionary-picker/CountryPicker.d.ts.map +1 -0
- package/dist/components/dictionary-picker/CountryPicker.js +29 -0
- package/dist/components/dictionary-picker/CountryPicker.js.map +1 -0
- package/dist/components/dictionary-picker/CurrencyPicker.d.ts +17 -0
- package/dist/components/dictionary-picker/CurrencyPicker.d.ts.map +1 -0
- package/dist/components/dictionary-picker/CurrencyPicker.js +29 -0
- package/dist/components/dictionary-picker/CurrencyPicker.js.map +1 -0
- package/dist/components/dictionary-picker/dictionary-api.d.ts +21 -0
- package/dist/components/dictionary-picker/dictionary-api.d.ts.map +1 -0
- package/dist/components/dictionary-picker/dictionary-api.js +26 -0
- package/dist/components/dictionary-picker/dictionary-api.js.map +1 -0
- package/dist/components/dictionary-picker/index.d.ts +4 -0
- package/dist/components/dictionary-picker/index.d.ts.map +1 -0
- package/dist/components/dictionary-picker/index.js +4 -0
- package/dist/components/dictionary-picker/index.js.map +1 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.d.ts +49 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.d.ts.map +1 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.js +43 -0
- package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.js.map +1 -0
- package/dist/components/hooks/useFocusTrap.d.ts +6 -0
- package/dist/components/hooks/useFocusTrap.d.ts.map +1 -0
- package/dist/components/hooks/useFocusTrap.js +41 -0
- package/dist/components/hooks/useFocusTrap.js.map +1 -0
- package/dist/components/hooks/useViewportTier.d.ts +7 -0
- package/dist/components/hooks/useViewportTier.d.ts.map +1 -0
- package/dist/components/hooks/useViewportTier.js +23 -0
- package/dist/components/hooks/useViewportTier.js.map +1 -0
- package/dist/components/index.d.ts +101 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +63 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/organization-picker/OrganizationPicker.d.ts +28 -0
- package/dist/components/organization-picker/OrganizationPicker.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationPicker.js +35 -0
- package/dist/components/organization-picker/OrganizationPicker.js.map +1 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.d.ts +32 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.js +55 -0
- package/dist/components/organization-picker/OrganizationPickerMulti.js.map +1 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.d.ts +7 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.d.ts.map +1 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.js +33 -0
- package/dist/components/organization-picker/OrganizationStatusBadge.js.map +1 -0
- package/dist/components/organization-picker/useOrganizationsQuery.d.ts +33 -0
- package/dist/components/organization-picker/useOrganizationsQuery.d.ts.map +1 -0
- package/dist/components/organization-picker/useOrganizationsQuery.js +92 -0
- package/dist/components/organization-picker/useOrganizationsQuery.js.map +1 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts +38 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts.map +1 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.js +50 -0
- package/dist/components/payment-method-availability/MethodAvailabilityCell.js.map +1 -0
- package/dist/components/product-picker/ProductPicker.d.ts +22 -0
- package/dist/components/product-picker/ProductPicker.d.ts.map +1 -0
- package/dist/components/product-picker/ProductPicker.js +143 -0
- package/dist/components/product-picker/ProductPicker.js.map +1 -0
- package/dist/components/reorder/ReorderAnnouncer.d.ts +29 -0
- package/dist/components/reorder/ReorderAnnouncer.d.ts.map +1 -0
- package/dist/components/reorder/ReorderAnnouncer.js +6 -0
- package/dist/components/reorder/ReorderAnnouncer.js.map +1 -0
- package/dist/components/reorder/useReorderList.d.ts +121 -0
- package/dist/components/reorder/useReorderList.d.ts.map +1 -0
- package/dist/components/reorder/useReorderList.js +241 -0
- package/dist/components/reorder/useReorderList.js.map +1 -0
- package/dist/components/rule-builder/RuleBuilder.d.ts +105 -0
- package/dist/components/rule-builder/RuleBuilder.d.ts.map +1 -0
- package/dist/components/rule-builder/RuleBuilder.js +138 -0
- package/dist/components/rule-builder/RuleBuilder.js.map +1 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts +15 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts.map +1 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.js +79 -0
- package/dist/components/sales-channel-picker/SalesChannelPicker.js.map +1 -0
- package/dist/components/scope-notice/ScopeNotice.d.ts +33 -0
- package/dist/components/scope-notice/ScopeNotice.d.ts.map +1 -0
- package/dist/components/scope-notice/ScopeNotice.js +11 -0
- package/dist/components/scope-notice/ScopeNotice.js.map +1 -0
- package/dist/components/scope-picker/ScopePicker.d.ts +28 -0
- package/dist/components/scope-picker/ScopePicker.d.ts.map +1 -0
- package/dist/components/scope-picker/ScopePicker.js +114 -0
- package/dist/components/scope-picker/ScopePicker.js.map +1 -0
- package/dist/components/scope-picker/sales-channels-api.d.ts +19 -0
- package/dist/components/scope-picker/sales-channels-api.d.ts.map +1 -0
- package/dist/components/scope-picker/sales-channels-api.js +30 -0
- package/dist/components/scope-picker/sales-channels-api.js.map +1 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.d.ts +26 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.d.ts.map +1 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.js +241 -0
- package/dist/components/status-transition-graph/StatusTransitionGraph.js.map +1 -0
- package/dist/components/status-transition-graph/index.d.ts +3 -0
- package/dist/components/status-transition-graph/index.d.ts.map +1 -0
- package/dist/components/status-transition-graph/index.js +2 -0
- package/dist/components/status-transition-graph/index.js.map +1 -0
- package/dist/contributions/index.d.ts +44 -0
- package/dist/contributions/index.d.ts.map +1 -0
- package/dist/contributions/index.js +42 -0
- package/dist/contributions/index.js.map +1 -0
- package/dist/contributions/zone-component.d.ts +70 -0
- package/dist/contributions/zone-component.d.ts.map +1 -0
- package/dist/contributions/zone-component.js +26 -0
- package/dist/contributions/zone-component.js.map +1 -0
- package/dist/field-protection/FieldProtectionPricePanel.d.ts +26 -0
- package/dist/field-protection/FieldProtectionPricePanel.d.ts.map +1 -0
- package/dist/field-protection/FieldProtectionPricePanel.js +14 -0
- package/dist/field-protection/FieldProtectionPricePanel.js.map +1 -0
- package/dist/field-protection/FieldProtectionSummary.d.ts +18 -0
- package/dist/field-protection/FieldProtectionSummary.d.ts.map +1 -0
- package/dist/field-protection/FieldProtectionSummary.js +18 -0
- package/dist/field-protection/FieldProtectionSummary.js.map +1 -0
- package/dist/field-protection/FieldProtectionToggle.d.ts +36 -0
- package/dist/field-protection/FieldProtectionToggle.d.ts.map +1 -0
- package/dist/field-protection/FieldProtectionToggle.js +30 -0
- package/dist/field-protection/FieldProtectionToggle.js.map +1 -0
- package/dist/field-protection/describe-path.d.ts +27 -0
- package/dist/field-protection/describe-path.d.ts.map +1 -0
- package/dist/field-protection/describe-path.js +28 -0
- package/dist/field-protection/describe-path.js.map +1 -0
- package/dist/field-protection/index.d.ts +46 -0
- package/dist/field-protection/index.d.ts.map +1 -0
- package/dist/field-protection/index.js +41 -0
- package/dist/field-protection/index.js.map +1 -0
- package/dist/field-protection/types.d.ts +93 -0
- package/dist/field-protection/types.d.ts.map +1 -0
- package/dist/field-protection/types.js +2 -0
- package/dist/field-protection/types.js.map +1 -0
- package/dist/field-protection/use-field-protection.d.ts +27 -0
- package/dist/field-protection/use-field-protection.d.ts.map +1 -0
- package/dist/field-protection/use-field-protection.js +149 -0
- package/dist/field-protection/use-field-protection.js.map +1 -0
- package/dist/i18n/TranslationProvider.d.ts +27 -0
- package/dist/i18n/TranslationProvider.d.ts.map +1 -0
- package/dist/i18n/TranslationProvider.js +130 -0
- package/dist/i18n/TranslationProvider.js.map +1 -0
- package/dist/i18n/app-language-context.d.ts +8 -0
- package/dist/i18n/app-language-context.d.ts.map +1 -0
- package/dist/i18n/app-language-context.js +13 -0
- package/dist/i18n/app-language-context.js.map +1 -0
- package/dist/i18n/index.d.ts +29 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +25 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/interpolate.d.ts +2 -0
- package/dist/i18n/interpolate.d.ts.map +1 -0
- package/dist/i18n/interpolate.js +10 -0
- package/dist/i18n/interpolate.js.map +1 -0
- package/dist/i18n/language-storage.d.ts +16 -0
- package/dist/i18n/language-storage.d.ts.map +1 -0
- package/dist/i18n/language-storage.js +26 -0
- package/dist/i18n/language-storage.js.map +1 -0
- package/dist/i18n/resolver.d.ts +19 -0
- package/dist/i18n/resolver.d.ts.map +1 -0
- package/dist/i18n/resolver.js +23 -0
- package/dist/i18n/resolver.js.map +1 -0
- package/dist/i18n/types.d.ts +12 -0
- package/dist/i18n/types.d.ts.map +1 -0
- package/dist/i18n/types.js +7 -0
- package/dist/i18n/types.js.map +1 -0
- package/dist/i18n/useTranslation.d.ts +2 -0
- package/dist/i18n/useTranslation.d.ts.map +1 -0
- package/dist/i18n/useTranslation.js +16 -0
- package/dist/i18n/useTranslation.js.map +1 -0
- package/dist/lib/admin-actions/icon-map.d.ts +3 -0
- package/dist/lib/admin-actions/icon-map.d.ts.map +1 -0
- package/dist/lib/admin-actions/icon-map.js +115 -0
- package/dist/lib/admin-actions/icon-map.js.map +1 -0
- package/dist/lib/api-client.d.ts +55 -0
- package/dist/lib/api-client.d.ts.map +1 -0
- package/dist/lib/api-client.js +89 -0
- package/dist/lib/api-client.js.map +1 -0
- package/dist/lib/asset-url.d.ts +32 -0
- package/dist/lib/asset-url.d.ts.map +1 -0
- package/dist/lib/asset-url.js +42 -0
- package/dist/lib/asset-url.js.map +1 -0
- package/dist/lib/auth.d.ts +92 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +133 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/format.d.ts +2 -0
- package/dist/lib/format.d.ts.map +1 -0
- package/dist/lib/format.js +9 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/index.d.ts +46 -0
- package/dist/lib/index.d.ts.map +1 -0
- package/dist/lib/index.js +41 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/invoice-email-outcome.d.ts +53 -0
- package/dist/lib/invoice-email-outcome.d.ts.map +1 -0
- package/dist/lib/invoice-email-outcome.js +43 -0
- package/dist/lib/invoice-email-outcome.js.map +1 -0
- package/dist/lib/module-presence/ModulePresenceProvider.d.ts +49 -0
- package/dist/lib/module-presence/ModulePresenceProvider.d.ts.map +1 -0
- package/dist/lib/module-presence/ModulePresenceProvider.js +73 -0
- package/dist/lib/module-presence/ModulePresenceProvider.js.map +1 -0
- package/dist/lib/module-presence/api.d.ts +15 -0
- package/dist/lib/module-presence/api.d.ts.map +1 -0
- package/dist/lib/module-presence/api.js +25 -0
- package/dist/lib/module-presence/api.js.map +1 -0
- package/dist/lib/module-presence/index.d.ts +3 -0
- package/dist/lib/module-presence/index.d.ts.map +1 -0
- package/dist/lib/module-presence/index.js +3 -0
- package/dist/lib/module-presence/index.js.map +1 -0
- package/dist/lib/money.d.ts +22 -0
- package/dist/lib/money.d.ts.map +1 -0
- package/dist/lib/money.js +51 -0
- package/dist/lib/money.js.map +1 -0
- package/dist/lib/page-size-options.d.ts +15 -0
- package/dist/lib/page-size-options.d.ts.map +1 -0
- package/dist/lib/page-size-options.js +14 -0
- package/dist/lib/page-size-options.js.map +1 -0
- package/dist/lib/status-color.d.ts +32 -0
- package/dist/lib/status-color.d.ts.map +1 -0
- package/dist/lib/status-color.js +24 -0
- package/dist/lib/status-color.js.map +1 -0
- package/dist/lib/surface-visibility.d.ts +70 -0
- package/dist/lib/surface-visibility.d.ts.map +1 -0
- package/dist/lib/surface-visibility.js +37 -0
- package/dist/lib/surface-visibility.js.map +1 -0
- package/dist/lib/text-normalization.d.ts +56 -0
- package/dist/lib/text-normalization.d.ts.map +1 -0
- package/dist/lib/text-normalization.js +59 -0
- package/dist/lib/text-normalization.js.map +1 -0
- package/dist/lib/use-page-size-preference.d.ts +29 -0
- package/dist/lib/use-page-size-preference.d.ts.map +1 -0
- package/dist/lib/use-page-size-preference.js +61 -0
- package/dist/lib/use-page-size-preference.js.map +1 -0
- package/dist/lib/use-unsaved-changes-prompt.d.ts +23 -0
- package/dist/lib/use-unsaved-changes-prompt.d.ts.map +1 -0
- package/dist/lib/use-unsaved-changes-prompt.js +75 -0
- package/dist/lib/use-unsaved-changes-prompt.js.map +1 -0
- package/dist/lib/utils.d.ts +9 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +12 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/uuid.d.ts +8 -0
- package/dist/lib/uuid.d.ts.map +1 -0
- package/dist/lib/uuid.js +18 -0
- package/dist/lib/uuid.js.map +1 -0
- package/dist/ui/alert.d.ts +12 -0
- package/dist/ui/alert.d.ts.map +1 -0
- package/dist/ui/alert.js +22 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/badge.d.ts +10 -0
- package/dist/ui/badge.d.ts.map +1 -0
- package/dist/ui/badge.js +21 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/button.d.ts +12 -0
- package/dist/ui/button.d.ts.map +1 -0
- package/dist/ui/button.js +31 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/card.d.ts +8 -0
- package/dist/ui/card.d.ts.map +1 -0
- package/dist/ui/card.js +16 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/checkbox.d.ts +8 -0
- package/dist/ui/checkbox.d.ts.map +1 -0
- package/dist/ui/checkbox.js +11 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/color-picker.d.ts +23 -0
- package/dist/ui/color-picker.d.ts.map +1 -0
- package/dist/ui/color-picker.js +76 -0
- package/dist/ui/color-picker.js.map +1 -0
- package/dist/ui/combobox.d.ts +68 -0
- package/dist/ui/combobox.d.ts.map +1 -0
- package/dist/ui/combobox.js +182 -0
- package/dist/ui/combobox.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +26 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/ui/dropdown-menu.js +38 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/index.d.ts +47 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +38 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input.d.ts +3 -0
- package/dist/ui/input.d.ts.map +1 -0
- package/dist/ui/input.js +8 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts +4 -0
- package/dist/ui/label.d.ts.map +1 -0
- package/dist/ui/label.js +9 -0
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/multi-select.d.ts +32 -0
- package/dist/ui/multi-select.d.ts.map +1 -0
- package/dist/ui/multi-select.js +63 -0
- package/dist/ui/multi-select.js.map +1 -0
- package/dist/ui/page-header.d.ts +21 -0
- package/dist/ui/page-header.d.ts.map +1 -0
- package/dist/ui/page-header.js +9 -0
- package/dist/ui/page-header.js.map +1 -0
- package/dist/ui/route-tabs.d.ts +58 -0
- package/dist/ui/route-tabs.d.ts.map +1 -0
- package/dist/ui/route-tabs.js +34 -0
- package/dist/ui/route-tabs.js.map +1 -0
- package/dist/ui/save-button-group.d.ts +27 -0
- package/dist/ui/save-button-group.d.ts.map +1 -0
- package/dist/ui/save-button-group.js +44 -0
- package/dist/ui/save-button-group.js.map +1 -0
- package/dist/ui/section.d.ts +20 -0
- package/dist/ui/section.d.ts.map +1 -0
- package/dist/ui/section.js +7 -0
- package/dist/ui/section.js.map +1 -0
- package/dist/ui/select.d.ts +10 -0
- package/dist/ui/select.d.ts.map +1 -0
- package/dist/ui/select.js +15 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/separator.d.ts +3 -0
- package/dist/ui/separator.d.ts.map +1 -0
- package/dist/ui/separator.js +7 -0
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/table.d.ts +10 -0
- package/dist/ui/table.d.ts.map +1 -0
- package/dist/ui/table.js +20 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/textarea.d.ts +3 -0
- package/dist/ui/textarea.d.ts.map +1 -0
- package/dist/ui/textarea.js +8 -0
- package/dist/ui/textarea.js.map +1 -0
- package/dist/zones/AdminContributionsProvider.d.ts +72 -0
- package/dist/zones/AdminContributionsProvider.d.ts.map +1 -0
- package/dist/zones/AdminContributionsProvider.js +63 -0
- package/dist/zones/AdminContributionsProvider.js.map +1 -0
- package/dist/zones/AdminZone.d.ts +30 -0
- package/dist/zones/AdminZone.d.ts.map +1 -0
- package/dist/zones/AdminZone.js +59 -0
- package/dist/zones/AdminZone.js.map +1 -0
- package/dist/zones/RouteTabsZone.d.ts +62 -0
- package/dist/zones/RouteTabsZone.d.ts.map +1 -0
- package/dist/zones/RouteTabsZone.js +25 -0
- package/dist/zones/RouteTabsZone.js.map +1 -0
- package/dist/zones/ZoneErrorBoundary.d.ts +36 -0
- package/dist/zones/ZoneErrorBoundary.d.ts.map +1 -0
- package/dist/zones/ZoneErrorBoundary.js +44 -0
- package/dist/zones/ZoneErrorBoundary.js.map +1 -0
- package/dist/zones/index.d.ts +31 -0
- package/dist/zones/index.d.ts.map +1 -0
- package/dist/zones/index.js +27 -0
- package/dist/zones/index.js.map +1 -0
- package/dist/zones/use-admin-zone.d.ts +32 -0
- package/dist/zones/use-admin-zone.d.ts.map +1 -0
- package/dist/zones/use-admin-zone.js +96 -0
- package/dist/zones/use-admin-zone.js.map +1 -0
- package/package.json +94 -3
- package/tailwind.css +14 -0
- package/theme.css +2056 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldProtectionSummary.d.ts","sourceRoot":"","sources":["../../src/field-protection/FieldProtectionSummary.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,sBAAsB,CAAC,EACrC,MAAM,EACN,SAAS,GACV,EAAE,2BAA2B,GAAG,SAAS,CAmEzC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Boxes, Lock, ShieldCheck } from 'lucide-react';
|
|
3
|
+
import { describeFieldPath } from './describe-path.js';
|
|
4
|
+
import { useFieldProtection } from './use-field-protection.js';
|
|
5
|
+
export function FieldProtectionSummary({ source, className, }) {
|
|
6
|
+
const protection = useFieldProtection(source);
|
|
7
|
+
if (!protection.available)
|
|
8
|
+
return null;
|
|
9
|
+
const t = source.t;
|
|
10
|
+
const synced = protection.lastSyncedAt ? new Date(protection.lastSyncedAt) : null;
|
|
11
|
+
return (_jsxs("div", { className: `rounded-md border border-border bg-muted/30 px-3 py-2 text-xs ${className ?? ''}`, children: [_jsxs("div", { className: "flex flex-wrap items-center gap-x-4 gap-y-1", children: [_jsxs("span", { className: "inline-flex items-center gap-1.5 font-medium", children: [_jsx(ShieldCheck, { size: 13, "aria-hidden": "true" }), t('fieldProtection.title'), _jsx("span", { className: "opacity-70", children: source.sourceLabel })] }), protection.integrationManaged ? (_jsx("span", { className: "text-muted-foreground", children: t('fieldProtection.integrationManaged') })) : null, protection.sourceKind ? (_jsxs("span", { className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [_jsx(Boxes, { size: 13, "aria-hidden": "true" }), t(`fieldProtection.structure.${protection.sourceKind}`), protection.variantCount > 0 ? (_jsxs("span", { className: "tabular-nums", children: ["\u00B7", ' ', t('fieldProtection.structure.variantCount', { count: protection.variantCount })] })) : null] })) : null, synced && !Number.isNaN(synced.getTime()) ? (_jsxs("span", { className: "text-muted-foreground", children: [t('fieldProtection.lastSyncedAt'), ":", ' ', _jsx("time", { dateTime: protection.lastSyncedAt ?? undefined, children: synced.toLocaleString() })] })) : null] }), _jsx("p", { className: "mt-1 text-muted-foreground", children: t('fieldProtection.description') }), protection.protections.length === 0 ? (_jsx("p", { className: "mt-1 text-muted-foreground", children: t('fieldProtection.summary.none') })) : (_jsx("ul", { className: "mt-1 flex flex-wrap gap-1.5", children: protection.protections.map((entry) => (_jsxs("li", { className: "inline-flex items-center gap-1 rounded border border-border bg-background px-1.5 py-0.5", children: [_jsx(Lock, { size: 11, "aria-hidden": "true" }), entry.languageCode === null
|
|
12
|
+
? describeFieldPath(t, entry.fieldPath, protection.livePricePaths)
|
|
13
|
+
: t('fieldProtection.summary.item.language', {
|
|
14
|
+
field: describeFieldPath(t, entry.fieldPath, protection.livePricePaths),
|
|
15
|
+
language: entry.languageCode,
|
|
16
|
+
})] }, `${entry.fieldPath}|${entry.languageCode ?? ''}`))) }))] }));
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=FieldProtectionSummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldProtectionSummary.js","sourceRoot":"","sources":["../../src/field-protection/FieldProtectionSummary.tsx"],"names":[],"mappings":";AAWA,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAExD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2B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@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-field "the import may not have this" control (feature 091, P4b).
|
|
3
|
+
*
|
|
4
|
+
* Three rules it follows, unchanged from the control this generalises:
|
|
5
|
+
*
|
|
6
|
+
* - **Hidden unless the owner says a connection is enabled.** Not disabled,
|
|
7
|
+
* not shown with an explanation: an installation with no such integration
|
|
8
|
+
* has no such concept, and a permanently greyed checkbox beside every field
|
|
9
|
+
* is noise.
|
|
10
|
+
* - **Optimistic, and it puts the value back if the server refuses.** The
|
|
11
|
+
* store owns that half; see `use-field-protection.ts`.
|
|
12
|
+
* - **The write is the whole set**, because the owner's surface is a
|
|
13
|
+
* declarative replace.
|
|
14
|
+
*
|
|
15
|
+
* **It renders the source label**, which the single-integration control did not
|
|
16
|
+
* have to. Two connected integrations put two controls beside one field, and
|
|
17
|
+
* *"Protect this field: Name"* twice over tells an operator nothing about which
|
|
18
|
+
* import each one holds off.
|
|
19
|
+
*/
|
|
20
|
+
import type { ReactNode } from 'react';
|
|
21
|
+
import type { FieldProtectionSource } from './types.js';
|
|
22
|
+
export interface FieldProtectionToggleProps {
|
|
23
|
+
/** The integration that owns this control — its translator, loader and saver. */
|
|
24
|
+
readonly source: FieldProtectionSource;
|
|
25
|
+
/**
|
|
26
|
+
* `name`, `description`, `categories`, `gallery`, `attachments`,
|
|
27
|
+
* `attributeValues.<key>` or `price.<priceListId>.<currencyCode>` — the
|
|
28
|
+
* grammar the owner's server validates.
|
|
29
|
+
*/
|
|
30
|
+
readonly fieldPath: string;
|
|
31
|
+
/** Set it to protect one language and leave the others synchronising. */
|
|
32
|
+
readonly languageCode?: string | null;
|
|
33
|
+
readonly className?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function FieldProtectionToggle({ source, fieldPath, languageCode: language, className, }: FieldProtectionToggleProps): ReactNode;
|
|
36
|
+
//# sourceMappingURL=FieldProtectionToggle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldProtectionToggle.d.ts","sourceRoot":"","sources":["../../src/field-protection/FieldProtectionToggle.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAMvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,0BAA0B;IACzC,iFAAiF;IACjF,QAAQ,CAAC,MAAM,EAAE,qBAAqB,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,MAAM,EACN,SAAS,EACT,YAAY,EAAE,QAAQ,EACtB,SAAS,GACV,EAAE,0BAA0B,GAAG,SAAS,CAwDxC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Lock } from 'lucide-react';
|
|
3
|
+
import { Checkbox } from '../ui/checkbox.js';
|
|
4
|
+
import { controlIdPrefix, describeFieldPath } from './describe-path.js';
|
|
5
|
+
import { useFieldProtection } from './use-field-protection.js';
|
|
6
|
+
export function FieldProtectionToggle({ source, fieldPath, languageCode: language, className, }) {
|
|
7
|
+
const protection = useFieldProtection(source);
|
|
8
|
+
const languageCode = language ?? null;
|
|
9
|
+
const checked = protection.isProtected(fieldPath, languageCode);
|
|
10
|
+
// A whole-field protection already covers this language, so its per-language
|
|
11
|
+
// control has nothing left to say — it renders checked and inert rather than
|
|
12
|
+
// offering an unprotect that would silently widen to the whole field.
|
|
13
|
+
const coveredByWholeField = languageCode !== null && protection.isProtected(fieldPath, null);
|
|
14
|
+
if (!protection.available)
|
|
15
|
+
return null;
|
|
16
|
+
const t = source.t;
|
|
17
|
+
const id = `${controlIdPrefix(source.scopeKey)}-${fieldPath}-${languageCode ?? 'all'}`.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
18
|
+
const field = describeFieldPath(t, fieldPath, protection.livePricePaths);
|
|
19
|
+
const label = languageCode === null
|
|
20
|
+
? field
|
|
21
|
+
: t('fieldProtection.summary.item.language', { field, language: languageCode });
|
|
22
|
+
return (_jsxs("span", { className: `inline-flex items-center gap-1.5 text-xs text-muted-foreground ${className ?? ''}`, children: [_jsx(Checkbox, { id: id, checked: checked, disabled: protection.saving || coveredByWholeField,
|
|
23
|
+
// The tooltip states what operating the control *does*, which changes
|
|
24
|
+
// with its state; the accessible name below states what it is about,
|
|
25
|
+
// which does not.
|
|
26
|
+
title: checked ? t('fieldProtection.toggle.unprotect') : t('fieldProtection.toggle.protect'), onChange: (event) => {
|
|
27
|
+
void protection.setProtected(fieldPath, languageCode, event.target.checked);
|
|
28
|
+
} }), _jsxs("label", { htmlFor: id, className: "inline-flex cursor-pointer items-center gap-1", children: [_jsx(Lock, { size: 12, "aria-hidden": "true" }), _jsxs("span", { className: "sr-only", children: [t('fieldProtection.toggle.protect'), ": "] }), label, _jsx("span", { className: "opacity-70", children: source.sourceLabel })] }), protection.error ? (_jsx("span", { role: "status", className: "text-destructive", children: t('fieldProtection.saveFailed') })) : null] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=FieldProtectionToggle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FieldProtectionToggle.js","sourceRoot":"","sources":["../../src/field-protection/FieldProtectionToggle.tsx"],"names":[],"mappings":";AAoBA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2B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AC,CAAC,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,gCAAgC,CAAC,EAC5F,QAAQ,EAAE,CAAC,KAAK,EAAQ,EAAE;oBACxB,KAAK,UAAU,CAAC,YAAY,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBAC9E,CAAC,GACD,EACF,iBAAO,OAAO,EAAE,EAAE,EAAE,SAAS,EAAC,+CAA+C,aAC3E,KAAC,IAAI,IAAC,IAAI,EAAE,EAAE,iBAAc,MAAM,GAAG,EAIrC,gBAAM,SAAS,EAAC,SAAS,aAAE,CAAC,CAAC,gCAAgC,CAAC,UAAU,EACvE,KAAK,EACN,eAAM,SAAS,EAAC,YAAY,YAAE,MAAM,CAAC,WAAW,GAAQ,IAClD,EACP,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAClB,eAAM,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,kBAAkB,YAC7C,CAAC,CAAC,4BAA4B,CAAC,GAC3B,CACR,CAAC,CAAC,CAAC,IAAI,IACH,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A protection path as something an operator recognises, without opening the
|
|
3
|
+
* field (feature 091, P4b).
|
|
4
|
+
*
|
|
5
|
+
* The five bare paths below are the grammar **both** integration contracts
|
|
6
|
+
* already define, character for character, so they are the surface's rather
|
|
7
|
+
* than either owner's. Everything else is rendered through the caller's
|
|
8
|
+
* translator under a key the caller ships: an attribute key and a currency are
|
|
9
|
+
* data, and a path outside the grammar renders verbatim rather than as a
|
|
10
|
+
* missing key — a stale row is worth showing.
|
|
11
|
+
*
|
|
12
|
+
* A price path carries a price list identifier, which names nothing to a human.
|
|
13
|
+
* When the read said which lists are live the label uses the list's name; a
|
|
14
|
+
* protection on a list that no longer covers the record falls back to the
|
|
15
|
+
* currency alone.
|
|
16
|
+
*/
|
|
17
|
+
import type { FieldProtectionPricePath, Translate } from './types.js';
|
|
18
|
+
export declare function describeFieldPath(t: Translate, fieldPath: string, livePricePaths?: readonly FieldProtectionPricePath[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* A DOM id prefix for one integration's controls on one record.
|
|
21
|
+
*
|
|
22
|
+
* Derived from `scopeKey` and from nothing else, so two integrations on one
|
|
23
|
+
* screen cannot collide: a duplicate `id` makes one `htmlFor` point at the
|
|
24
|
+
* other's checkbox, which is a silently wrong control rather than a broken one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function controlIdPrefix(scopeKey: string): string;
|
|
27
|
+
//# sourceMappingURL=describe-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-path.d.ts","sourceRoot":"","sources":["../../src/field-protection/describe-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAKtE,wBAAgB,iBAAiB,CAC/B,CAAC,EAAE,SAAS,EACZ,SAAS,EAAE,MAAM,EACjB,cAAc,GAAE,SAAS,wBAAwB,EAAO,GACvD,MAAM,CAcR;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** The paths every provider spells identically, and the only ones this file knows. */
|
|
2
|
+
const SHARED_FIELD_PATHS = ['name', 'description', 'categories', 'gallery', 'attachments'];
|
|
3
|
+
export function describeFieldPath(t, fieldPath, livePricePaths = []) {
|
|
4
|
+
if (fieldPath.startsWith('attributeValues.')) {
|
|
5
|
+
return t('fieldProtection.field.attribute', {
|
|
6
|
+
key: fieldPath.slice('attributeValues.'.length),
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
if (fieldPath.startsWith('price.')) {
|
|
10
|
+
const currency = fieldPath.split('.').pop() ?? '';
|
|
11
|
+
const live = livePricePaths.find((entry) => entry.fieldPath === fieldPath);
|
|
12
|
+
return live
|
|
13
|
+
? t('fieldProtection.field.priceInList', { list: live.priceListName, currency })
|
|
14
|
+
: t('fieldProtection.field.price', { currency });
|
|
15
|
+
}
|
|
16
|
+
return SHARED_FIELD_PATHS.includes(fieldPath) ? t(`fieldProtection.field.${fieldPath}`) : fieldPath;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* A DOM id prefix for one integration's controls on one record.
|
|
20
|
+
*
|
|
21
|
+
* Derived from `scopeKey` and from nothing else, so two integrations on one
|
|
22
|
+
* screen cannot collide: a duplicate `id` makes one `htmlFor` point at the
|
|
23
|
+
* other's checkbox, which is a silently wrong control rather than a broken one.
|
|
24
|
+
*/
|
|
25
|
+
export function controlIdPrefix(scopeKey) {
|
|
26
|
+
return scopeKey.replace(/[^a-zA-Z0-9_-]/g, '-');
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=describe-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"describe-path.js","sourceRoot":"","sources":["../../src/field-protection/describe-path.ts"],"names":[],"mappings":"AAkBA,sFAAsF;AACtF,MAAM,kBAAkB,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;AAE3F,MAAM,UAAU,iBAAiB,CAC/B,CAAY,EACZ,SAAiB,EACjB,iBAAsD,EAAE;IAExD,IAAI,SAAS,CAAC,UAAU,CAAC,kBAAkB,CAAC,EAAE,CAAC;QAC7C,OAAO,CAAC,CAAC,iCAAiC,EAAE;YAC1C,GAAG,EAAE,SAAS,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,CAAC;SAChD,CAAC,CAAC;IACL,CAAC;IACD,IAAI,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;QAClD,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC;QAC3E,OAAO,IAAI;YACT,CAAC,CAAC,CAAC,CAAC,mCAAmC,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,aAAa,EAAE,QAAQ,EAAE,CAAC;YAChF,CAAC,CAAC,CAAC,CAAC,6BAA6B,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,yBAAyB,SAAS,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACtG,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC9C,OAAO,QAAQ,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@endora-commerce/admin-kit/field-protection` — the shared machinery behind
|
|
3
|
+
* "the import may not have this field" (feature 091, P4b;
|
|
4
|
+
* `contracts/admin-component-contribution.md` § P4b).
|
|
5
|
+
*
|
|
6
|
+
* ## Why it is published at all
|
|
7
|
+
*
|
|
8
|
+
* `pim_ergonode` shipped a 540-line control; `pim_pimcore`'s would have been a
|
|
9
|
+
* 559-line near-copy — **61 diff lines** once the vendor name is normalised.
|
|
10
|
+
* Converting them as two packages would have made that duplication *published*,
|
|
11
|
+
* and on a platform carrying both PIMs it would have put two whole
|
|
12
|
+
* implementations of one concept beside every product field. One kit surface,
|
|
13
|
+
* two thin contributors, one control per connected integration.
|
|
14
|
+
*
|
|
15
|
+
* ## Where the R6 line falls
|
|
16
|
+
*
|
|
17
|
+
* Everything here is generic: the per-scope store, the mount de-duplication,
|
|
18
|
+
* the optimistic write and its rollback, the rendering, and the five field
|
|
19
|
+
* paths both integration contracts spell identically. Nothing here names an
|
|
20
|
+
* integration, imports one's client, or branches on an id.
|
|
21
|
+
*
|
|
22
|
+
* What arrives **by prop, from the caller that owns it** is
|
|
23
|
+
* {@link FieldProtectionSource}: the loader, the saver, the translator (its
|
|
24
|
+
* i18n namespace) and its source label, plus the scope key that keeps two
|
|
25
|
+
* integrations' state apart. That is `admin-kit-surface.md` R6 as extended on
|
|
26
|
+
* 2026-08-31 — *the kit may receive behaviour from the caller that owns it* —
|
|
27
|
+
* and it is not P2's rejected "data by prop", because here the prop-supplier
|
|
28
|
+
* **is** the owner and passing behaviour in moves nothing.
|
|
29
|
+
*
|
|
30
|
+
* A separate subpath rather than `./components`, for `./zones`' reason: this
|
|
31
|
+
* one publishes a hook whose lifetime is a module-scoped store, and a consumer
|
|
32
|
+
* naming it in an import line is legible about what it is taking.
|
|
33
|
+
*
|
|
34
|
+
* The barrel is **explicit and holds no `export *`** (R2).
|
|
35
|
+
*/
|
|
36
|
+
export { FieldProtectionPricePanel } from './FieldProtectionPricePanel.js';
|
|
37
|
+
export type { FieldProtectionPricePanelProps } from './FieldProtectionPricePanel.js';
|
|
38
|
+
export { FieldProtectionSummary } from './FieldProtectionSummary.js';
|
|
39
|
+
export type { FieldProtectionSummaryProps } from './FieldProtectionSummary.js';
|
|
40
|
+
export { FieldProtectionToggle } from './FieldProtectionToggle.js';
|
|
41
|
+
export type { FieldProtectionToggleProps } from './FieldProtectionToggle.js';
|
|
42
|
+
export { controlIdPrefix, describeFieldPath } from './describe-path.js';
|
|
43
|
+
export type { FieldProtectionEntry, FieldProtectionPricePath, FieldProtectionSource, FieldProtectionView, Translate, } from './types.js';
|
|
44
|
+
export { useFieldProtection } from './use-field-protection.js';
|
|
45
|
+
export type { FieldProtectionApi } from './use-field-protection.js';
|
|
46
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/field-protection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,YAAY,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC;AACrF,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,YAAY,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,YAAY,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,YAAY,EACV,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,EACnB,SAAS,GACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,YAAY,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@endora-commerce/admin-kit/field-protection` — the shared machinery behind
|
|
3
|
+
* "the import may not have this field" (feature 091, P4b;
|
|
4
|
+
* `contracts/admin-component-contribution.md` § P4b).
|
|
5
|
+
*
|
|
6
|
+
* ## Why it is published at all
|
|
7
|
+
*
|
|
8
|
+
* `pim_ergonode` shipped a 540-line control; `pim_pimcore`'s would have been a
|
|
9
|
+
* 559-line near-copy — **61 diff lines** once the vendor name is normalised.
|
|
10
|
+
* Converting them as two packages would have made that duplication *published*,
|
|
11
|
+
* and on a platform carrying both PIMs it would have put two whole
|
|
12
|
+
* implementations of one concept beside every product field. One kit surface,
|
|
13
|
+
* two thin contributors, one control per connected integration.
|
|
14
|
+
*
|
|
15
|
+
* ## Where the R6 line falls
|
|
16
|
+
*
|
|
17
|
+
* Everything here is generic: the per-scope store, the mount de-duplication,
|
|
18
|
+
* the optimistic write and its rollback, the rendering, and the five field
|
|
19
|
+
* paths both integration contracts spell identically. Nothing here names an
|
|
20
|
+
* integration, imports one's client, or branches on an id.
|
|
21
|
+
*
|
|
22
|
+
* What arrives **by prop, from the caller that owns it** is
|
|
23
|
+
* {@link FieldProtectionSource}: the loader, the saver, the translator (its
|
|
24
|
+
* i18n namespace) and its source label, plus the scope key that keeps two
|
|
25
|
+
* integrations' state apart. That is `admin-kit-surface.md` R6 as extended on
|
|
26
|
+
* 2026-08-31 — *the kit may receive behaviour from the caller that owns it* —
|
|
27
|
+
* and it is not P2's rejected "data by prop", because here the prop-supplier
|
|
28
|
+
* **is** the owner and passing behaviour in moves nothing.
|
|
29
|
+
*
|
|
30
|
+
* A separate subpath rather than `./components`, for `./zones`' reason: this
|
|
31
|
+
* one publishes a hook whose lifetime is a module-scoped store, and a consumer
|
|
32
|
+
* naming it in an import line is legible about what it is taking.
|
|
33
|
+
*
|
|
34
|
+
* The barrel is **explicit and holds no `export *`** (R2).
|
|
35
|
+
*/
|
|
36
|
+
export { FieldProtectionPricePanel } from './FieldProtectionPricePanel.js';
|
|
37
|
+
export { FieldProtectionSummary } from './FieldProtectionSummary.js';
|
|
38
|
+
export { FieldProtectionToggle } from './FieldProtectionToggle.js';
|
|
39
|
+
export { controlIdPrefix, describeFieldPath } from './describe-path.js';
|
|
40
|
+
export { useFieldProtection } from './use-field-protection.js';
|
|
41
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/field-protection/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAQxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The shapes the field-protection surface renders, and the descriptor the
|
|
3
|
+
* integration that owns them supplies (feature 091, P4b).
|
|
4
|
+
*
|
|
5
|
+
* **Nothing here names an integration.** The view below is the intersection of
|
|
6
|
+
* `ErgonodeProductProtectionsDto` and `PimcoreProductProtectionsDto` — the
|
|
7
|
+
* fields both contracts already carry, with the two Pimcore-only ones
|
|
8
|
+
* (`pimcoreId`, `connector`) deliberately absent, because a field only one
|
|
9
|
+
* provider has is a field this surface would have to branch on. Neither DTO is
|
|
10
|
+
* imported: a structural view is what lets a third provider arrive without this
|
|
11
|
+
* package learning its name, and both DTOs are assignable to it as they stand.
|
|
12
|
+
*
|
|
13
|
+
* `sourceKind` is a `string | null` rather than either provider's enum for the
|
|
14
|
+
* same reason. It is rendered through the caller's own translator, under the
|
|
15
|
+
* caller's own key, so the vocabulary stays where the vocabulary is defined:
|
|
16
|
+
* Ergonode ships three structural kinds and Pimcore six, and neither set is
|
|
17
|
+
* this package's to enumerate.
|
|
18
|
+
*/
|
|
19
|
+
import type { Translate } from '../lib/invoice-email-outcome.js';
|
|
20
|
+
/**
|
|
21
|
+
* The kit's one name for a scope-bound translator, re-exported rather than
|
|
22
|
+
* re-declared (R5): `./lib` already publishes it, and a second name for one
|
|
23
|
+
* type is the second answer to one question a design system exists to prevent.
|
|
24
|
+
*/
|
|
25
|
+
export type { Translate };
|
|
26
|
+
/**
|
|
27
|
+
* One protected field of one record.
|
|
28
|
+
*
|
|
29
|
+
* `languageCode: null` protects the whole field; a value protects one language
|
|
30
|
+
* and leaves the others synchronising.
|
|
31
|
+
*/
|
|
32
|
+
export interface FieldProtectionEntry {
|
|
33
|
+
readonly fieldPath: string;
|
|
34
|
+
readonly languageCode: string | null;
|
|
35
|
+
}
|
|
36
|
+
/** One price the integration could write here, named so an operator recognises it. */
|
|
37
|
+
export interface FieldProtectionPricePath {
|
|
38
|
+
/** The ready-made `price.<priceListId>.<currencyCode>` the write expects. */
|
|
39
|
+
readonly fieldPath: string;
|
|
40
|
+
readonly priceListId: string;
|
|
41
|
+
readonly priceListName: string;
|
|
42
|
+
readonly currencyCode: string;
|
|
43
|
+
}
|
|
44
|
+
/** What one integration says about one record's protections. */
|
|
45
|
+
export interface FieldProtectionView {
|
|
46
|
+
/** False hides every control: this installation has no such concept. */
|
|
47
|
+
readonly connectionEnabled: boolean;
|
|
48
|
+
readonly integrationManaged: boolean;
|
|
49
|
+
readonly lastSyncedAt: string | null;
|
|
50
|
+
/** The integration's own word for how it models this record, or `null`. */
|
|
51
|
+
readonly sourceKind: string | null;
|
|
52
|
+
readonly variantCount: number;
|
|
53
|
+
readonly livePricePaths: readonly FieldProtectionPricePath[];
|
|
54
|
+
readonly protections: readonly FieldProtectionEntry[];
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Everything one integration hands this surface — the whole of R6's amendment
|
|
58
|
+
* in one object.
|
|
59
|
+
*
|
|
60
|
+
* `admin-kit-surface.md` R6, as extended on 2026-08-31: *a kit component may
|
|
61
|
+
* receive behaviour — a loader, a saver, a namespace — as a prop from the
|
|
62
|
+
* caller that owns it*, because where the caller **is** the owner, passing
|
|
63
|
+
* behaviour in moves nothing. Every field below is one of those, and there is
|
|
64
|
+
* no path, no id and no branch anywhere in this directory.
|
|
65
|
+
*/
|
|
66
|
+
export interface FieldProtectionSource {
|
|
67
|
+
/**
|
|
68
|
+
* The identity of *this integration's* protections for *this record*.
|
|
69
|
+
*
|
|
70
|
+
* It keys the store, so two integrations mounted on one product each get
|
|
71
|
+
* their own state and their own single request; and it prefixes the controls'
|
|
72
|
+
* DOM ids, so two checkboxes for one field carry distinct `id`/`htmlFor`
|
|
73
|
+
* pairs. One value for both because they answer one question — "whose control
|
|
74
|
+
* is this, on what" — and two would be two chances to make them disagree.
|
|
75
|
+
*/
|
|
76
|
+
readonly scopeKey: string;
|
|
77
|
+
/**
|
|
78
|
+
* What the operator calls the integration: `Ergonode`, `Pimcore`.
|
|
79
|
+
*
|
|
80
|
+
* It is rendered beside every control, and it is why the duplication P4b
|
|
81
|
+
* removes was a *product* defect and not only a code one: with two
|
|
82
|
+
* integrations connected this surface renders two controls per field, and an
|
|
83
|
+
* operator has to be able to tell which import each one holds off.
|
|
84
|
+
*/
|
|
85
|
+
readonly sourceLabel: string;
|
|
86
|
+
/** The owner's scope-bound translator — its namespace, by prop (R6). */
|
|
87
|
+
readonly t: Translate;
|
|
88
|
+
/** Read this record's protections. Rejecting means "nothing to offer here". */
|
|
89
|
+
readonly load: () => Promise<FieldProtectionView>;
|
|
90
|
+
/** Replace the whole set, declaratively, and answer with the new state. */
|
|
91
|
+
readonly save: (protections: readonly FieldProtectionEntry[]) => Promise<FieldProtectionView>;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/field-protection/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAEjE;;;;GAIG;AACH,YAAY,EAAE,SAAS,EAAE,CAAC;AAE1B;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAED,sFAAsF;AACtF,MAAM,WAAW,wBAAwB;IACvC,6EAA6E;IAC7E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IAClC,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACvD;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,wEAAwE;IACxE,QAAQ,CAAC,CAAC,EAAE,SAAS,CAAC;IACtB,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAClD,2EAA2E;IAC3E,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC/F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/field-protection/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { FieldProtectionEntry, FieldProtectionPricePath, FieldProtectionSource } from './types.js';
|
|
2
|
+
/** Everything a control needs to render and to operate itself. */
|
|
3
|
+
export interface FieldProtectionApi {
|
|
4
|
+
/** True only once the owner has said a connection is enabled. */
|
|
5
|
+
readonly available: boolean;
|
|
6
|
+
readonly saving: boolean;
|
|
7
|
+
readonly error: string | null;
|
|
8
|
+
readonly integrationManaged: boolean;
|
|
9
|
+
readonly lastSyncedAt: string | null;
|
|
10
|
+
readonly sourceKind: string | null;
|
|
11
|
+
readonly variantCount: number;
|
|
12
|
+
readonly livePricePaths: readonly FieldProtectionPricePath[];
|
|
13
|
+
readonly protections: readonly FieldProtectionEntry[];
|
|
14
|
+
readonly isProtected: (fieldPath: string, languageCode?: string | null) => boolean;
|
|
15
|
+
readonly setProtected: (fieldPath: string, languageCode: string | null, next: boolean) => Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Subscribe to one integration's protections for one record.
|
|
19
|
+
*
|
|
20
|
+
* The effect depends on `scopeKey` alone: `load` and `save` are closures the
|
|
21
|
+
* contributor rebuilds every render, and depending on their identity would
|
|
22
|
+
* re-run the read on every parent render. They are read through a ref instead,
|
|
23
|
+
* so the newest pair is always the one that runs — which is the same guarantee
|
|
24
|
+
* a dependency array would give and none of the churn.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFieldProtection(source: FieldProtectionSource): FieldProtectionApi;
|
|
27
|
+
//# sourceMappingURL=use-field-protection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-field-protection.d.ts","sourceRoot":"","sources":["../../src/field-protection/use-field-protection.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EACV,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EAEtB,MAAM,YAAY,CAAC;AAkEpB,kEAAkE;AAClE,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAC;IACrC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,SAAS,wBAAwB,EAAE,CAAC;IAC7D,QAAQ,CAAC,WAAW,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtD,QAAQ,CAAC,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,KAAK,OAAO,CAAC;IACnF,QAAQ,CAAC,YAAY,EAAE,CACrB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,GAAG,IAAI,EAC3B,IAAI,EAAE,OAAO,KACV,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,qBAAqB,GAAG,kBAAkB,CAsEpF"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The per-scope store, the mount de-duplication and the optimistic write with
|
|
3
|
+
* its rollback (feature 091, P4b) — the three things that were generic in the
|
|
4
|
+
* 540-line control `pim_ergonode` shipped and the 559-line near-copy
|
|
5
|
+
* `pim_pimcore` was going to.
|
|
6
|
+
*
|
|
7
|
+
* ## Why a module-scoped store and not a React context
|
|
8
|
+
*
|
|
9
|
+
* The controls belong **next to the fields**, which means a dozen of them
|
|
10
|
+
* render on one product, in four tabs of a screen the integration does not own.
|
|
11
|
+
* A context would have to wrap that screen's tree, and the wrap would be a
|
|
12
|
+
* larger and more invasive edit to somebody else's component than the controls
|
|
13
|
+
* themselves. As a zone contribution the point is sharper still: a contributor
|
|
14
|
+
* is mounted by the host, at twelve independent mount points, and has nowhere
|
|
15
|
+
* to put a provider above them.
|
|
16
|
+
*
|
|
17
|
+
* So the state lives here, keyed by `scopeKey`: every control on one record and
|
|
18
|
+
* one integration subscribes to the same entry, the first to mount triggers the
|
|
19
|
+
* single read, and the rest await the same promise. **Two integrations on one
|
|
20
|
+
* product are two keys**, which is what stops the pair sharing a view neither
|
|
21
|
+
* of them produced.
|
|
22
|
+
*
|
|
23
|
+
* ## What is *not* here
|
|
24
|
+
*
|
|
25
|
+
* No HTTP. `load` and `save` are the owner's functions, closing over the
|
|
26
|
+
* owner's own admin client (R6's amendment). The one policy this file does keep
|
|
27
|
+
* is what a rejected `load` means: not configured, not permitted, or
|
|
28
|
+
* unreachable all mean the same thing to a control that is an *addition* —
|
|
29
|
+
* there is nothing to offer here — and that is a property of the surface rather
|
|
30
|
+
* than of any one integration.
|
|
31
|
+
*/
|
|
32
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
33
|
+
const INITIAL = { status: 'loading', view: null, saving: false, error: null };
|
|
34
|
+
/**
|
|
35
|
+
* Keyed by `scopeKey`, so the controls of one integration on one record share
|
|
36
|
+
* one request. An entry is dropped when its last subscriber unmounts, which is
|
|
37
|
+
* what stops a long admin session accumulating one per record ever opened — and
|
|
38
|
+
* what makes a re-opened editor refetch rather than render yesterday's answer.
|
|
39
|
+
*/
|
|
40
|
+
const STORES = new Map();
|
|
41
|
+
function storeFor(scopeKey) {
|
|
42
|
+
const existing = STORES.get(scopeKey);
|
|
43
|
+
if (existing)
|
|
44
|
+
return existing;
|
|
45
|
+
const created = { state: INITIAL, listeners: new Set(), loading: null };
|
|
46
|
+
STORES.set(scopeKey, created);
|
|
47
|
+
return created;
|
|
48
|
+
}
|
|
49
|
+
function publish(store, next) {
|
|
50
|
+
store.state = { ...store.state, ...next };
|
|
51
|
+
for (const listener of store.listeners)
|
|
52
|
+
listener();
|
|
53
|
+
}
|
|
54
|
+
function beginLoad(scopeKey, load) {
|
|
55
|
+
const store = storeFor(scopeKey);
|
|
56
|
+
if (store.loading)
|
|
57
|
+
return store.loading;
|
|
58
|
+
store.loading = (async () => {
|
|
59
|
+
try {
|
|
60
|
+
publish(store, { status: 'ready', view: await load(), error: null });
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
// Not configured, not permitted, or unreachable. All three mean the same
|
|
64
|
+
// thing to this surface: there is nothing to offer here. It is not a
|
|
65
|
+
// swallowed failure of the host's own work — the control is an addition,
|
|
66
|
+
// and an addition that cannot load renders nothing.
|
|
67
|
+
publish(store, { status: 'unavailable', view: null, error: null });
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
store.loading = null;
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
return store.loading;
|
|
74
|
+
}
|
|
75
|
+
/** Equality on the primary key of a protection row. */
|
|
76
|
+
function sameEntry(entry, fieldPath, languageCode) {
|
|
77
|
+
return entry.fieldPath === fieldPath && (entry.languageCode ?? null) === languageCode;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Subscribe to one integration's protections for one record.
|
|
81
|
+
*
|
|
82
|
+
* The effect depends on `scopeKey` alone: `load` and `save` are closures the
|
|
83
|
+
* contributor rebuilds every render, and depending on their identity would
|
|
84
|
+
* re-run the read on every parent render. They are read through a ref instead,
|
|
85
|
+
* so the newest pair is always the one that runs — which is the same guarantee
|
|
86
|
+
* a dependency array would give and none of the churn.
|
|
87
|
+
*/
|
|
88
|
+
export function useFieldProtection(source) {
|
|
89
|
+
const [, forceRender] = useState(0);
|
|
90
|
+
const behaviour = useRef(source);
|
|
91
|
+
behaviour.current = source;
|
|
92
|
+
const { scopeKey } = source;
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const store = storeFor(scopeKey);
|
|
95
|
+
const listener = () => forceRender((tick) => tick + 1);
|
|
96
|
+
store.listeners.add(listener);
|
|
97
|
+
if (store.state === INITIAL)
|
|
98
|
+
void beginLoad(scopeKey, () => behaviour.current.load());
|
|
99
|
+
return () => {
|
|
100
|
+
store.listeners.delete(listener);
|
|
101
|
+
if (store.listeners.size === 0)
|
|
102
|
+
STORES.delete(scopeKey);
|
|
103
|
+
};
|
|
104
|
+
}, [scopeKey]);
|
|
105
|
+
const state = STORES.get(scopeKey)?.state ?? INITIAL;
|
|
106
|
+
const isProtected = useCallback((fieldPath, languageCode) => {
|
|
107
|
+
const entries = state.view?.protections ?? [];
|
|
108
|
+
// A whole-field protection covers every language, so a per-language
|
|
109
|
+
// control renders as checked under it.
|
|
110
|
+
if (entries.some((entry) => sameEntry(entry, fieldPath, null)))
|
|
111
|
+
return true;
|
|
112
|
+
if (languageCode == null)
|
|
113
|
+
return false;
|
|
114
|
+
return entries.some((entry) => sameEntry(entry, fieldPath, languageCode));
|
|
115
|
+
}, [state.view]);
|
|
116
|
+
const setProtected = useCallback(async (fieldPath, languageCode, next) => {
|
|
117
|
+
const store = STORES.get(scopeKey);
|
|
118
|
+
if (!store?.state.view)
|
|
119
|
+
return;
|
|
120
|
+
const previous = store.state.view;
|
|
121
|
+
const desired = next
|
|
122
|
+
? [...previous.protections, { fieldPath, languageCode }]
|
|
123
|
+
: previous.protections.filter((entry) => !sameEntry(entry, fieldPath, languageCode));
|
|
124
|
+
// Optimistic: the checkbox moves now. A control that waits for a round
|
|
125
|
+
// trip feels broken, and one that stays moved after a refusal lies — so
|
|
126
|
+
// the rollback below is not defensive, it is the other half of this.
|
|
127
|
+
publish(store, { view: { ...previous, protections: desired }, saving: true, error: null });
|
|
128
|
+
try {
|
|
129
|
+
publish(store, { view: await behaviour.current.save(desired), saving: false });
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
publish(store, { view: previous, saving: false, error: 'save_failed' });
|
|
133
|
+
}
|
|
134
|
+
}, [scopeKey]);
|
|
135
|
+
return useMemo(() => ({
|
|
136
|
+
available: state.status === 'ready' && state.view?.connectionEnabled === true,
|
|
137
|
+
saving: state.saving,
|
|
138
|
+
error: state.error,
|
|
139
|
+
integrationManaged: state.view?.integrationManaged === true,
|
|
140
|
+
lastSyncedAt: state.view?.lastSyncedAt ?? null,
|
|
141
|
+
sourceKind: state.view?.sourceKind ?? null,
|
|
142
|
+
variantCount: state.view?.variantCount ?? 0,
|
|
143
|
+
livePricePaths: state.view?.livePricePaths ?? [],
|
|
144
|
+
protections: state.view?.protections ?? [],
|
|
145
|
+
isProtected,
|
|
146
|
+
setProtected,
|
|
147
|
+
}), [state, isProtected, setProtected]);
|
|
148
|
+
}
|
|
149
|
+
//# sourceMappingURL=use-field-protection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-field-protection.js","sourceRoot":"","sources":["../../src/field-protection/use-field-protection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAgB1E,MAAM,OAAO,GAAoB,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAQ/F;;;;;GAKG;AACH,MAAM,MAAM,GAAG,IAAI,GAAG,EAA2B,CAAC;AAElD,SAAS,QAAQ,CAAC,QAAgB;IAChC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IAC9B,MAAM,OAAO,GAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,GAAG,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IACzF,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,OAAO,CAAC,KAAsB,EAAE,IAA8B;IACrE,KAAK,CAAC,KAAK,GAAG,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,GAAG,IAAI,EAAE,CAAC;IAC1C,KAAK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CAAC;IACH,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,OAAO,CACZ,GAAG,EAAE,CAAC,CAAC;QACL,SAAS,EAAE,KAAK,CAAC,MAAM,KAAK,OAAO,IAAI,KAAK,CAAC,IAAI,EAAE,iBAAiB,KAAK,IAAI;QAC7E,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,kBAAkB,EAAE,KAAK,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI;QAC3D,YAAY,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,IAAI,IAAI;QAC9C,UAAU,EAAE,KAAK,CAAC,IAAI,EAAE,UAAU,IAAI,IAAI;QAC1C,YAAY,EAAE,KAAK,CAAC,IAAI,EAAE,YAAY,IAAI,CAAC;QAC3C,cAAc,EAAE,KAAK,CAAC,IAAI,EAAE,cAAc,IAAI,EAAE;QAChD,WAAW,EAAE,KAAK,CAAC,IAAI,EAAE,WAAW,IAAI,EAAE;QAC1C,WAAW;QACX,YAAY;KACb,CAAC,EACF,CAAC,KAAK,EAAE,WAAW,EAAE,YAAY,CAAC,CACnC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Bundle, SupportedAdminLanguage } from './types.js';
|
|
3
|
+
export interface TranslationProviderProps {
|
|
4
|
+
/** Current language; flips when the user changes their preference. */
|
|
5
|
+
language: SupportedAdminLanguage;
|
|
6
|
+
/**
|
|
7
|
+
* Optional pre-supplied bundle. When provided the provider skips its
|
|
8
|
+
* boot fetch and uses this value (used by interaction tests and by
|
|
9
|
+
* the pre-auth login screen which has no auth to call the endpoint).
|
|
10
|
+
*/
|
|
11
|
+
initialBundle?: Bundle;
|
|
12
|
+
/** Optional pre-supplied EN bundle for cross-language fallback (FR-013). */
|
|
13
|
+
initialFallbackBundle?: Bundle;
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
interface TranslationContextValue {
|
|
17
|
+
language: SupportedAdminLanguage;
|
|
18
|
+
bundle: Bundle;
|
|
19
|
+
fallbackBundle: Bundle | undefined;
|
|
20
|
+
/** Translate a key under a module-scoped namespace (defaults to `core`). */
|
|
21
|
+
t(scope: string, key: string, params?: Record<string, string | number>): string;
|
|
22
|
+
}
|
|
23
|
+
export declare function TranslationProvider(props: TranslationProviderProps): ReactNode;
|
|
24
|
+
/** Internal accessor — `useTranslation` is the public-facing wrapper. */
|
|
25
|
+
export declare function useTranslationContext(): TranslationContextValue;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=TranslationProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranslationProvider.d.ts","sourceRoot":"","sources":["../../src/i18n/TranslationProvider.tsx"],"names":[],"mappings":"AAaA,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,MAAM,EAEN,sBAAsB,EACvB,MAAM,YAAY,CAAC;AAIpB,MAAM,WAAW,wBAAwB;IACvC,sEAAsE;IACtE,QAAQ,EAAE,sBAAsB,CAAC;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,UAAU,uBAAuB;IAC/B,QAAQ,EAAE,sBAAsB,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,4EAA4E;IAC5E,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;CACjF;AA8CD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,GAAG,SAAS,CAmF9E;AAED,yEAAyE;AACzE,wBAAgB,qBAAqB,IAAI,uBAAuB,CAQ/D"}
|