@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.
Files changed (449) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +212 -2
  3. package/dist/components/FileDropzone.d.ts +13 -0
  4. package/dist/components/FileDropzone.d.ts.map +1 -0
  5. package/dist/components/FileDropzone.js +39 -0
  6. package/dist/components/FileDropzone.js.map +1 -0
  7. package/dist/components/PaginationFooter.d.ts +25 -0
  8. package/dist/components/PaginationFooter.d.ts.map +1 -0
  9. package/dist/components/PaginationFooter.js +33 -0
  10. package/dist/components/PaginationFooter.js.map +1 -0
  11. package/dist/components/ResponsiveTable.d.ts +26 -0
  12. package/dist/components/ResponsiveTable.d.ts.map +1 -0
  13. package/dist/components/ResponsiveTable.js +34 -0
  14. package/dist/components/ResponsiveTable.js.map +1 -0
  15. package/dist/components/RowActionMenu.d.ts +40 -0
  16. package/dist/components/RowActionMenu.d.ts.map +1 -0
  17. package/dist/components/RowActionMenu.js +15 -0
  18. package/dist/components/RowActionMenu.js.map +1 -0
  19. package/dist/components/StickyFormActions.d.ts +10 -0
  20. package/dist/components/StickyFormActions.d.ts.map +1 -0
  21. package/dist/components/StickyFormActions.js +10 -0
  22. package/dist/components/StickyFormActions.js.map +1 -0
  23. package/dist/components/TouchReorderButtons.d.ts +13 -0
  24. package/dist/components/TouchReorderButtons.d.ts.map +1 -0
  25. package/dist/components/TouchReorderButtons.js +12 -0
  26. package/dist/components/TouchReorderButtons.js.map +1 -0
  27. package/dist/components/admin-user-picker/AdminUserPicker.d.ts +14 -0
  28. package/dist/components/admin-user-picker/AdminUserPicker.d.ts.map +1 -0
  29. package/dist/components/admin-user-picker/AdminUserPicker.js +68 -0
  30. package/dist/components/admin-user-picker/AdminUserPicker.js.map +1 -0
  31. package/dist/components/asset-picker/AssetFieldPicker.d.ts +32 -0
  32. package/dist/components/asset-picker/AssetFieldPicker.d.ts.map +1 -0
  33. package/dist/components/asset-picker/AssetFieldPicker.js +42 -0
  34. package/dist/components/asset-picker/AssetFieldPicker.js.map +1 -0
  35. package/dist/components/asset-picker/AssetPicker.d.ts +31 -0
  36. package/dist/components/asset-picker/AssetPicker.d.ts.map +1 -0
  37. package/dist/components/asset-picker/AssetPicker.js +68 -0
  38. package/dist/components/asset-picker/AssetPicker.js.map +1 -0
  39. package/dist/components/asset-picker/AssetUploader.d.ts +15 -0
  40. package/dist/components/asset-picker/AssetUploader.d.ts.map +1 -0
  41. package/dist/components/asset-picker/AssetUploader.js +61 -0
  42. package/dist/components/asset-picker/AssetUploader.js.map +1 -0
  43. package/dist/components/asset-picker/assets-api.d.ts +49 -0
  44. package/dist/components/asset-picker/assets-api.d.ts.map +1 -0
  45. package/dist/components/asset-picker/assets-api.js +67 -0
  46. package/dist/components/asset-picker/assets-api.js.map +1 -0
  47. package/dist/components/category-picker/CategorySelect.d.ts +14 -0
  48. package/dist/components/category-picker/CategorySelect.d.ts.map +1 -0
  49. package/dist/components/category-picker/CategorySelect.js +41 -0
  50. package/dist/components/category-picker/CategorySelect.js.map +1 -0
  51. package/dist/components/category-tree-picker/CategoryTreeNodeRow.d.ts +18 -0
  52. package/dist/components/category-tree-picker/CategoryTreeNodeRow.d.ts.map +1 -0
  53. package/dist/components/category-tree-picker/CategoryTreeNodeRow.js +19 -0
  54. package/dist/components/category-tree-picker/CategoryTreeNodeRow.js.map +1 -0
  55. package/dist/components/category-tree-picker/CategoryTreePicker.d.ts +23 -0
  56. package/dist/components/category-tree-picker/CategoryTreePicker.d.ts.map +1 -0
  57. package/dist/components/category-tree-picker/CategoryTreePicker.js +82 -0
  58. package/dist/components/category-tree-picker/CategoryTreePicker.js.map +1 -0
  59. package/dist/components/category-tree-picker/category-tree-utils.d.ts +35 -0
  60. package/dist/components/category-tree-picker/category-tree-utils.d.ts.map +1 -0
  61. package/dist/components/category-tree-picker/category-tree-utils.js +140 -0
  62. package/dist/components/category-tree-picker/category-tree-utils.js.map +1 -0
  63. package/dist/components/category-tree-picker/index.d.ts +4 -0
  64. package/dist/components/category-tree-picker/index.d.ts.map +1 -0
  65. package/dist/components/category-tree-picker/index.js +2 -0
  66. package/dist/components/category-tree-picker/index.js.map +1 -0
  67. package/dist/components/charts/echart.d.ts +17 -0
  68. package/dist/components/charts/echart.d.ts.map +1 -0
  69. package/dist/components/charts/echart.js +61 -0
  70. package/dist/components/charts/echart.js.map +1 -0
  71. package/dist/components/cms-picker/CmsBlockPicker.d.ts +14 -0
  72. package/dist/components/cms-picker/CmsBlockPicker.d.ts.map +1 -0
  73. package/dist/components/cms-picker/CmsBlockPicker.js +40 -0
  74. package/dist/components/cms-picker/CmsBlockPicker.js.map +1 -0
  75. package/dist/components/cms-picker/CmsPagePicker.d.ts +15 -0
  76. package/dist/components/cms-picker/CmsPagePicker.d.ts.map +1 -0
  77. package/dist/components/cms-picker/CmsPagePicker.js +80 -0
  78. package/dist/components/cms-picker/CmsPagePicker.js.map +1 -0
  79. package/dist/components/content-language-tabs/ContentLanguageTabs.d.ts +30 -0
  80. package/dist/components/content-language-tabs/ContentLanguageTabs.d.ts.map +1 -0
  81. package/dist/components/content-language-tabs/ContentLanguageTabs.js +14 -0
  82. package/dist/components/content-language-tabs/ContentLanguageTabs.js.map +1 -0
  83. package/dist/components/country-select/CountrySelect.d.ts +29 -0
  84. package/dist/components/country-select/CountrySelect.d.ts.map +1 -0
  85. package/dist/components/country-select/CountrySelect.js +40 -0
  86. package/dist/components/country-select/CountrySelect.js.map +1 -0
  87. package/dist/components/country-select/index.d.ts +3 -0
  88. package/dist/components/country-select/index.d.ts.map +1 -0
  89. package/dist/components/country-select/index.js +3 -0
  90. package/dist/components/country-select/index.js.map +1 -0
  91. package/dist/components/country-select/useCountriesQuery.d.ts +12 -0
  92. package/dist/components/country-select/useCountriesQuery.d.ts.map +1 -0
  93. package/dist/components/country-select/useCountriesQuery.js +69 -0
  94. package/dist/components/country-select/useCountriesQuery.js.map +1 -0
  95. package/dist/components/custom-field-values/CustomFieldValuesPanel.d.ts +48 -0
  96. package/dist/components/custom-field-values/CustomFieldValuesPanel.d.ts.map +1 -0
  97. package/dist/components/custom-field-values/CustomFieldValuesPanel.js +122 -0
  98. package/dist/components/custom-field-values/CustomFieldValuesPanel.js.map +1 -0
  99. package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts +14 -0
  100. package/dist/components/customer-group-picker/CustomerGroupPicker.d.ts.map +1 -0
  101. package/dist/components/customer-group-picker/CustomerGroupPicker.js +36 -0
  102. package/dist/components/customer-group-picker/CustomerGroupPicker.js.map +1 -0
  103. package/dist/components/customer-picker/CustomerPicker.d.ts +18 -0
  104. package/dist/components/customer-picker/CustomerPicker.d.ts.map +1 -0
  105. package/dist/components/customer-picker/CustomerPicker.js +85 -0
  106. package/dist/components/customer-picker/CustomerPicker.js.map +1 -0
  107. package/dist/components/dictionary-picker/CountryPicker.d.ts +26 -0
  108. package/dist/components/dictionary-picker/CountryPicker.d.ts.map +1 -0
  109. package/dist/components/dictionary-picker/CountryPicker.js +29 -0
  110. package/dist/components/dictionary-picker/CountryPicker.js.map +1 -0
  111. package/dist/components/dictionary-picker/CurrencyPicker.d.ts +17 -0
  112. package/dist/components/dictionary-picker/CurrencyPicker.d.ts.map +1 -0
  113. package/dist/components/dictionary-picker/CurrencyPicker.js +29 -0
  114. package/dist/components/dictionary-picker/CurrencyPicker.js.map +1 -0
  115. package/dist/components/dictionary-picker/dictionary-api.d.ts +21 -0
  116. package/dist/components/dictionary-picker/dictionary-api.d.ts.map +1 -0
  117. package/dist/components/dictionary-picker/dictionary-api.js +26 -0
  118. package/dist/components/dictionary-picker/dictionary-api.js.map +1 -0
  119. package/dist/components/dictionary-picker/index.d.ts +4 -0
  120. package/dist/components/dictionary-picker/index.d.ts.map +1 -0
  121. package/dist/components/dictionary-picker/index.js +4 -0
  122. package/dist/components/dictionary-picker/index.js.map +1 -0
  123. package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.d.ts +49 -0
  124. package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.d.ts.map +1 -0
  125. package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.js +43 -0
  126. package/dist/components/fulfilment-strategy-picker/FulfilmentStrategyPicker.js.map +1 -0
  127. package/dist/components/hooks/useFocusTrap.d.ts +6 -0
  128. package/dist/components/hooks/useFocusTrap.d.ts.map +1 -0
  129. package/dist/components/hooks/useFocusTrap.js +41 -0
  130. package/dist/components/hooks/useFocusTrap.js.map +1 -0
  131. package/dist/components/hooks/useViewportTier.d.ts +7 -0
  132. package/dist/components/hooks/useViewportTier.d.ts.map +1 -0
  133. package/dist/components/hooks/useViewportTier.js +23 -0
  134. package/dist/components/hooks/useViewportTier.js.map +1 -0
  135. package/dist/components/index.d.ts +101 -0
  136. package/dist/components/index.d.ts.map +1 -0
  137. package/dist/components/index.js +63 -0
  138. package/dist/components/index.js.map +1 -0
  139. package/dist/components/organization-picker/OrganizationPicker.d.ts +28 -0
  140. package/dist/components/organization-picker/OrganizationPicker.d.ts.map +1 -0
  141. package/dist/components/organization-picker/OrganizationPicker.js +35 -0
  142. package/dist/components/organization-picker/OrganizationPicker.js.map +1 -0
  143. package/dist/components/organization-picker/OrganizationPickerMulti.d.ts +32 -0
  144. package/dist/components/organization-picker/OrganizationPickerMulti.d.ts.map +1 -0
  145. package/dist/components/organization-picker/OrganizationPickerMulti.js +55 -0
  146. package/dist/components/organization-picker/OrganizationPickerMulti.js.map +1 -0
  147. package/dist/components/organization-picker/OrganizationStatusBadge.d.ts +7 -0
  148. package/dist/components/organization-picker/OrganizationStatusBadge.d.ts.map +1 -0
  149. package/dist/components/organization-picker/OrganizationStatusBadge.js +33 -0
  150. package/dist/components/organization-picker/OrganizationStatusBadge.js.map +1 -0
  151. package/dist/components/organization-picker/useOrganizationsQuery.d.ts +33 -0
  152. package/dist/components/organization-picker/useOrganizationsQuery.d.ts.map +1 -0
  153. package/dist/components/organization-picker/useOrganizationsQuery.js +92 -0
  154. package/dist/components/organization-picker/useOrganizationsQuery.js.map +1 -0
  155. package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts +38 -0
  156. package/dist/components/payment-method-availability/MethodAvailabilityCell.d.ts.map +1 -0
  157. package/dist/components/payment-method-availability/MethodAvailabilityCell.js +50 -0
  158. package/dist/components/payment-method-availability/MethodAvailabilityCell.js.map +1 -0
  159. package/dist/components/product-picker/ProductPicker.d.ts +22 -0
  160. package/dist/components/product-picker/ProductPicker.d.ts.map +1 -0
  161. package/dist/components/product-picker/ProductPicker.js +143 -0
  162. package/dist/components/product-picker/ProductPicker.js.map +1 -0
  163. package/dist/components/reorder/ReorderAnnouncer.d.ts +29 -0
  164. package/dist/components/reorder/ReorderAnnouncer.d.ts.map +1 -0
  165. package/dist/components/reorder/ReorderAnnouncer.js +6 -0
  166. package/dist/components/reorder/ReorderAnnouncer.js.map +1 -0
  167. package/dist/components/reorder/useReorderList.d.ts +121 -0
  168. package/dist/components/reorder/useReorderList.d.ts.map +1 -0
  169. package/dist/components/reorder/useReorderList.js +241 -0
  170. package/dist/components/reorder/useReorderList.js.map +1 -0
  171. package/dist/components/rule-builder/RuleBuilder.d.ts +105 -0
  172. package/dist/components/rule-builder/RuleBuilder.d.ts.map +1 -0
  173. package/dist/components/rule-builder/RuleBuilder.js +138 -0
  174. package/dist/components/rule-builder/RuleBuilder.js.map +1 -0
  175. package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts +15 -0
  176. package/dist/components/sales-channel-picker/SalesChannelPicker.d.ts.map +1 -0
  177. package/dist/components/sales-channel-picker/SalesChannelPicker.js +79 -0
  178. package/dist/components/sales-channel-picker/SalesChannelPicker.js.map +1 -0
  179. package/dist/components/scope-notice/ScopeNotice.d.ts +33 -0
  180. package/dist/components/scope-notice/ScopeNotice.d.ts.map +1 -0
  181. package/dist/components/scope-notice/ScopeNotice.js +11 -0
  182. package/dist/components/scope-notice/ScopeNotice.js.map +1 -0
  183. package/dist/components/scope-picker/ScopePicker.d.ts +28 -0
  184. package/dist/components/scope-picker/ScopePicker.d.ts.map +1 -0
  185. package/dist/components/scope-picker/ScopePicker.js +114 -0
  186. package/dist/components/scope-picker/ScopePicker.js.map +1 -0
  187. package/dist/components/scope-picker/sales-channels-api.d.ts +19 -0
  188. package/dist/components/scope-picker/sales-channels-api.d.ts.map +1 -0
  189. package/dist/components/scope-picker/sales-channels-api.js +30 -0
  190. package/dist/components/scope-picker/sales-channels-api.js.map +1 -0
  191. package/dist/components/status-transition-graph/StatusTransitionGraph.d.ts +26 -0
  192. package/dist/components/status-transition-graph/StatusTransitionGraph.d.ts.map +1 -0
  193. package/dist/components/status-transition-graph/StatusTransitionGraph.js +241 -0
  194. package/dist/components/status-transition-graph/StatusTransitionGraph.js.map +1 -0
  195. package/dist/components/status-transition-graph/index.d.ts +3 -0
  196. package/dist/components/status-transition-graph/index.d.ts.map +1 -0
  197. package/dist/components/status-transition-graph/index.js +2 -0
  198. package/dist/components/status-transition-graph/index.js.map +1 -0
  199. package/dist/contributions/index.d.ts +44 -0
  200. package/dist/contributions/index.d.ts.map +1 -0
  201. package/dist/contributions/index.js +42 -0
  202. package/dist/contributions/index.js.map +1 -0
  203. package/dist/contributions/zone-component.d.ts +70 -0
  204. package/dist/contributions/zone-component.d.ts.map +1 -0
  205. package/dist/contributions/zone-component.js +26 -0
  206. package/dist/contributions/zone-component.js.map +1 -0
  207. package/dist/field-protection/FieldProtectionPricePanel.d.ts +26 -0
  208. package/dist/field-protection/FieldProtectionPricePanel.d.ts.map +1 -0
  209. package/dist/field-protection/FieldProtectionPricePanel.js +14 -0
  210. package/dist/field-protection/FieldProtectionPricePanel.js.map +1 -0
  211. package/dist/field-protection/FieldProtectionSummary.d.ts +18 -0
  212. package/dist/field-protection/FieldProtectionSummary.d.ts.map +1 -0
  213. package/dist/field-protection/FieldProtectionSummary.js +18 -0
  214. package/dist/field-protection/FieldProtectionSummary.js.map +1 -0
  215. package/dist/field-protection/FieldProtectionToggle.d.ts +36 -0
  216. package/dist/field-protection/FieldProtectionToggle.d.ts.map +1 -0
  217. package/dist/field-protection/FieldProtectionToggle.js +30 -0
  218. package/dist/field-protection/FieldProtectionToggle.js.map +1 -0
  219. package/dist/field-protection/describe-path.d.ts +27 -0
  220. package/dist/field-protection/describe-path.d.ts.map +1 -0
  221. package/dist/field-protection/describe-path.js +28 -0
  222. package/dist/field-protection/describe-path.js.map +1 -0
  223. package/dist/field-protection/index.d.ts +46 -0
  224. package/dist/field-protection/index.d.ts.map +1 -0
  225. package/dist/field-protection/index.js +41 -0
  226. package/dist/field-protection/index.js.map +1 -0
  227. package/dist/field-protection/types.d.ts +93 -0
  228. package/dist/field-protection/types.d.ts.map +1 -0
  229. package/dist/field-protection/types.js +2 -0
  230. package/dist/field-protection/types.js.map +1 -0
  231. package/dist/field-protection/use-field-protection.d.ts +27 -0
  232. package/dist/field-protection/use-field-protection.d.ts.map +1 -0
  233. package/dist/field-protection/use-field-protection.js +149 -0
  234. package/dist/field-protection/use-field-protection.js.map +1 -0
  235. package/dist/i18n/TranslationProvider.d.ts +27 -0
  236. package/dist/i18n/TranslationProvider.d.ts.map +1 -0
  237. package/dist/i18n/TranslationProvider.js +130 -0
  238. package/dist/i18n/TranslationProvider.js.map +1 -0
  239. package/dist/i18n/app-language-context.d.ts +8 -0
  240. package/dist/i18n/app-language-context.d.ts.map +1 -0
  241. package/dist/i18n/app-language-context.js +13 -0
  242. package/dist/i18n/app-language-context.js.map +1 -0
  243. package/dist/i18n/index.d.ts +29 -0
  244. package/dist/i18n/index.d.ts.map +1 -0
  245. package/dist/i18n/index.js +25 -0
  246. package/dist/i18n/index.js.map +1 -0
  247. package/dist/i18n/interpolate.d.ts +2 -0
  248. package/dist/i18n/interpolate.d.ts.map +1 -0
  249. package/dist/i18n/interpolate.js +10 -0
  250. package/dist/i18n/interpolate.js.map +1 -0
  251. package/dist/i18n/language-storage.d.ts +16 -0
  252. package/dist/i18n/language-storage.d.ts.map +1 -0
  253. package/dist/i18n/language-storage.js +26 -0
  254. package/dist/i18n/language-storage.js.map +1 -0
  255. package/dist/i18n/resolver.d.ts +19 -0
  256. package/dist/i18n/resolver.d.ts.map +1 -0
  257. package/dist/i18n/resolver.js +23 -0
  258. package/dist/i18n/resolver.js.map +1 -0
  259. package/dist/i18n/types.d.ts +12 -0
  260. package/dist/i18n/types.d.ts.map +1 -0
  261. package/dist/i18n/types.js +7 -0
  262. package/dist/i18n/types.js.map +1 -0
  263. package/dist/i18n/useTranslation.d.ts +2 -0
  264. package/dist/i18n/useTranslation.d.ts.map +1 -0
  265. package/dist/i18n/useTranslation.js +16 -0
  266. package/dist/i18n/useTranslation.js.map +1 -0
  267. package/dist/lib/admin-actions/icon-map.d.ts +3 -0
  268. package/dist/lib/admin-actions/icon-map.d.ts.map +1 -0
  269. package/dist/lib/admin-actions/icon-map.js +115 -0
  270. package/dist/lib/admin-actions/icon-map.js.map +1 -0
  271. package/dist/lib/api-client.d.ts +55 -0
  272. package/dist/lib/api-client.d.ts.map +1 -0
  273. package/dist/lib/api-client.js +89 -0
  274. package/dist/lib/api-client.js.map +1 -0
  275. package/dist/lib/asset-url.d.ts +32 -0
  276. package/dist/lib/asset-url.d.ts.map +1 -0
  277. package/dist/lib/asset-url.js +42 -0
  278. package/dist/lib/asset-url.js.map +1 -0
  279. package/dist/lib/auth.d.ts +92 -0
  280. package/dist/lib/auth.d.ts.map +1 -0
  281. package/dist/lib/auth.js +133 -0
  282. package/dist/lib/auth.js.map +1 -0
  283. package/dist/lib/format.d.ts +2 -0
  284. package/dist/lib/format.d.ts.map +1 -0
  285. package/dist/lib/format.js +9 -0
  286. package/dist/lib/format.js.map +1 -0
  287. package/dist/lib/index.d.ts +46 -0
  288. package/dist/lib/index.d.ts.map +1 -0
  289. package/dist/lib/index.js +41 -0
  290. package/dist/lib/index.js.map +1 -0
  291. package/dist/lib/invoice-email-outcome.d.ts +53 -0
  292. package/dist/lib/invoice-email-outcome.d.ts.map +1 -0
  293. package/dist/lib/invoice-email-outcome.js +43 -0
  294. package/dist/lib/invoice-email-outcome.js.map +1 -0
  295. package/dist/lib/module-presence/ModulePresenceProvider.d.ts +49 -0
  296. package/dist/lib/module-presence/ModulePresenceProvider.d.ts.map +1 -0
  297. package/dist/lib/module-presence/ModulePresenceProvider.js +73 -0
  298. package/dist/lib/module-presence/ModulePresenceProvider.js.map +1 -0
  299. package/dist/lib/module-presence/api.d.ts +15 -0
  300. package/dist/lib/module-presence/api.d.ts.map +1 -0
  301. package/dist/lib/module-presence/api.js +25 -0
  302. package/dist/lib/module-presence/api.js.map +1 -0
  303. package/dist/lib/module-presence/index.d.ts +3 -0
  304. package/dist/lib/module-presence/index.d.ts.map +1 -0
  305. package/dist/lib/module-presence/index.js +3 -0
  306. package/dist/lib/module-presence/index.js.map +1 -0
  307. package/dist/lib/money.d.ts +22 -0
  308. package/dist/lib/money.d.ts.map +1 -0
  309. package/dist/lib/money.js +51 -0
  310. package/dist/lib/money.js.map +1 -0
  311. package/dist/lib/page-size-options.d.ts +15 -0
  312. package/dist/lib/page-size-options.d.ts.map +1 -0
  313. package/dist/lib/page-size-options.js +14 -0
  314. package/dist/lib/page-size-options.js.map +1 -0
  315. package/dist/lib/status-color.d.ts +32 -0
  316. package/dist/lib/status-color.d.ts.map +1 -0
  317. package/dist/lib/status-color.js +24 -0
  318. package/dist/lib/status-color.js.map +1 -0
  319. package/dist/lib/surface-visibility.d.ts +70 -0
  320. package/dist/lib/surface-visibility.d.ts.map +1 -0
  321. package/dist/lib/surface-visibility.js +37 -0
  322. package/dist/lib/surface-visibility.js.map +1 -0
  323. package/dist/lib/text-normalization.d.ts +56 -0
  324. package/dist/lib/text-normalization.d.ts.map +1 -0
  325. package/dist/lib/text-normalization.js +59 -0
  326. package/dist/lib/text-normalization.js.map +1 -0
  327. package/dist/lib/use-page-size-preference.d.ts +29 -0
  328. package/dist/lib/use-page-size-preference.d.ts.map +1 -0
  329. package/dist/lib/use-page-size-preference.js +61 -0
  330. package/dist/lib/use-page-size-preference.js.map +1 -0
  331. package/dist/lib/use-unsaved-changes-prompt.d.ts +23 -0
  332. package/dist/lib/use-unsaved-changes-prompt.d.ts.map +1 -0
  333. package/dist/lib/use-unsaved-changes-prompt.js +75 -0
  334. package/dist/lib/use-unsaved-changes-prompt.js.map +1 -0
  335. package/dist/lib/utils.d.ts +9 -0
  336. package/dist/lib/utils.d.ts.map +1 -0
  337. package/dist/lib/utils.js +12 -0
  338. package/dist/lib/utils.js.map +1 -0
  339. package/dist/lib/uuid.d.ts +8 -0
  340. package/dist/lib/uuid.d.ts.map +1 -0
  341. package/dist/lib/uuid.js +18 -0
  342. package/dist/lib/uuid.js.map +1 -0
  343. package/dist/ui/alert.d.ts +12 -0
  344. package/dist/ui/alert.d.ts.map +1 -0
  345. package/dist/ui/alert.js +22 -0
  346. package/dist/ui/alert.js.map +1 -0
  347. package/dist/ui/badge.d.ts +10 -0
  348. package/dist/ui/badge.d.ts.map +1 -0
  349. package/dist/ui/badge.js +21 -0
  350. package/dist/ui/badge.js.map +1 -0
  351. package/dist/ui/button.d.ts +12 -0
  352. package/dist/ui/button.d.ts.map +1 -0
  353. package/dist/ui/button.js +31 -0
  354. package/dist/ui/button.js.map +1 -0
  355. package/dist/ui/card.d.ts +8 -0
  356. package/dist/ui/card.d.ts.map +1 -0
  357. package/dist/ui/card.js +16 -0
  358. package/dist/ui/card.js.map +1 -0
  359. package/dist/ui/checkbox.d.ts +8 -0
  360. package/dist/ui/checkbox.d.ts.map +1 -0
  361. package/dist/ui/checkbox.js +11 -0
  362. package/dist/ui/checkbox.js.map +1 -0
  363. package/dist/ui/color-picker.d.ts +23 -0
  364. package/dist/ui/color-picker.d.ts.map +1 -0
  365. package/dist/ui/color-picker.js +76 -0
  366. package/dist/ui/color-picker.js.map +1 -0
  367. package/dist/ui/combobox.d.ts +68 -0
  368. package/dist/ui/combobox.d.ts.map +1 -0
  369. package/dist/ui/combobox.js +182 -0
  370. package/dist/ui/combobox.js.map +1 -0
  371. package/dist/ui/dropdown-menu.d.ts +26 -0
  372. package/dist/ui/dropdown-menu.d.ts.map +1 -0
  373. package/dist/ui/dropdown-menu.js +38 -0
  374. package/dist/ui/dropdown-menu.js.map +1 -0
  375. package/dist/ui/index.d.ts +47 -0
  376. package/dist/ui/index.d.ts.map +1 -0
  377. package/dist/ui/index.js +38 -0
  378. package/dist/ui/index.js.map +1 -0
  379. package/dist/ui/input.d.ts +3 -0
  380. package/dist/ui/input.d.ts.map +1 -0
  381. package/dist/ui/input.js +8 -0
  382. package/dist/ui/input.js.map +1 -0
  383. package/dist/ui/label.d.ts +4 -0
  384. package/dist/ui/label.d.ts.map +1 -0
  385. package/dist/ui/label.js +9 -0
  386. package/dist/ui/label.js.map +1 -0
  387. package/dist/ui/multi-select.d.ts +32 -0
  388. package/dist/ui/multi-select.d.ts.map +1 -0
  389. package/dist/ui/multi-select.js +63 -0
  390. package/dist/ui/multi-select.js.map +1 -0
  391. package/dist/ui/page-header.d.ts +21 -0
  392. package/dist/ui/page-header.d.ts.map +1 -0
  393. package/dist/ui/page-header.js +9 -0
  394. package/dist/ui/page-header.js.map +1 -0
  395. package/dist/ui/route-tabs.d.ts +58 -0
  396. package/dist/ui/route-tabs.d.ts.map +1 -0
  397. package/dist/ui/route-tabs.js +34 -0
  398. package/dist/ui/route-tabs.js.map +1 -0
  399. package/dist/ui/save-button-group.d.ts +27 -0
  400. package/dist/ui/save-button-group.d.ts.map +1 -0
  401. package/dist/ui/save-button-group.js +44 -0
  402. package/dist/ui/save-button-group.js.map +1 -0
  403. package/dist/ui/section.d.ts +20 -0
  404. package/dist/ui/section.d.ts.map +1 -0
  405. package/dist/ui/section.js +7 -0
  406. package/dist/ui/section.js.map +1 -0
  407. package/dist/ui/select.d.ts +10 -0
  408. package/dist/ui/select.d.ts.map +1 -0
  409. package/dist/ui/select.js +15 -0
  410. package/dist/ui/select.js.map +1 -0
  411. package/dist/ui/separator.d.ts +3 -0
  412. package/dist/ui/separator.d.ts.map +1 -0
  413. package/dist/ui/separator.js +7 -0
  414. package/dist/ui/separator.js.map +1 -0
  415. package/dist/ui/table.d.ts +10 -0
  416. package/dist/ui/table.d.ts.map +1 -0
  417. package/dist/ui/table.js +20 -0
  418. package/dist/ui/table.js.map +1 -0
  419. package/dist/ui/textarea.d.ts +3 -0
  420. package/dist/ui/textarea.d.ts.map +1 -0
  421. package/dist/ui/textarea.js +8 -0
  422. package/dist/ui/textarea.js.map +1 -0
  423. package/dist/zones/AdminContributionsProvider.d.ts +72 -0
  424. package/dist/zones/AdminContributionsProvider.d.ts.map +1 -0
  425. package/dist/zones/AdminContributionsProvider.js +63 -0
  426. package/dist/zones/AdminContributionsProvider.js.map +1 -0
  427. package/dist/zones/AdminZone.d.ts +30 -0
  428. package/dist/zones/AdminZone.d.ts.map +1 -0
  429. package/dist/zones/AdminZone.js +59 -0
  430. package/dist/zones/AdminZone.js.map +1 -0
  431. package/dist/zones/RouteTabsZone.d.ts +62 -0
  432. package/dist/zones/RouteTabsZone.d.ts.map +1 -0
  433. package/dist/zones/RouteTabsZone.js +25 -0
  434. package/dist/zones/RouteTabsZone.js.map +1 -0
  435. package/dist/zones/ZoneErrorBoundary.d.ts +36 -0
  436. package/dist/zones/ZoneErrorBoundary.d.ts.map +1 -0
  437. package/dist/zones/ZoneErrorBoundary.js +44 -0
  438. package/dist/zones/ZoneErrorBoundary.js.map +1 -0
  439. package/dist/zones/index.d.ts +31 -0
  440. package/dist/zones/index.d.ts.map +1 -0
  441. package/dist/zones/index.js +27 -0
  442. package/dist/zones/index.js.map +1 -0
  443. package/dist/zones/use-admin-zone.d.ts +32 -0
  444. package/dist/zones/use-admin-zone.d.ts.map +1 -0
  445. package/dist/zones/use-admin-zone.js +96 -0
  446. package/dist/zones/use-admin-zone.js.map +1 -0
  447. package/package.json +94 -3
  448. package/tailwind.css +14 -0
  449. package/theme.css +2056 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The sentence for one of the seven reasons an invoice e-mail did not go out
3
+ * (issue #103 named them, issue #149 put them on the wire).
4
+ */
5
+ export function invoiceEmailNotSentReason(reason, t) {
6
+ return t(`invoices.emailNotSent.${reason}`);
7
+ }
8
+ /**
9
+ * What to tell the operator who asked for a re-send, and whether it is good
10
+ * news. Both invoice surfaces reported `invoices.emailSent` unconditionally,
11
+ * over a response body that could already say the message had been suppressed.
12
+ */
13
+ export function sendInvoiceEmailMessage(result, t) {
14
+ if (result.ok)
15
+ return { ok: true, message: t('invoices.emailSent') };
16
+ return {
17
+ ok: false,
18
+ message: t('invoices.emailNotSentNotice', {
19
+ reason: invoiceEmailNotSentReason(result.reason, t),
20
+ }),
21
+ };
22
+ }
23
+ /**
24
+ * What to tell the operator after "issue invoice", given what became of the
25
+ * notification.
26
+ *
27
+ * All three answers are distinct, and the middle one matters most: send-on-issue
28
+ * being switched off is a configured choice, so it reads as a plain "issued"
29
+ * rather than as a message that failed. A missing `email` field — an older
30
+ * server, or a response shape a caller did not read — falls back to the same
31
+ * plain confirmation, which is what the screen said before it could do better.
32
+ */
33
+ export function issueInvoiceNotice(outcome, t) {
34
+ if (outcome?.status === 'sent')
35
+ return t('orderDetail.issueInvoice.doneEmailSent');
36
+ if (outcome?.status === 'not_sent') {
37
+ return t('orderDetail.issueInvoice.doneEmailNotSent', {
38
+ reason: invoiceEmailNotSentReason(outcome.reason, t),
39
+ });
40
+ }
41
+ return t('orderDetail.issueInvoice.done');
42
+ }
43
+ //# sourceMappingURL=invoice-email-outcome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-email-outcome.js","sourceRoot":"","sources":["../../src/lib/invoice-email-outcome.ts"],"names":[],"mappings":"AAkCA;;;GAGG;AACH,MAAM,UAAU,yBAAyB,CAAC,MAAiC,EAAE,CAAY;IACvF,OAAO,CAAC,CAAC,yBAAyB,MAAM,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAA8B,EAC9B,CAAY;IAEZ,IAAI,MAAM,CAAC,EAAE;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC;IACrE,OAAO;QACL,EAAE,EAAE,KAAK;QACT,OAAO,EAAE,CAAC,CAAC,6BAA6B,EAAE;YACxC,MAAM,EAAE,yBAAyB,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;SACpD,CAAC;KACH,CAAC;AACJ,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA6C,EAC7C,CAAY;IAEZ,IAAI,OAAO,EAAE,MAAM,KAAK,MAAM;QAAE,OAAO,CAAC,CAAC,wCAAwC,CAAC,CAAC;IACnF,IAAI,OAAO,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC,2CAA2C,EAAE;YACpD,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;SACrD,CAAC,CAAC;IACL,CAAC;IACD,OAAO,CAAC,CAAC,+BAA+B,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { type ReactNode } from 'react';
2
+ import type { AdminModulePresenceResponse, ModulePresence } from '@endora-commerce/contracts';
3
+ /**
4
+ * The effective enabled-set, fetched once and read by every admin surface —
5
+ * feature 073, FR-031.
6
+ *
7
+ * Constitution XVII: a module that is off contributes no sidebar entry, palette
8
+ * action, widget, tab or settings group. Both frontends resolve that from the
9
+ * server's projection; nothing here recombines the two axes, because `present`
10
+ * arrives precomputed. That is what makes "off means absent" one decision
11
+ * rather than several implementations that can disagree.
12
+ *
13
+ * Mirrors `AdminActionsProvider`: fetched on mount, refreshable on demand, no
14
+ * lifecycle pub/sub bridge on the admin side (there is none today). The one
15
+ * caller that changes presence — the activation control — calls `refresh()`
16
+ * itself, so an operator sees their own flip take effect immediately.
17
+ *
18
+ * **Fail-closed while unresolved.** Until the first response lands, `isPresent`
19
+ * answers `false` for a module it has not heard of, so a surface belonging to a
20
+ * switched-off module never flashes on screen before disappearing. The one
21
+ * exception is a failed fetch: an admin whose presence request errored would
22
+ * otherwise be left with an empty sidebar and no way to diagnose it, so a
23
+ * failure degrades to "show everything" and the gated routes 503 honestly.
24
+ */
25
+ export interface ModulePresenceContextValue {
26
+ modules: ModulePresence[];
27
+ /** `true` when the module is effectively present, i.e. safe to advertise. */
28
+ isPresent: (moduleId: string) => boolean;
29
+ /** The full record, for a surface that must render the two axes differently. */
30
+ presenceOf: (moduleId: string) => ModulePresence | undefined;
31
+ /**
32
+ * The serving process is TTL-refreshing because its pub/sub link is
33
+ * unhealthy, so this projection may lag a flip made elsewhere. Only the
34
+ * platform screen renders it — every other surface would only be able to
35
+ * report the staleness, not do anything about it.
36
+ */
37
+ degraded: boolean;
38
+ isLoading: boolean;
39
+ error: Error | null;
40
+ refresh: () => Promise<void>;
41
+ }
42
+ export interface ModulePresenceProviderProps {
43
+ /** Optional pre-supplied projection; tests use this to skip the boot fetch. */
44
+ initial?: AdminModulePresenceResponse;
45
+ children: ReactNode;
46
+ }
47
+ export declare function ModulePresenceProvider(props: ModulePresenceProviderProps): ReactNode;
48
+ export declare function useModulePresence(): ModulePresenceContextValue;
49
+ //# sourceMappingURL=ModulePresenceProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModulePresenceProvider.d.ts","sourceRoot":"","sources":["../../../src/lib/module-presence/ModulePresenceProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,2BAA2B,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAG9F;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,0BAA0B;IACzC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,6EAA6E;IAC7E,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,gFAAgF;IAChF,UAAU,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,cAAc,GAAG,SAAS,CAAC;IAC7D;;;;;OAKG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AAID,MAAM,WAAW,2BAA2B;IAC1C,+EAA+E;IAC/E,OAAO,CAAC,EAAE,2BAA2B,CAAC;IACtC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,SAAS,CA8DpF;AAED,wBAAgB,iBAAiB,IAAI,0BAA0B,CAQ9D"}
@@ -0,0 +1,73 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
3
+ import { getModulePresence } from './api.js';
4
+ const ModulePresenceContext = createContext(null);
5
+ export function ModulePresenceProvider(props) {
6
+ const { initial, children } = props;
7
+ const [modules, setModules] = useState(initial?.modules ?? []);
8
+ const [degraded, setDegraded] = useState(initial?.degraded ?? false);
9
+ const [isLoading, setIsLoading] = useState(initial == null);
10
+ const [error, setError] = useState(null);
11
+ const [tick, setTick] = useState(0);
12
+ const refresh = useCallback(async () => {
13
+ setTick((n) => n + 1);
14
+ }, []);
15
+ useEffect(() => {
16
+ if (initial != null && tick === 0)
17
+ return;
18
+ let cancelled = false;
19
+ setIsLoading(true);
20
+ void (async () => {
21
+ try {
22
+ const res = await getModulePresence();
23
+ if (cancelled)
24
+ return;
25
+ setModules(res.modules);
26
+ setDegraded(res.degraded);
27
+ setError(null);
28
+ }
29
+ catch (err) {
30
+ if (!cancelled)
31
+ setError(err instanceof Error ? err : new Error(String(err)));
32
+ if (import.meta.env.DEV) {
33
+ console.warn('[module-presence] fetch failed', err);
34
+ }
35
+ }
36
+ finally {
37
+ if (!cancelled)
38
+ setIsLoading(false);
39
+ }
40
+ })();
41
+ return () => {
42
+ cancelled = true;
43
+ };
44
+ // `initial` is a boot-time prop; re-running on its identity would refetch
45
+ // on every parent render.
46
+ // eslint-disable-next-line react-hooks/exhaustive-deps
47
+ }, [tick]);
48
+ const value = useMemo(() => {
49
+ const byId = new Map(modules.map((m) => [m.id, m]));
50
+ // A failed fetch leaves an operator with no projection at all. Hiding
51
+ // everything would be indistinguishable from a broken deployment, so this
52
+ // one case degrades open and lets the gated routes answer for themselves.
53
+ const unresolved = error !== null && modules.length === 0;
54
+ return {
55
+ modules,
56
+ isPresent: (moduleId) => byId.get(moduleId)?.present ?? unresolved,
57
+ presenceOf: (moduleId) => byId.get(moduleId),
58
+ degraded,
59
+ isLoading,
60
+ error,
61
+ refresh,
62
+ };
63
+ }, [modules, degraded, isLoading, error, refresh]);
64
+ return (_jsx(ModulePresenceContext.Provider, { value: value, children: children }));
65
+ }
66
+ export function useModulePresence() {
67
+ const ctx = useContext(ModulePresenceContext);
68
+ if (!ctx) {
69
+ throw new Error('[module-presence] useModulePresence called outside <ModulePresenceProvider>; wrap your app tree first.');
70
+ }
71
+ return ctx;
72
+ }
73
+ //# sourceMappingURL=ModulePresenceProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModulePresenceProvider.js","sourceRoot":"","sources":["../../../src/lib/module-presence/ModulePresenceProvider.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,QAAQ,GAET,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AA2C7C,MAAM,qBAAqB,GAAG,aAAa,CAAoC,IAAI,CAAC,CAAC;AAQrF,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAmB,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,CAAC;IACjF,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,QAAQ,IAAI,KAAK,CAAC,CAAC;IACrE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;IAC5D,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAe,IAAI,CAAC,CAAC;IACvD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAEpC,MAAM,OAAO,GAAG,WAAW,CAAC,KAAK,IAAmB,EAAE;QACpD,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,OAAO,IAAI,IAAI,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO;QAC1C,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,YAAY,CAAC,IAAI,CAAC,CAAC;QACnB,KAAK,CAAC,KAAK,IAAI,EAAE;YACf,IAAI,CAAC;gBACH,MAAM,GAAG,GAAG,MAAM,iBAAiB,EAAE,CAAC;gBACtC,IAAI,SAAS;oBAAE,OAAO;gBACtB,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;gBACxB,WAAW,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC1B,QAAQ,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,CAAC,SAAS;oBAAE,QAAQ,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC9E,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;oBACxB,OAAO,CAAC,IAAI,CAAC,gCAAgC,EAAE,GAAG,CAAC,CAAC;gBACtD,CAAC;YACH,CAAC;oBAAS,CAAC;gBACT,IAAI,CAAC,SAAS;oBAAE,YAAY,CAAC,KAAK,CAAC,CAAC;YACtC,CAAC;QACH,CAAC,CAAC,EAAE,CAAC;QACL,OAAO,GAAG,EAAE;YACV,SAAS,GAAG,IAAI,CAAC;QACnB,CAAC,CAAC;QACF,0EAA0E;QAC1E,0BAA0B;QAC1B,uDAAuD;IACzD,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,MAAM,KAAK,GAAG,OAAO,CAA6B,GAAG,EAAE;QACrD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACpD,sEAAsE;QACtE,0EAA0E;QAC1E,0EAA0E;QAC1E,MAAM,UAAU,GAAG,KAAK,KAAK,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC;QAC1D,OAAO;YACL,OAAO;YACP,SAAS,EAAE,CAAC,QAAgB,EAAW,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,OAAO,IAAI,UAAU;YACnF,UAAU,EAAE,CAAC,QAAgB,EAA8B,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC;YAChF,QAAQ;YACR,SAAS;YACT,KAAK;YACL,OAAO;SACR,CAAC;IACJ,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;IAEnD,OAAO,CACL,KAAC,qBAAqB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACzC,QAAQ,GACsB,CAClC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,GAAG,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;IAC9C,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,wGAAwG,CACzG,CAAC;IACJ,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { AdminModulePresenceResponse, ModuleActivationResponse } from '@endora-commerce/contracts';
2
+ /**
3
+ * The effective enabled-set, as the server computed it — feature 073.
4
+ *
5
+ * Deliberately a bare fetch, mirroring the admin-actions client: the provider
6
+ * owns caching and refresh, and there is no React Query / SWR layer in this app.
7
+ */
8
+ export declare function getModulePresence(): Promise<AdminModulePresenceResponse>;
9
+ /**
10
+ * Flip one module's operator activation. The audited Command behind this
11
+ * endpoint is the only door: the ordinary settings write path refuses an
12
+ * activation code.
13
+ */
14
+ export declare function setModuleActivation(moduleId: string, active: boolean): Promise<ModuleActivationResponse>;
15
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/lib/module-presence/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AASpC;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,2BAA2B,CAAC,CAE9E;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,wBAAwB,CAAC,CAKnC"}
@@ -0,0 +1,25 @@
1
+ // `../api-client.js`, not the `./lib` barrel the P2 components take it from.
2
+ // That rule is about a collaborator a test outside the package substitutes, and
3
+ // it cannot reach a file the barrel itself exports: measured in P3, a member
4
+ // importing `../index.js` under a `vi.mock` factory that calls `importActual`
5
+ // resolves to the **real** module — the stub is bypassed and the request goes
6
+ // out for real. The seam for this provider is its `initial` prop instead.
7
+ import { apiClient } from '../api-client.js';
8
+ /**
9
+ * The effective enabled-set, as the server computed it — feature 073.
10
+ *
11
+ * Deliberately a bare fetch, mirroring the admin-actions client: the provider
12
+ * owns caching and refresh, and there is no React Query / SWR layer in this app.
13
+ */
14
+ export async function getModulePresence() {
15
+ return apiClient.get('/api/v1/admin/module-presence');
16
+ }
17
+ /**
18
+ * Flip one module's operator activation. The audited Command behind this
19
+ * endpoint is the only door: the ordinary settings write path refuses an
20
+ * activation code.
21
+ */
22
+ export async function setModuleActivation(moduleId, active) {
23
+ return apiClient.post(`/api/v1/admin/modules/${encodeURIComponent(moduleId)}/activation`, { active });
24
+ }
25
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/lib/module-presence/api.ts"],"names":[],"mappings":"AAIA,6EAA6E;AAC7E,gFAAgF;AAChF,6EAA6E;AAC7E,8EAA8E;AAC9E,8EAA8E;AAC9E,0EAA0E;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB;IACrC,OAAO,SAAS,CAAC,GAAG,CAA8B,+BAA+B,CAAC,CAAC;AACrF,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAgB,EAChB,MAAe;IAEf,OAAO,SAAS,CAAC,IAAI,CACnB,yBAAyB,kBAAkB,CAAC,QAAQ,CAAC,aAAa,EAClE,EAAE,MAAM,EAAE,CACX,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ModulePresenceProvider, useModulePresence, type ModulePresenceContextValue, type ModulePresenceProviderProps, } from './ModulePresenceProvider.js';
2
+ export { getModulePresence, setModuleActivation } from './api.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/module-presence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ModulePresenceProvider, useModulePresence, } from './ModulePresenceProvider.js';
2
+ export { getModulePresence, setModuleActivation } from './api.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/module-presence/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,iBAAiB,GAGlB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Locale-aware money formatting for the admin panel.
3
+ *
4
+ * Amounts must render in the conventions of their currency's home country —
5
+ * e.g. PLN as `1234,56 zł` (comma decimal separator, `zł` suffix, `pl-PL`),
6
+ * USD as `$1,234.56` (`en-US`). Admin lists show records from many Sales
7
+ * Channels side by side, each carrying its own currency, so the locale is
8
+ * derived per amount from the currency itself rather than from the admin UI
9
+ * language. Pass an explicit `locale` to override (e.g. the channel's
10
+ * `defaultLanguage`).
11
+ */
12
+ export declare function localeForCurrency(currency: string): string;
13
+ /**
14
+ * Format a decimal money amount as a localized currency string.
15
+ *
16
+ * @param amount decimal amount (not minor units), e.g. `1234.56`
17
+ * @param currency ISO-4217 code, e.g. `PLN`
18
+ * @param locale optional BCP-47 locale; defaults to the currency's home
19
+ * locale so PLN renders as `1234,56 zł` regardless.
20
+ */
21
+ export declare function formatMoney(amount: number, currency: string, locale?: string): string;
22
+ //# sourceMappingURL=money.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money.d.ts","sourceRoot":"","sources":["../../src/lib/money.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqBH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAQrF"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Locale-aware money formatting for the admin panel.
3
+ *
4
+ * Amounts must render in the conventions of their currency's home country —
5
+ * e.g. PLN as `1234,56 zł` (comma decimal separator, `zł` suffix, `pl-PL`),
6
+ * USD as `$1,234.56` (`en-US`). Admin lists show records from many Sales
7
+ * Channels side by side, each carrying its own currency, so the locale is
8
+ * derived per amount from the currency itself rather than from the admin UI
9
+ * language. Pass an explicit `locale` to override (e.g. the channel's
10
+ * `defaultLanguage`).
11
+ */
12
+ /**
13
+ * Representative BCP-47 locale per ISO-4217 currency. Keeps the number and
14
+ * symbol conventions aligned with the currency's home country.
15
+ */
16
+ const LOCALE_BY_CURRENCY = {
17
+ PLN: 'pl-PL',
18
+ EUR: 'de-DE',
19
+ USD: 'en-US',
20
+ GBP: 'en-GB',
21
+ CHF: 'de-CH',
22
+ CZK: 'cs-CZ',
23
+ SEK: 'sv-SE',
24
+ NOK: 'nb-NO',
25
+ DKK: 'da-DK',
26
+ HUF: 'hu-HU',
27
+ RON: 'ro-RO',
28
+ UAH: 'uk-UA',
29
+ };
30
+ export function localeForCurrency(currency) {
31
+ return LOCALE_BY_CURRENCY[currency.toUpperCase()] ?? 'en-US';
32
+ }
33
+ /**
34
+ * Format a decimal money amount as a localized currency string.
35
+ *
36
+ * @param amount decimal amount (not minor units), e.g. `1234.56`
37
+ * @param currency ISO-4217 code, e.g. `PLN`
38
+ * @param locale optional BCP-47 locale; defaults to the currency's home
39
+ * locale so PLN renders as `1234,56 zł` regardless.
40
+ */
41
+ export function formatMoney(amount, currency, locale) {
42
+ const loc = locale && locale.trim() !== '' ? locale : localeForCurrency(currency);
43
+ try {
44
+ return new Intl.NumberFormat(loc, { style: 'currency', currency }).format(amount);
45
+ }
46
+ catch {
47
+ // Unknown/invalid currency code — fall back to a plain number + code.
48
+ return `${amount.toFixed(2)} ${currency}`;
49
+ }
50
+ }
51
+ //# sourceMappingURL=money.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"money.js","sourceRoot":"","sources":["../../src/lib/money.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH;;;GAGG;AACH,MAAM,kBAAkB,GAA2B;IACjD,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;IACZ,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD,OAAO,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,IAAI,OAAO,CAAC;AAC/D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAE,QAAgB,EAAE,MAAe;IAC3E,MAAM,GAAG,GAAG,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAClF,IAAI,CAAC;QACH,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpF,CAAC;IAAC,MAAM,CAAC;QACP,sEAAsE;QACtE,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,EAAE,CAAC;IAC5C,CAAC;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The page sizes every paginated admin list offers.
3
+ *
4
+ * It is a module of its own because the **constant** is design-system and the
5
+ * **preference** is application state. `usePageSizePreference` reads the signed-in
6
+ * admin's id to key its `localStorage` entry, so it belongs to the admin application
7
+ * and stays there (see the package README, *What Phase 1b does not publish*);
8
+ * `PaginationFooter` only needs the list of numbers to render its dropdown. Splitting
9
+ * them is what lets the footer be published without dragging the session with it, and
10
+ * it keeps exactly one list: the admin's hook re-exports these names rather than
11
+ * declaring a second array the dropdown and the validation could disagree about.
12
+ */
13
+ export declare const PAGE_SIZE_OPTIONS: readonly [5, 10, 20, 50, 100, 500];
14
+ export type PageSizeOption = (typeof PAGE_SIZE_OPTIONS)[number];
15
+ //# sourceMappingURL=page-size-options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-size-options.d.ts","sourceRoot":"","sources":["../../src/lib/page-size-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,iBAAiB,oCAAqC,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * The page sizes every paginated admin list offers.
3
+ *
4
+ * It is a module of its own because the **constant** is design-system and the
5
+ * **preference** is application state. `usePageSizePreference` reads the signed-in
6
+ * admin's id to key its `localStorage` entry, so it belongs to the admin application
7
+ * and stays there (see the package README, *What Phase 1b does not publish*);
8
+ * `PaginationFooter` only needs the list of numbers to render its dropdown. Splitting
9
+ * them is what lets the footer be published without dragging the session with it, and
10
+ * it keeps exactly one list: the admin's hook re-exports these names rather than
11
+ * declaring a second array the dropdown and the validation could disagree about.
12
+ */
13
+ export const PAGE_SIZE_OPTIONS = [5, 10, 20, 50, 100, 500];
14
+ //# sourceMappingURL=page-size-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"page-size-options.js","sourceRoot":"","sources":["../../src/lib/page-size-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * A status badge's colours, computed from the hex an operator picked (feature
3
+ * 091, batch 8).
4
+ *
5
+ * Published out of `admin/src/modules/orders/orderStatusColor.ts`, which
6
+ * `returns` imported for the return workflow's own status badges —
7
+ * `backend/scripts/ledgers/cross-module-imports/returns.ts` recorded the reach
8
+ * and its retiring condition offered two exits, of which this is the first:
9
+ * *"the helper is generic and moves into the kit"*. It is: two pure functions
10
+ * over a hex string, with no `orders` vocabulary and no request.
11
+ *
12
+ * **Renamed, and the rename is the point.** `orderStatusBadgeStyle` in the kit
13
+ * would be a kit symbol named after a module, which is R6's rule wearing a
14
+ * different hat — `returns` calls it about return statuses and `orders` about
15
+ * order statuses, and the function cannot tell. The old spelling survives at
16
+ * the old path as a re-export shim, so `orders`' own four call sites are
17
+ * unchanged.
18
+ *
19
+ * `ORDER_STATUS_DEFAULT_COLOR` stays `@endora-commerce/contracts`' and is
20
+ * imported from there rather than re-exported here: it is the platform's
21
+ * fallback for an unset colour, both callers already compile that package, and
22
+ * a second name for one constant is two things that can disagree.
23
+ */
24
+ import type { CSSProperties } from 'react';
25
+ /**
26
+ * Black or white text for a given background hex, chosen by perceived
27
+ * luminance so the status label stays legible on any picked colour.
28
+ */
29
+ export declare function readableTextColor(hex: string): string;
30
+ /** Inline style for a status badge: solid background + auto-contrast text. */
31
+ export declare function statusBadgeStyle(color: string | null | undefined): CSSProperties;
32
+ //# sourceMappingURL=status-color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-color.d.ts","sourceRoot":"","sources":["../../src/lib/status-color.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAS3C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAQrD;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,aAAa,CAGhF"}
@@ -0,0 +1,24 @@
1
+ import { ORDER_STATUS_DEFAULT_COLOR } from '@endora-commerce/contracts';
2
+ const HEX = /^#[0-9a-fA-F]{6}$/;
3
+ function normalizeHex(color) {
4
+ return color && HEX.test(color.trim()) ? color.trim() : ORDER_STATUS_DEFAULT_COLOR;
5
+ }
6
+ /**
7
+ * Black or white text for a given background hex, chosen by perceived
8
+ * luminance so the status label stays legible on any picked colour.
9
+ */
10
+ export function readableTextColor(hex) {
11
+ const value = normalizeHex(hex).slice(1);
12
+ const int = Number.parseInt(value, 16);
13
+ const r = (int >> 16) & 0xff;
14
+ const g = (int >> 8) & 0xff;
15
+ const b = int & 0xff;
16
+ const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
17
+ return luminance > 0.6 ? '#1f2937' : '#ffffff';
18
+ }
19
+ /** Inline style for a status badge: solid background + auto-contrast text. */
20
+ export function statusBadgeStyle(color) {
21
+ const hex = normalizeHex(color);
22
+ return { backgroundColor: hex, color: readableTextColor(hex), borderColor: 'transparent' };
23
+ }
24
+ //# sourceMappingURL=status-color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-color.js","sourceRoot":"","sources":["../../src/lib/status-color.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,0BAA0B,EAAE,MAAM,4BAA4B,CAAC;AAExE,MAAM,GAAG,GAAG,mBAAmB,CAAC;AAEhC,SAAS,YAAY,CAAC,KAAgC;IACpD,OAAO,KAAK,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IAC3C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IAC7B,MAAM,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC;IACrB,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC5D,OAAO,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;AACjD,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,gBAAgB,CAAC,KAAgC;IAC/D,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,KAAK,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,aAAa,EAAE,CAAC;AAC7F,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * One predicate for "may this operator see this destination at all", shared by
3
+ * every static index the admin renders: the sidebar, the ⌘K palette's Navigate
4
+ * group and the dashboard's quick actions.
5
+ *
6
+ * Issue #230. The three surfaces used to answer the question three times. The
7
+ * sidebar checked a permission and module presence, the palette checked only
8
+ * module presence — its item type had no field for a permission, so no amount
9
+ * of data could have gated it — and the quick-action card checked only module
10
+ * presence too. The result was a palette that advertised screens the operator's
11
+ * role cannot open, which Principle XVI item 2 forbids in as many words ("so
12
+ * the palette never advertises a 403").
13
+ *
14
+ * Keeping the predicate here rather than in `AppShell.tsx` is the anti-drift
15
+ * measure: `HomePage` cannot reach into a component module for it, so a copy is
16
+ * what it would otherwise have grown, and a copy is what drifts.
17
+ *
18
+ * Published by the kit since feature 091's P3, which is what extends that
19
+ * anti-drift argument to a module **package**: a packaged screen could name
20
+ * neither this file nor `useAuth`, so its only way to gate a control was to
21
+ * grow the copy this comment exists to prevent.
22
+ */
23
+ /**
24
+ * A permission code, or a set of codes any one of which suffices.
25
+ *
26
+ * The array form exists because the routes have it: `/api/v1/admin/organizations`
27
+ * is gated by `requireAdminAny(['customers:read', 'customers:manage'])`
28
+ * (`packages/modules/organizations/src/backend/routes.admin.ts:169`). Naming only the
29
+ * first of those in the UI hides the screen from a role that holds the second —
30
+ * the failure mode this issue exists to remove, pointed the other way.
31
+ */
32
+ export type PermissionRequirement = string | readonly string[];
33
+ /**
34
+ * The gating half of a navigation entry, a palette entry or a quick action.
35
+ * Each surface's own item type carries its label, icon and route on top of it.
36
+ */
37
+ export interface GatedSurface {
38
+ /**
39
+ * The module that owns the destination, or `null` for a surface the admin
40
+ * shell owns itself (the dashboard, `/platform/modules`). Feature 073 /
41
+ * FR-031: presence is resolved from the server's effective enabled-set.
42
+ */
43
+ readonly module?: string | null;
44
+ /**
45
+ * The permission the destination's own route enforces — read from the route,
46
+ * never copied from a neighbouring entry. Unset means the destination has no
47
+ * gate beyond being an authenticated admin.
48
+ */
49
+ readonly requiredPermission?: PermissionRequirement;
50
+ }
51
+ /** Whether `hasPermission` satisfies the requirement (any-of for the array form). */
52
+ export declare function satisfiesPermission(requirement: PermissionRequirement | undefined, hasPermission: (code: string) => boolean): boolean;
53
+ /**
54
+ * The full predicate: permission first, then module presence.
55
+ *
56
+ * Both axes **hide** rather than disable. For module presence that was already
57
+ * the rule (feature 073); extending it to permission is a deliberate choice and
58
+ * not merely the cheaper branch — see the comment on `PALETTE_ITEMS` in
59
+ * `AppShell.tsx` for the reasoning and its accessibility consequence.
60
+ */
61
+ export declare function isSurfaceVisible(surface: GatedSurface, deps: {
62
+ hasPermission: (code: string) => boolean;
63
+ isModulePresent: (moduleId: string) => boolean;
64
+ }): boolean;
65
+ /**
66
+ * Hook form, so the three call sites are one expression each and cannot drift
67
+ * into three slightly different filters again.
68
+ */
69
+ export declare function useSurfaceVisibility(): (surface: GatedSurface) => boolean;
70
+ //# sourceMappingURL=surface-visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-visibility.d.ts","sourceRoot":"","sources":["../../src/lib/surface-visibility.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;AAE/D;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,CAAC,EAAE,qBAAqB,CAAC;CACrD;AAED,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,qBAAqB,GAAG,SAAS,EAC9C,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GACvC,OAAO,CAOT;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE;IACJ,aAAa,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACzC,eAAe,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC;CAChD,GACA,OAAO,CAKT;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAQzE"}
@@ -0,0 +1,37 @@
1
+ import { useCallback } from 'react';
2
+ import { useAuth } from './auth.js';
3
+ import { useModulePresence } from './module-presence/index.js';
4
+ /** Whether `hasPermission` satisfies the requirement (any-of for the array form). */
5
+ export function satisfiesPermission(requirement, hasPermission) {
6
+ if (requirement === undefined)
7
+ return true;
8
+ if (typeof requirement === 'string')
9
+ return hasPermission(requirement);
10
+ // An empty array would mean "no code can satisfy this", which is never what
11
+ // an author means; treat it as ungated rather than silently hiding a screen.
12
+ if (requirement.length === 0)
13
+ return true;
14
+ return requirement.some((code) => hasPermission(code));
15
+ }
16
+ /**
17
+ * The full predicate: permission first, then module presence.
18
+ *
19
+ * Both axes **hide** rather than disable. For module presence that was already
20
+ * the rule (feature 073); extending it to permission is a deliberate choice and
21
+ * not merely the cheaper branch — see the comment on `PALETTE_ITEMS` in
22
+ * `AppShell.tsx` for the reasoning and its accessibility consequence.
23
+ */
24
+ export function isSurfaceVisible(surface, deps) {
25
+ return (satisfiesPermission(surface.requiredPermission, deps.hasPermission) &&
26
+ (surface.module == null || deps.isModulePresent(surface.module)));
27
+ }
28
+ /**
29
+ * Hook form, so the three call sites are one expression each and cannot drift
30
+ * into three slightly different filters again.
31
+ */
32
+ export function useSurfaceVisibility() {
33
+ const { hasPermission } = useAuth();
34
+ const { isPresent } = useModulePresence();
35
+ return useCallback((surface) => isSurfaceVisible(surface, { hasPermission, isModulePresent: isPresent }), [hasPermission, isPresent]);
36
+ }
37
+ //# sourceMappingURL=surface-visibility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-visibility.js","sourceRoot":"","sources":["../../src/lib/surface-visibility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAuD/D,qFAAqF;AACrF,MAAM,UAAU,mBAAmB,CACjC,WAA8C,EAC9C,aAAwC;IAExC,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IAC3C,IAAI,OAAO,WAAW,KAAK,QAAQ;QAAE,OAAO,aAAa,CAAC,WAAW,CAAC,CAAC;IACvE,4EAA4E;IAC5E,6EAA6E;IAC7E,IAAI,WAAW,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC1C,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,IAGC;IAED,OAAO,CACL,mBAAmB,CAAC,OAAO,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,CAAC;QACnE,CAAC,OAAO,CAAC,MAAM,IAAI,IAAI,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CACjE,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB;IAClC,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,EAAE,CAAC;IACpC,MAAM,EAAE,SAAS,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC1C,OAAO,WAAW,CAChB,CAAC,OAAqB,EAAW,EAAE,CACjC,gBAAgB,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,CAAC,EAC1E,CAAC,aAAa,EAAE,SAAS,CAAC,CAC3B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Fold a string so two spellings of the same word compare equal.
3
+ *
4
+ * **This is a general text utility, not palette machinery.** It lived under
5
+ * `lib/admin-actions/` until issue #236, which under-sold it as one consumer's
6
+ * private helper and invited the next author to write their own: by then the
7
+ * page-builder drawer, the combobox and the multi-select had each grown a copy
8
+ * that looked right and was not. The admin has two kinds of caller, and both
9
+ * need the same fold:
10
+ *
11
+ * - **search predicates** — the ⌘K palette, the page-builder drawer, the
12
+ * combobox / multi-select pickers, the category tree filter. Fold both the
13
+ * query and the haystack, then `includes`.
14
+ * - **slug and code generators** — `PageEditor`, `BlockEditor`,
15
+ * `BlogPostEditor`. Fold first, then collapse whatever is left to `-` / `_`.
16
+ *
17
+ * **The fold itself is not written here.** Since issue #240 it is
18
+ * `foldDiacritics` from `@endora-commerce/contracts` — the same implementation the backend
19
+ * writes `organizations.name_search` with. This file had grown its own copy of
20
+ * the map for the same reason the four private copies grew: the shared one was
21
+ * correct but named after a single caller (`normalizeOrganizationName`), so
22
+ * nobody looking for a diacritic fold found it. What is left here is the one
23
+ * thing that is genuinely the admin's policy: the trim.
24
+ *
25
+ * What `foldDiacritics` does, in order: decompose (NFD), strip the combining
26
+ * marks, map the letters NFD leaves standing (`Ł ł Ø ø Đ đ Ð ð Þ þ ß Æ æ Œ œ`),
27
+ * lowercase. Step three is the one the obvious
28
+ * `normalize('NFD').replace(/\p{Diacritic}/gu, '')` one-liner is missing, and
29
+ * without it the fold silently does nothing to every Polish word carrying an
30
+ * `ł` (`płatności`, `Nagłówek`).
31
+ *
32
+ * Then, here: **trim.** Surrounding whitespace is noise in every caller — a
33
+ * search query with a leading space matched nothing at all before this step
34
+ * existed (Postel's Law — accept what was typed), and a slug generator strips
35
+ * its own edge separators anyway. Trimming here means no caller has to
36
+ * remember; four of the six had not. The shared fold deliberately leaves
37
+ * whitespace alone, because what counts as one space differs by caller:
38
+ * `normalizeOrganizationName` also collapses internal runs, since it writes a
39
+ * column a `$like` reads.
40
+ *
41
+ * Edge cases worth knowing:
42
+ * - `ß` folds to `ss` and `æ`/`œ` to `ae`/`oe`. The private copy this file
43
+ * carried until issue #240 left all three standing; adopting the shared map
44
+ * changed 19 code points in total, 15 of them this way. The other four are
45
+ * `Ħ ħ Ŧ ŧ` (Maltese, Northern Sami), which the private map folded to `h`/`t`
46
+ * and the shared one leaves alone. They are **not** silently re-added here:
47
+ * the shared map is the one the backend writes a persisted search column
48
+ * with, so growing it re-folds new rows differently from old ones — a data
49
+ * migration (issue #240's report names it), not a line in this file.
50
+ * - Matching behaves like a case-insensitive substring test, not full Unicode
51
+ * case folding.
52
+ * - A whitespace-only string folds to the empty string, so callers that treat
53
+ * an empty query as "match everything" get that for free.
54
+ */
55
+ export declare function normalize(input: string): string;
56
+ //# sourceMappingURL=text-normalization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-normalization.d.ts","sourceRoot":"","sources":["../../src/lib/text-normalization.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C"}