@phis/ui 0.8.0 → 0.8.2

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 (304) hide show
  1. package/README.md +9 -2
  2. package/components/cms/phi-cms-layout-renderer.js +15 -7
  3. package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
  4. package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
  5. package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
  6. package/components/cms/phi-cms-render-diagnostic.js +12 -2
  7. package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
  8. package/components/cms/phi-cms-render-error-boundary.js +1 -1
  9. package/components/cms/phi-cms-root-layout.js +3 -1
  10. package/components/controls/phi-media-picker-control.d.ts +9 -0
  11. package/components/controls/phi-media-picker-control.js +1 -1
  12. package/components/controls/phi-popover-control.js +4 -1
  13. package/components/controls/phi-table-control.d.ts +7 -1
  14. package/components/controls/phi-table-control.js +26 -11
  15. package/components/forms/form-descriptor-field-check.d.ts +18 -0
  16. package/components/forms/form-descriptor-field-check.js +41 -0
  17. package/components/forms/form-descriptor-runtime-client.js +11 -10
  18. package/components/forms/form-record-source.d.ts +38 -0
  19. package/components/forms/form-record-source.js +48 -0
  20. package/components/forms/shared-form-descriptors.d.ts +0 -34
  21. package/components/forms/shared-form-descriptors.js +0 -6
  22. package/components/forms/shared-form-ids.d.ts +1 -1
  23. package/components/forms/shared-form-ids.js +1 -1
  24. package/components/media/media-settings-labels.d.ts +1 -0
  25. package/components/media/media-settings-labels.js +2 -0
  26. package/components/media/media-upload-flow.d.ts +62 -5
  27. package/components/media/media-upload-flow.js +62 -24
  28. package/components/media/phi-area-upload-widget.d.ts +44 -1
  29. package/components/media/phi-area-upload-widget.js +32 -7
  30. package/components/media/phi-media-picker-binding.d.ts +41 -33
  31. package/components/media/phi-media-picker-binding.js +2 -1
  32. package/components/media/phi-media-upload.d.ts +10 -3
  33. package/components/media/phi-media-upload.js +11 -8
  34. package/components/media/use-media-library-add-picker.d.ts +33 -32
  35. package/components/overlays/phi-overlay-container-client.js +11 -9
  36. package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
  37. package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
  38. package/components/shell/phi-icon-names.d.ts +3 -0
  39. package/components/shell/phi-icon-names.js +3 -0
  40. package/components/shell/phi-icon.d.ts +5 -7
  41. package/components/shell/phi-icon.js +8 -21
  42. package/components/shell/phi-widget-icon.js +1 -0
  43. package/components/tables/client/phi-table-binding-params.d.ts +24 -0
  44. package/components/tables/client/phi-table-binding-params.js +39 -0
  45. package/components/tables/client/phi-table-binding.d.ts +1 -3
  46. package/components/tables/client/phi-table-binding.js +5 -9
  47. package/components/widgets/client/html-editor-link-node.d.ts +12 -0
  48. package/components/widgets/client/html-editor-link-node.js +60 -0
  49. package/components/widgets/client/html-editor.js +10 -6
  50. package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
  51. package/components/widgets/client/shared/phi-button-icons.js +8 -12
  52. package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
  53. package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
  54. package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
  55. package/components/widgets/client/shared/phi-collection-provider.js +5 -0
  56. package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
  57. package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
  58. package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
  59. package/components/widgets/client/shared/phi-command-buttons.js +9 -1
  60. package/components/widgets/label-sets/admin-users.d.ts +1 -0
  61. package/components/widgets/label-sets/admin-users.js +2 -0
  62. package/components/widgets/label-sets/builder-modules.js +4 -0
  63. package/components/widgets/label-sets/profile.d.ts +0 -16
  64. package/components/widgets/label-sets/profile.js +0 -37
  65. package/components/widgets/label-sets/registration.d.ts +0 -1
  66. package/components/widgets/label-sets/registration.js +0 -2
  67. package/components/widgets/label-sets/revisions.js +2 -0
  68. package/components/widgets/label-sets/signals.js +2 -0
  69. package/components/widgets/label-types/builder-modules.d.ts +4 -0
  70. package/components/widgets/label-types/builder-modules.js +2 -0
  71. package/components/widgets/label-types/revisions.d.ts +2 -0
  72. package/components/widgets/label-types/revisions.js +2 -1
  73. package/components/widgets/label-types/signals.d.ts +2 -0
  74. package/components/widgets/label-types/signals.js +1 -0
  75. package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
  76. package/components/widgets/shared/widget-failure-audience.js +21 -0
  77. package/components/widgets/shared/widget-failure-client.js +5 -2
  78. package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
  79. package/components/widgets/shared/widget-failure-notice-client.js +10 -0
  80. package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
  81. package/components/widgets/shared/widget-failure-notice.js +17 -0
  82. package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
  83. package/components/widgets/shared/widget-failure-staff.js +18 -0
  84. package/components/widgets/shared/widget-failure.d.ts +9 -6
  85. package/components/widgets/shared/widget-failure.js +0 -9
  86. package/components/widgets/shared/widget-failure.server.d.ts +4 -2
  87. package/components/widgets/shared/widget-failure.server.js +8 -3
  88. package/constants/cms-widget-types.d.ts +1 -0
  89. package/constants/cms-widget-types.js +3 -0
  90. package/constants/customer-file.d.ts +12 -3
  91. package/constants/customer-file.js +12 -3
  92. package/constants/runtime-module-ownership.js +5 -3
  93. package/constants/site-address.d.ts +9 -0
  94. package/constants/site-address.js +10 -0
  95. package/constants/table-loading.d.ts +14 -0
  96. package/constants/table-loading.js +14 -0
  97. package/constants.d.ts +2 -1
  98. package/constants.js +3 -1
  99. package/gateway/site-cms-write-validation.js +19 -3
  100. package/gateway/site-proxy.d.ts +12 -0
  101. package/gateway/site-proxy.js +20 -0
  102. package/helpers/announced-action.d.ts +17 -0
  103. package/helpers/announced-action.js +29 -0
  104. package/helpers/phi-metadata.d.ts +0 -8
  105. package/helpers/phi-metadata.js +1 -10
  106. package/helpers/phi-site-description.d.ts +11 -0
  107. package/helpers/phi-site-description.js +13 -0
  108. package/helpers/preset-form-check.d.ts +14 -0
  109. package/helpers/preset-form-check.js +12 -0
  110. package/helpers/preset-table-check.d.ts +19 -15
  111. package/helpers/preset-table-check.js +33 -39
  112. package/helpers/record-widget-binding.d.ts +10 -0
  113. package/helpers/record-widget-binding.js +35 -0
  114. package/helpers/record-widget.d.ts +1 -10
  115. package/helpers/record-widget.js +4 -33
  116. package/helpers/table-widget-binding.d.ts +12 -0
  117. package/helpers/table-widget-binding.js +296 -0
  118. package/helpers/tree-widget-binding.d.ts +19 -0
  119. package/helpers/tree-widget-binding.js +72 -0
  120. package/helpers/typed-confirmation.d.ts +9 -0
  121. package/helpers/typed-confirmation.js +13 -0
  122. package/helpers/widget-binding-check.d.ts +22 -0
  123. package/helpers/widget-binding-check.js +91 -0
  124. package/module-page-check.d.ts +2 -0
  125. package/module-page-check.js +2 -0
  126. package/net/phi-next-proxy.d.ts +7 -0
  127. package/net/phi-next-proxy.js +1 -1
  128. package/next/root-route.js +2 -1
  129. package/package.json +27 -14
  130. package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
  131. package/plugins/runtime-modules/accounting/ids.js +14 -3
  132. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
  133. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
  134. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
  135. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
  136. package/plugins/runtime-modules/app/client-data-providers.js +1 -1
  137. package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
  138. package/plugins/runtime-modules/app/data-providers.js +19 -54
  139. package/plugins/runtime-modules/app/definition.d.ts +8 -80
  140. package/plugins/runtime-modules/app/forms.d.ts +1 -16
  141. package/plugins/runtime-modules/app/forms.js +0 -59
  142. package/plugins/runtime-modules/app/ids.d.ts +2 -1
  143. package/plugins/runtime-modules/app/ids.js +3 -2
  144. package/plugins/runtime-modules/app/module.d.ts +8 -80
  145. package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
  146. package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
  147. package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
  148. package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
  149. package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
  150. package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
  151. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
  152. package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
  153. package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
  154. package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
  155. package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
  156. package/plugins/runtime-modules/area-contributions/admin.js +2 -0
  157. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
  158. package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
  159. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
  160. package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
  161. package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
  162. package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
  163. package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
  164. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
  165. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
  166. package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
  167. package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
  168. package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
  169. package/plugins/runtime-modules/cdn/authoring.js +8 -0
  170. package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
  171. package/plugins/runtime-modules/cdn/bytes.js +17 -0
  172. package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
  173. package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
  174. package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
  175. package/plugins/runtime-modules/cdn/data-providers.js +117 -0
  176. package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
  177. package/plugins/runtime-modules/cdn/definition.js +23 -0
  178. package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
  179. package/plugins/runtime-modules/cdn/ids.js +20 -0
  180. package/plugins/runtime-modules/cdn/module.d.ts +131 -0
  181. package/plugins/runtime-modules/cdn/module.js +4 -0
  182. package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
  183. package/plugins/runtime-modules/cdn/platform.js +73 -0
  184. package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
  185. package/plugins/runtime-modules/cdn/presets.js +20 -0
  186. package/plugins/runtime-modules/cdn/server.d.ts +1 -0
  187. package/plugins/runtime-modules/cdn/server.js +14 -0
  188. package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
  189. package/plugins/runtime-modules/cdn/services/table.js +296 -0
  190. package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
  191. package/plugins/runtime-modules/cdn/services/upload.js +146 -0
  192. package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
  193. package/plugins/runtime-modules/cdn/table-params.js +10 -0
  194. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
  195. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
  196. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
  197. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
  198. package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
  199. package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
  200. package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
  201. package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
  202. package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
  203. package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
  204. package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
  205. package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
  206. package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
  207. package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
  208. package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
  209. package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
  210. package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
  211. package/plugins/runtime-modules/cdn/widgets.js +13 -0
  212. package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
  213. package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
  214. package/plugins/runtime-modules/client-manifests/admin.js +11 -1
  215. package/plugins/runtime-modules/client-manifests/common.js +6 -0
  216. package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
  217. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  218. package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
  219. package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
  220. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
  221. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +175 -0
  222. package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
  223. package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
  224. package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
  225. package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
  226. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
  227. package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
  228. package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
  229. package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
  230. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
  231. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
  232. package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
  233. package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
  234. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
  235. package/plugins/runtime-modules/core/widgets/table/client.js +36 -52
  236. package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
  237. package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
  238. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
  239. package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
  240. package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
  241. package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
  242. package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
  243. package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
  244. package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
  245. package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
  246. package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
  247. package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
  248. package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
  249. package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
  250. package/plugins/runtime-modules/revisions/controller/client.js +74 -50
  251. package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
  252. package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
  253. package/plugins/runtime-modules/revisions/forms.js +1 -1
  254. package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
  255. package/plugins/runtime-modules/revisions/page-ids.js +4 -1
  256. package/plugins/runtime-modules/revisions/services/options.js +14 -4
  257. package/plugins/runtime-modules/revisions/services/table.js +41 -21
  258. package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
  259. package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
  260. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
  261. package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
  262. package/plugins/runtime-modules/threads/controller/client.js +62 -2
  263. package/plugins/runtime-modules/threads/controller/definition.js +48 -0
  264. package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
  265. package/plugins/runtime-modules/threads/data-providers.js +35 -24
  266. package/plugins/runtime-modules/threads/definition.d.ts +22 -37
  267. package/plugins/runtime-modules/threads/ids.d.ts +2 -0
  268. package/plugins/runtime-modules/threads/ids.js +2 -0
  269. package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
  270. package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
  271. package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
  272. package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
  273. package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
  274. package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
  275. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
  276. package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
  277. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
  278. package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
  279. package/server-helpers/runtime.js +0 -1
  280. package/styles/controls.css +4 -2
  281. package/styles/layout.css +7 -0
  282. package/theme/phi-antd-token-resolver.d.ts +8 -0
  283. package/theme/phi-antd-token-resolver.js +10 -0
  284. package/theme/phi-theme-color.d.ts +19 -0
  285. package/theme/phi-theme-color.js +42 -0
  286. package/theme/phi-theme-gradients.js +4 -22
  287. package/theme/phi-theme-palette-defaults.d.ts +16 -0
  288. package/theme/phi-theme-palette-defaults.js +103 -0
  289. package/types/cms-plugins.d.ts +6 -1
  290. package/types/collection-provider.d.ts +27 -0
  291. package/types/collection-signal-values.d.ts +2 -0
  292. package/types/collection-signal-values.js +23 -0
  293. package/types/collection-view-widget.d.ts +9 -0
  294. package/types/core-widget-placements.d.ts +6 -0
  295. package/types/signals.d.ts +2 -0
  296. package/types/signals.js +2 -0
  297. package/types/table-widget.d.ts +17 -3
  298. package/types/table-widget.js +0 -282
  299. package/types/tree-widget.d.ts +0 -1
  300. package/types/tree-widget.js +0 -60
  301. package/types/widget-runtime.d.ts +0 -1
  302. package/types.d.ts +1 -1
  303. package/types.js +1 -1
  304. package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
@@ -0,0 +1,43 @@
1
+ import { buildPhiCmsWidgetNamespacedTypeKey, resolvePhiCmsWidgetPluginKey, } from "../../../../../constants/cms-widget-types";
2
+ import { readPhiSignalRouteSet } from "../../../../../types/signals";
3
+ import { readRenderableBlockConfig, } from "../../../../../widget-config";
4
+ /**
5
+ * A file put into the Site's CDN from the browser: its name, version and file name, the platform it is
6
+ * for, and the upload itself -- the parts hashed and sent through Core, resumed where a reload broke
7
+ * them off.
8
+ *
9
+ * A Widget because nothing else can hold it. A Form submits values through a handler on the server
10
+ * (FORMS.md), and this is bytes that exist only on the person's computer, divided, hashed and sent
11
+ * before there is anything to submit; the Media `upload` field sends a file into a Media Space, which
12
+ * the CDN is not. So the dialog of the CDN page holds this, and it says nothing but what an upload
13
+ * needs: no settings, and one announcement, `uploaded`, when a file was published.
14
+ */
15
+ const PHI_CDN_UPLOAD_WIDGET_TYPE_KEY = "cdn-upload";
16
+ const PHI_CDN_UPLOAD_WIDGET_PLUGIN_KEY = resolvePhiCmsWidgetPluginKey(PHI_CDN_UPLOAD_WIDGET_TYPE_KEY);
17
+ export const PHI_CDN_UPLOAD_WIDGET_TYPE = buildPhiCmsWidgetNamespacedTypeKey(PHI_CDN_UPLOAD_WIDGET_PLUGIN_KEY, PHI_CDN_UPLOAD_WIDGET_TYPE_KEY);
18
+ function parsePhiCdnUploadWidgetConfig(config) {
19
+ return {
20
+ ...readRenderableBlockConfig(config),
21
+ signalRoutes: readPhiSignalRouteSet(config.signalRoutes),
22
+ };
23
+ }
24
+ export const PHI_CDN_UPLOAD_WIDGET_DEFINITION = {
25
+ kind: "widget",
26
+ pluginKey: PHI_CDN_UPLOAD_WIDGET_PLUGIN_KEY,
27
+ typeKey: PHI_CDN_UPLOAD_WIDGET_TYPE_KEY,
28
+ slotSizePolicy: "fill-inline",
29
+ title: "CDN upload",
30
+ category: "media",
31
+ description: "Uploads one file into the Site's CDN under a name, a version and a file name.",
32
+ iconFamily: "cdn",
33
+ fields: [],
34
+ defaultConfig: {},
35
+ parseConfig: parsePhiCdnUploadWidgetConfig,
36
+ runtimeSignals: {
37
+ emits: [
38
+ // So the listing can read itself again. Sent once a file is published, never for a refusal.
39
+ { id: "uploaded", action: "activate", valueType: "none" },
40
+ ],
41
+ listens: [],
42
+ },
43
+ };
@@ -0,0 +1,24 @@
1
+ import type { PhiCdnArchKey, PhiCdnOsKey } from "../../platform";
2
+ /** The CDN's own words of its upload, as its server half reads them in the page's language. */
3
+ export type PhiCdnUploadWidgetLabels = {
4
+ name: string;
5
+ nameHint: string;
6
+ version: string;
7
+ fileFileName: string;
8
+ os: string;
9
+ arch: string;
10
+ osNames: Readonly<Record<PhiCdnOsKey, string>>;
11
+ archNames: Readonly<Record<PhiCdnArchKey, string>>;
12
+ /** What the file's tag says while it is hashed and while Core hashes it whole. */
13
+ steps: {
14
+ checksum: string;
15
+ verify: string;
16
+ };
17
+ start: string;
18
+ cancel: string;
19
+ required: string;
20
+ invalidSegment: string;
21
+ invalidVersion: string;
22
+ reservedName: string;
23
+ checksumUnavailable: string;
24
+ };
@@ -0,0 +1,4 @@
1
+ import "server-only";
2
+ import { type PhiGlobalTranslatorOptions } from "../../../../../gateway/tr";
3
+ import type { PhiCdnUploadWidgetLabels } from "./label-types";
4
+ export declare function getPhiCdnUploadWidgetLabels(options: PhiGlobalTranslatorOptions): Promise<PhiCdnUploadWidgetLabels>;
@@ -0,0 +1,72 @@
1
+ import "server-only";
2
+ import { PHI_TR_CTX_WEB_UI_LABEL } from "../../../../../gateway/tr";
3
+ import { definePhiRuntimeModuleLabelSet, definePhiMessageLabel, getPhiLabelSet } from "../../../../../gateway/label-set";
4
+ import { PHI_CDN_RUNTIME_MODULE_IDENTITY } from "../../ids";
5
+ const PHI_CDN_UPLOAD_WIDGET_LABEL_SET = definePhiRuntimeModuleLabelSet(PHI_CDN_RUNTIME_MODULE_IDENTITY, {
6
+ key: "widget:cdn-upload",
7
+ ctx: PHI_TR_CTX_WEB_UI_LABEL,
8
+ labels: {
9
+ name: "Name",
10
+ name_hint: definePhiMessageLabel("What the file belongs to, the first part of its address: pick a name the CDN holds or type a new one."),
11
+ version: "Version",
12
+ file_file_name: "File name",
13
+ os: "Operating systems",
14
+ arch: "Architectures",
15
+ os_linux: "Linux",
16
+ os_windows: "Windows",
17
+ os_macos: "macOS",
18
+ os_android: "Android",
19
+ os_ios: "iOS and iPadOS",
20
+ os_chromeos: "ChromeOS",
21
+ os_other: "Other",
22
+ arch_x64: "x64",
23
+ arch_arm64: "arm64",
24
+ arch_x86: "x86",
25
+ arch_arm32: "arm32",
26
+ arch_riscv64: "RISC-V 64",
27
+ step_checksum: "Computing checksum",
28
+ step_verify: "Verifying",
29
+ start: "Upload",
30
+ cancel: "Cancel",
31
+ required: definePhiMessageLabel("Required."),
32
+ invalid_segment: definePhiMessageLabel("Letters, digits and . _ + ~ - only, no slash, and not starting with a dot or a tilde."),
33
+ invalid_version: definePhiMessageLabel("Letters, digits and . _ + ~ : - only, no slash, and not starting with a dot, a tilde or a colon."),
34
+ reserved_name: definePhiMessageLabel("The name api is reserved."),
35
+ checksum_unavailable: definePhiMessageLabel("This browser cannot compute the file's checksum here; open the page over https."),
36
+ },
37
+ });
38
+ export async function getPhiCdnUploadWidgetLabels(options) {
39
+ const labels = await getPhiLabelSet(options, PHI_CDN_UPLOAD_WIDGET_LABEL_SET);
40
+ return {
41
+ name: labels.name,
42
+ nameHint: labels.name_hint,
43
+ version: labels.version,
44
+ fileFileName: labels.file_file_name,
45
+ os: labels.os,
46
+ arch: labels.arch,
47
+ osNames: {
48
+ linux: labels.os_linux,
49
+ windows: labels.os_windows,
50
+ macos: labels.os_macos,
51
+ android: labels.os_android,
52
+ ios: labels.os_ios,
53
+ chromeos: labels.os_chromeos,
54
+ other: labels.os_other,
55
+ },
56
+ archNames: {
57
+ x64: labels.arch_x64,
58
+ arm64: labels.arch_arm64,
59
+ x86: labels.arch_x86,
60
+ arm32: labels.arch_arm32,
61
+ riscv64: labels.arch_riscv64,
62
+ },
63
+ steps: { checksum: labels.step_checksum, verify: labels.step_verify },
64
+ start: labels.start,
65
+ cancel: labels.cancel,
66
+ required: labels.required,
67
+ invalidSegment: labels.invalid_segment,
68
+ invalidVersion: labels.invalid_version,
69
+ reservedName: labels.reserved_name,
70
+ checksumUnavailable: labels.checksum_unavailable,
71
+ };
72
+ }
@@ -0,0 +1,3 @@
1
+ import type { PhiCmsServerWidgetPlugin } from "../../../../../types";
2
+ import { type PhiCdnUploadWidgetConfig } from "./config";
3
+ export declare const PHI_CDN_UPLOAD_WIDGET_PLUGIN: PhiCmsServerWidgetPlugin<PhiCdnUploadWidgetConfig>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PHI_CDN_UPLOAD_WIDGET_DEFINITION } from "./config";
3
+ import { PhiCdnUploadWidget } from "./server";
4
+ export const PHI_CDN_UPLOAD_WIDGET_PLUGIN = {
5
+ ...PHI_CDN_UPLOAD_WIDGET_DEFINITION,
6
+ render: ({ config, runtime }) => _jsx(PhiCdnUploadWidget, { config: config, runtime: runtime }),
7
+ };
@@ -0,0 +1,8 @@
1
+ import "server-only";
2
+ import type { PhiBlockRuntime } from "../../../../../types";
3
+ import { type PhiCdnUploadWidgetConfig } from "./config";
4
+ /** Handed to the Render Client by type, with its words read here in the page's language. */
5
+ export declare function PhiCdnUploadWidget({ config, runtime, }: {
6
+ config?: PhiCdnUploadWidgetConfig;
7
+ runtime: PhiBlockRuntime;
8
+ }): Promise<import("react").JSX.Element>;
@@ -0,0 +1,17 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import "server-only";
3
+ import { PhiRuntimeModuleRenderClientHost } from "../../../../../runtime-render-client";
4
+ import { buildPhiWidgetLabelTranslatorOptions } from "../../../../../components/widgets/label-sets/runtime-options";
5
+ import { PHI_CDN_UPLOAD_WIDGET_TYPE } from "./config";
6
+ import { getPhiCdnUploadWidgetLabels } from "./labels";
7
+ import { getPhiMediaUploadLabels } from "../../../../../components/media/label-sets/media-upload";
8
+ /** Handed to the Render Client by type, with its words read here in the page's language. */
9
+ export async function PhiCdnUploadWidget({ config, runtime, }) {
10
+ const translator = buildPhiWidgetLabelTranslatorOptions(runtime);
11
+ // The Media upload surface's own words (drop area, progress, refusals) and the CDN's for its fields.
12
+ const [labels, { upload: uploadLabels }] = await Promise.all([
13
+ getPhiCdnUploadWidgetLabels(translator),
14
+ getPhiMediaUploadLabels(translator),
15
+ ]);
16
+ return (_jsx(PhiRuntimeModuleRenderClientHost, { type: PHI_CDN_UPLOAD_WIDGET_TYPE, componentProps: { config, labels, uploadLabels } }));
17
+ }
@@ -0,0 +1,2 @@
1
+ import type { PhiRuntimeModuleWidgetDefinition } from "../contracts";
2
+ export declare const PHI_CDN_RUNTIME_MODULE_WIDGETS: readonly PhiRuntimeModuleWidgetDefinition[];
@@ -0,0 +1,13 @@
1
+ import { definePhiFirstPartyWidget } from "../contracts";
2
+ import { PHI_CDN_RUNTIME_MODULE_ID } from "./ids";
3
+ import { PHI_CDN_UPLOAD_WIDGET_DEFINITION } from "./widgets/upload/config";
4
+ export const PHI_CDN_RUNTIME_MODULE_WIDGETS = [
5
+ definePhiFirstPartyWidget({
6
+ definition: PHI_CDN_UPLOAD_WIDGET_DEFINITION,
7
+ ownerModuleId: PHI_CDN_RUNTIME_MODULE_ID,
8
+ // Nothing to show before a file is chosen: the Builder draws the house placeholder.
9
+ renderPolicies: { runtime: "custom", preview: "visualPlaceholder", authoring: "custom" },
10
+ loadRuntime: () => import("./widgets/upload/plugin").then((module) => module.PHI_CDN_UPLOAD_WIDGET_PLUGIN),
11
+ loadPreview: () => import("./widgets/upload/plugin").then((module) => module.PHI_CDN_UPLOAD_WIDGET_PLUGIN),
12
+ }),
13
+ ];
@@ -1 +1 @@
1
- export declare const PHI_ADMIN_RUNTIME_MODULE_AUTHORING_CLIENT_CONTRIBUTIONS: readonly [import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution];
1
+ export declare const PHI_ADMIN_RUNTIME_MODULE_AUTHORING_CLIENT_CONTRIBUTIONS: readonly [import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution, import("../authoring-contributions-client").PhiRuntimeModuleAuthoringClientContribution];
@@ -2,6 +2,7 @@
2
2
  import { definePhiRuntimeModuleAuthoringClientContribution, } from "../authoring-contributions-client";
3
3
  import { PHI_ADMIN_RUNTIME_MODULE_ID } from "../admin/ids";
4
4
  import { PHI_AUTH_RUNTIME_MODULE_ID } from "../auth/ids";
5
+ import { PHI_CDN_RUNTIME_MODULE_ID } from "../cdn/ids";
5
6
  import { PHI_GROUPS_RUNTIME_MODULE_ID } from "../groups/ids";
6
7
  import { PHI_LOCALIZATION_RUNTIME_MODULE_ID } from "../localization/ids";
7
8
  import { PHI_OBSERVABILITY_RUNTIME_MODULE_ID } from "../observability/ids";
@@ -15,6 +16,11 @@ export const PHI_ADMIN_RUNTIME_MODULE_AUTHORING_CLIENT_CONTRIBUTIONS = [
15
16
  loadAuthoring: () => import("../auth/authoring")
16
17
  .then((module) => module.PhiAuthRuntimeModuleAuthoringClient),
17
18
  }),
19
+ definePhiRuntimeModuleAuthoringClientContribution({
20
+ moduleId: PHI_CDN_RUNTIME_MODULE_ID,
21
+ loadAuthoring: () => import("../cdn/authoring")
22
+ .then((module) => module.PhiCdnRuntimeModuleAuthoringClient),
23
+ }),
18
24
  PHI_DASHBOARD_RUNTIME_MODULE_AUTHORING_CLIENT_CONTRIBUTION,
19
25
  definePhiRuntimeModuleAuthoringClientContribution({
20
26
  moduleId: PHI_GROUPS_RUNTIME_MODULE_ID,
@@ -1,4 +1,5 @@
1
1
  "use client";
2
+ import dynamic from "next/dynamic";
2
3
  import { createPhiRuntimeModuleControllerClientManifestFromAreaContributions } from "../area-contributions-controller-client";
3
4
  import { PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_AREA_CONTRIBUTIONS } from "../client-area-contributions/admin";
4
5
  import { PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST } from "./common";
@@ -9,14 +10,23 @@ import { PHI_DASHBOARD_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../dashb
9
10
  import { PHI_GROUPS_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../groups/client-data-providers";
10
11
  import { PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../localization/client-data-providers";
11
12
  import { PHI_OBSERVABILITY_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../observability/client-data-providers";
13
+ import { PHI_CDN_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../cdn/client-data-providers";
14
+ import { definePhiRuntimeModuleRenderClient, extendPhiRuntimeModuleRenderClientManifest, } from "../../../components/runtime/runtime-module-render-client-manifest";
15
+ import { PhiCmsWidgetType } from "../../../constants/cms-widget-types";
12
16
  import { PHI_USER_MANAGEMENT_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS } from "../user-management/client-data-providers";
13
17
  export { PHI_COMMON_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_CALENDAR_ADAPTER_CLIENT_MANIFEST } from "./common";
14
18
  export { PHI_COMMON_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_MEDIA_SOURCE_CLIENT_MANIFEST } from "./common";
15
19
  export { PHI_COMMON_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST as PHI_ADMIN_RUNTIME_MODULE_UI_PROVIDER_CLIENT_MANIFEST } from "./common";
16
20
  export const PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_MANIFEST = createPhiRuntimeModuleControllerClientManifestFromAreaContributions(PHI_ADMIN_RUNTIME_MODULE_CONTROLLER_CLIENT_AREA_CONTRIBUTIONS);
17
- export const PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST = PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST;
21
+ export const PHI_ADMIN_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST = extendPhiRuntimeModuleRenderClientManifest(PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST, [
22
+ [
23
+ PhiCmsWidgetType.CdnUpload,
24
+ definePhiRuntimeModuleRenderClient(dynamic(() => import("../cdn/widgets/upload/client").then((module) => module.PhiCdnUploadWidgetClient))),
25
+ ],
26
+ ]);
18
27
  export const PHI_ADMIN_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST = extendPhiRuntimeModuleDataProviderClientManifest(PHI_COMMON_RUNTIME_MODULE_DATA_PROVIDER_CLIENT_MANIFEST, [
19
28
  ...PHI_AUTH_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
29
+ ...PHI_CDN_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
20
30
  ...PHI_DASHBOARD_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
21
31
  ...PHI_GROUPS_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
22
32
  ...PHI_LOCALIZATION_RUNTIME_DATA_PROVIDER_CLIENT_DEFINITIONS,
@@ -9,6 +9,7 @@ import { PhiCmsLayoutType } from "../../../constants/cms-layout-type-keys";
9
9
  import { PhiRuntimeRenderClientType } from "../../../constants/runtime-render-client-types";
10
10
  import { PHI_ASSET_RUNTIME_MODULE_ID } from "../asset/ids";
11
11
  import { PHI_MEDIA_LIBRARY_ITEM_RENDERER_KEY } from "../../../constants/media-library-provider-keys";
12
+ import { PHI_SITE_ADDRESS_ITEM_RENDERER_KEY } from "../../../constants/site-address";
12
13
  import { PHI_DASHBOARD_CARD_ITEM_RENDERER_KEY } from "../../../constants/dashboard-card-provider-keys";
13
14
  import { createPhiRuntimeModuleCalendarAdapterClientManifest } from "../../../components/runtime/runtime-module-calendar-adapter-client-manifest";
14
15
  import { PHI_CORE_CALENDAR_ADAPTER_CLIENT_DEFINITIONS } from "../core/client-calendar-adapters";
@@ -210,6 +211,11 @@ export const PHI_COMMON_RUNTIME_MODULE_RENDER_CLIENT_MANIFEST = createPhiRuntime
210
211
  PHI_MEDIA_LIBRARY_ITEM_RENDERER_KEY,
211
212
  definePhiRuntimeModuleRenderClient(dynamic(() => import("../core/widgets/collection-view/asset-binding").then((module) => module.PhiAssetCollectionViewBinding))),
212
213
  ],
214
+ // The address tiles, on the same terms: Core's renderer for any Collection of a Site's addresses.
215
+ [
216
+ PHI_SITE_ADDRESS_ITEM_RENDERER_KEY,
217
+ definePhiRuntimeModuleRenderClient(dynamic(() => import("../core/widgets/collection-view/site-address-binding").then((module) => module.PhiSiteAddressCollectionViewBinding))),
218
+ ],
213
219
  [
214
220
  PhiCmsWidgetType.Description,
215
221
  definePhiRuntimeModuleRenderClient(dynamic(() => import("../core/widgets/description/client").then((module) => module.PhiDescriptionWidgetClient))),
@@ -221,7 +221,7 @@ export declare const PHI_CARD_WIDGET_DEFINITION: {
221
221
  heading?: string;
222
222
  } & {
223
223
  type: "data-provider";
224
- providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind;
224
+ providerKind?: import("../../../../../types").PhiRuntimeDataProviderKind | readonly import("../../../../../types").PhiRuntimeDataProviderKind[];
225
225
  providerKey?: import("@phis/contracts/controls").PhiRuntimeDataProviderKey;
226
226
  }) | ({
227
227
  key: string;
@@ -381,7 +381,7 @@ export function PhiAssetCollectionViewBinding({ config, binding, labels: rawLabe
381
381
  pageSize: config.initialQuery?.pageSize ?? features.pagination?.pageSize ?? 20,
382
382
  filters: { ...(config.initialQuery?.filters ?? {}) },
383
383
  }) })) : null, features.tools.reload ? (_jsx(PhiButtonControl, { ariaLabel: labels.tool.reloadLabel, tooltip: labels.tool.reloadLabel, icon: resolvePhiButtonIcon("reload"), size: controlSize, onClick: binding.reload })) : null] })) : null;
384
- const awaitingInitialPayload = binding.data == null && !state.error;
384
+ const awaitingInitialPayload = binding.loading && binding.data == null && !state.error;
385
385
  const body = state.error ? null : awaitingInitialPayload ? (_jsx(PhiMediaAssetCollectionSkeletonControl, { mode: mode, gap: gap, minColumnWidth: minColumnWidth })) : state.assets.length === 0 ? (_jsx(PhiEmptyControl, { description: presentation.emptyDescription ?? labels.grid.emptyDescription })) : undefined;
386
386
  /*
387
387
  * The upload panel: the Media library's wall, into the resolved Folder path where the placement names
@@ -21,6 +21,7 @@ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
21
21
  import { usePhiSignalListener } from "../../../../../components/runtime/runtime-signal-bus";
22
22
  import { findPhiSignalListenRoute, resolvePhiSignalListenFilter } from "../../../../../helpers/signal-listen-routes";
23
23
  import { readPhiTableBindingParamsSignalValue } from "../../../../../types/table-signal-values";
24
+ import { layPhiCollectionBindingParams } from "../../../../../components/widgets/client/shared/phi-collection-binding-params";
24
25
  import { isPhiRecord } from "../../../../../helpers/is-record";
25
26
  /**
26
27
  * The parts of a Collection View a Tour can point at, as `cms:<instanceId>:<part>` (design/TOURS.md): the
@@ -84,8 +85,10 @@ function PhiCollectionViewWidgetLive({ config, labels, reorderLabels, resourceDe
84
85
  if (route?.capabilityId !== "bindingParamsChange")
85
86
  return;
86
87
  const next = readPhiTableBindingParamsSignalValue(signal.value);
87
- if (next)
88
- setChosenBindingParams({ seed: bindingParamsSeed, params: { ...bindingParams, ...next.params } });
88
+ // The same set again is no change: nothing starts over, nothing is asked again.
89
+ const params = next ? layPhiCollectionBindingParams(bindingParams, next.params) : null;
90
+ if (params)
91
+ setChosenBindingParams({ seed: bindingParamsSeed, params });
89
92
  }, [bindingParams, bindingParamsSeed, listenRoutes, signalIdentity.receiver]), useMemo(() => resolvePhiSignalListenFilter(listenRoutes), [listenRoutes]), signalIdentity.receiver);
90
93
  const { resource, bindingError, queryError, binding } = usePhiCollectionViewBinding({
91
94
  source,
@@ -98,6 +98,12 @@ function readMediaFeatures(value) {
98
98
  ...(mediaType ? { mediaType } : {}),
99
99
  };
100
100
  }
101
+ /* Choosing an item (`features.selection`), read strictly: a mode the renderer does not know is a `PhiConfigError`. */
102
+ function readSelectionFeatures(value) {
103
+ const reader = createPhiConfigReader(value, "features.selection");
104
+ const mode = reader.oneOf("mode", ["single"]);
105
+ return { mode: mode ?? reader.fail("mode", "single") };
106
+ }
101
107
  function readInitialQuery(value) {
102
108
  if (!isPhiRecord(value))
103
109
  return undefined;
@@ -129,6 +135,7 @@ function normalizePhiCmsCollectionViewWidgetConfig(config) {
129
135
  const pagination = isPhiRecord(features.pagination) ? features.pagination : null;
130
136
  const reorder = isPhiRecord(features.reorder) ? features.reorder : null;
131
137
  const media = isPhiRecord(features.media) ? features.media : null;
138
+ const selection = isPhiRecord(features.selection) ? features.selection : null;
132
139
  return {
133
140
  presentation: {
134
141
  title: readString(presentation.title),
@@ -159,6 +166,7 @@ function normalizePhiCmsCollectionViewWidgetConfig(config) {
159
166
  actionKey: readString(reorder.actionKey)?.trim() || undefined,
160
167
  } : undefined,
161
168
  media: media ? readMediaFeatures(media) : undefined,
169
+ selection: selection ? readSelectionFeatures(selection) : undefined,
162
170
  pagination: pagination ? {
163
171
  enabled: readBoolean(pagination.enabled) ?? true,
164
172
  pageSize: readNumber(pagination.pageSize),
@@ -0,0 +1,55 @@
1
+ import type { PhiCmsInstanceId } from "../../../../../types/cms-instance-id";
2
+ import type { PhiCollectionProviderResourceDescriptor, PhiCollectionViewBindingModel } from "../../../../../types/collection-provider";
3
+ import type { PhiCmsCollectionViewWidgetConfig } from "../../../../../types/collection-view-widget";
4
+ import type { PhiRenderableBlockRenderMode } from "../../../../../types/renderable-block";
5
+ import { type PhiSiteAddressPurpose } from "./site-address-tiles";
6
+ /**
7
+ * What the tiles say, in English, under what the placement's `presentation.labels` says in the reader's
8
+ * language: a Page writes its own words there, from its Label Set, group by group.
9
+ */
10
+ export type PhiSiteAddressRendererLabels = {
11
+ purposes: Record<PhiSiteAddressPurpose, string>;
12
+ actions: {
13
+ edit: string;
14
+ remove: string;
15
+ defaultBilling: string;
16
+ defaultShipping: string;
17
+ select: string;
18
+ reload: string;
19
+ };
20
+ remove: {
21
+ title: string;
22
+ text: string;
23
+ ok: string;
24
+ cancel: string;
25
+ };
26
+ empty: string;
27
+ /** Said where the Provider refused an action and gave no words of its own. */
28
+ failed: string;
29
+ };
30
+ export declare const PHI_SITE_ADDRESS_RENDERER_DEFAULT_LABELS: PhiSiteAddressRendererLabels;
31
+ /**
32
+ * The address renderer (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`): a Collection's items as the addresses of a
33
+ * Site's book, one Card each in the View's grid (COLLECTIONS.md, "The address renderer").
34
+ *
35
+ * - **Items** in the shape `toPhiSiteAddressRow` answers (`helpers/site-address-row.ts`); `id` is the
36
+ * address id and the item's key. A tile names the company and the name, the parts after them a line
37
+ * each, the country in the reader's language, and the purposes and defaults as tags.
38
+ * - **Item actions** are the resource's: `edit` is announced on `actionActivate` as `{ actionKey, itemKey }`
39
+ * -- a record-bound Form opens on it -- and `makeDefaultBilling`, `makeDefaultShipping` and `delete` run
40
+ * through the Provider, `delete` after its confirmation. A resource that declares none is read-only.
41
+ * - **Toolbar actions** (`features.actions.toolbar`) are announced as `{ actionKey, query }`, each one the
42
+ * resource declares at resource scope; one it does not is the Widget's failure.
43
+ * - **Choosing** (`features.selection: { mode: "single" }`, prepared for the Shop's checkout) puts a
44
+ * Choose on every tile and says the chosen address on `selection` as `{ addressId }`.
45
+ * - **The Provider's own empty sentence** (`meta.emptyDescription`) stands in for the placement's where it
46
+ * answers no items for a reason of its own.
47
+ */
48
+ export declare function PhiSiteAddressCollectionViewBinding({ config, binding, widgetId, renderMode, resource, }: {
49
+ config: PhiCmsCollectionViewWidgetConfig;
50
+ binding: PhiCollectionViewBindingModel;
51
+ labels?: unknown;
52
+ widgetId?: PhiCmsInstanceId | null;
53
+ renderMode: PhiRenderableBlockRenderMode;
54
+ resource?: PhiCollectionProviderResourceDescriptor | null;
55
+ }): import("react").JSX.Element;
@@ -0,0 +1,175 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useMemo, useState } from "react";
4
+ import { isPhiRecord } from "../../../../../helpers/is-record";
5
+ import { createPhiSignalAddress } from "../../../../../types/signals";
6
+ import { PhiCmsWidgetType } from "../../../../../constants/cms-widget-types";
7
+ import { PhiAlertControl } from "../../../../../components/controls/phi-alert-control";
8
+ import { PhiButtonControl } from "../../../../../components/controls/phi-button-control";
9
+ import { PhiCardControl } from "../../../../../components/controls/phi-card-control";
10
+ import { PhiCollectionViewControl, PhiCollectionViewSkeletonControl, } from "../../../../../components/controls/phi-collection-view-control";
11
+ import { PhiConfirmControl } from "../../../../../components/controls/phi-confirm-control";
12
+ import { PhiEmptyControl } from "../../../../../components/controls/phi-empty-control";
13
+ import { PhiTagControl } from "../../../../../components/controls/phi-tag-control";
14
+ import { PhiToolbarControl } from "../../../../../components/controls/phi-toolbar-control";
15
+ import { PhiTypographyControl } from "../../../../../components/controls/phi-typography-control";
16
+ import { usePhiConfig } from "../../../../../components/root/phi-config-provider";
17
+ import { usePhiIntlLocale } from "../../../../../components/root/phi-intl-locale";
18
+ import { usePhiApplicationFeedback } from "../../../../../components/runtime/use-phi-application-feedback";
19
+ import { resolvePhiButtonIcon } from "../../../../../components/widgets/client/shared/phi-button-icons";
20
+ import { usePhiControlSignalController } from "../../../../../components/widgets/client/shared/phi-control-signals";
21
+ import { PhiWidgetFailure } from "../../../../../components/widgets/shared/widget-failure-client";
22
+ import { readPhiSiteAddressTile, readPhiSiteAddressToolFailure, resolvePhiSiteAddressTileActions, } from "./site-address-tiles";
23
+ export const PHI_SITE_ADDRESS_RENDERER_DEFAULT_LABELS = {
24
+ purposes: {
25
+ billing: "Billing",
26
+ shipping: "Shipping",
27
+ defaultBilling: "Default billing",
28
+ defaultShipping: "Default shipping",
29
+ },
30
+ actions: {
31
+ edit: "Change",
32
+ remove: "Remove",
33
+ defaultBilling: "Use for billing by default",
34
+ defaultShipping: "Use for shipping by default",
35
+ select: "Choose",
36
+ reload: "Reload",
37
+ },
38
+ remove: { title: "Remove this address?", text: "", ok: "Remove", cancel: "Cancel" },
39
+ empty: "No address yet.",
40
+ failed: "The address could not be changed.",
41
+ };
42
+ /** A group of the defaults with the placement's strings laid over it, key by key; anything else is left. */
43
+ function overlayGroup(base, override) {
44
+ if (!isPhiRecord(override))
45
+ return base;
46
+ const result = { ...base };
47
+ for (const key of Object.keys(base)) {
48
+ const value = override[key];
49
+ if (typeof value === "string")
50
+ result[key] = value;
51
+ }
52
+ return result;
53
+ }
54
+ function readLabels(raw) {
55
+ const labels = isPhiRecord(raw) ? raw : {};
56
+ const base = PHI_SITE_ADDRESS_RENDERER_DEFAULT_LABELS;
57
+ return {
58
+ purposes: overlayGroup(base.purposes, labels.purposes),
59
+ actions: overlayGroup(base.actions, labels.actions),
60
+ remove: overlayGroup(base.remove, labels.remove),
61
+ empty: typeof labels.empty === "string" ? labels.empty : base.empty,
62
+ failed: typeof labels.failed === "string" ? labels.failed : base.failed,
63
+ };
64
+ }
65
+ const TILE_MIN_COLUMN_WIDTH = 233;
66
+ const ACTION_ICONS = {
67
+ edit: "edit",
68
+ makeDefaultBilling: "antd:file-text",
69
+ makeDefaultShipping: "antd:shopping",
70
+ delete: "antd:delete",
71
+ };
72
+ /**
73
+ * The address renderer (`PHI_SITE_ADDRESS_ITEM_RENDERER_KEY`): a Collection's items as the addresses of a
74
+ * Site's book, one Card each in the View's grid (COLLECTIONS.md, "The address renderer").
75
+ *
76
+ * - **Items** in the shape `toPhiSiteAddressRow` answers (`helpers/site-address-row.ts`); `id` is the
77
+ * address id and the item's key. A tile names the company and the name, the parts after them a line
78
+ * each, the country in the reader's language, and the purposes and defaults as tags.
79
+ * - **Item actions** are the resource's: `edit` is announced on `actionActivate` as `{ actionKey, itemKey }`
80
+ * -- a record-bound Form opens on it -- and `makeDefaultBilling`, `makeDefaultShipping` and `delete` run
81
+ * through the Provider, `delete` after its confirmation. A resource that declares none is read-only.
82
+ * - **Toolbar actions** (`features.actions.toolbar`) are announced as `{ actionKey, query }`, each one the
83
+ * resource declares at resource scope; one it does not is the Widget's failure.
84
+ * - **Choosing** (`features.selection: { mode: "single" }`, prepared for the Shop's checkout) puts a
85
+ * Choose on every tile and says the chosen address on `selection` as `{ addressId }`.
86
+ * - **The Provider's own empty sentence** (`meta.emptyDescription`) stands in for the placement's where it
87
+ * answers no items for a reason of its own.
88
+ */
89
+ export function PhiSiteAddressCollectionViewBinding({ config, binding, widgetId, renderMode, resource, }) {
90
+ const { presentation, features } = config;
91
+ const { token } = usePhiConfig();
92
+ const locale = usePhiIntlLocale();
93
+ const { showMessage } = usePhiApplicationFeedback();
94
+ const labels = useMemo(() => readLabels(presentation.labels), [presentation.labels]);
95
+ const controlSize = presentation.controlSize ?? "small";
96
+ const selectable = features.selection?.mode === "single";
97
+ const toolbarActions = useMemo(() => features.actions?.toolbar ?? [], [features.actions?.toolbar]);
98
+ const toolFailure = readPhiSiteAddressToolFailure({
99
+ toolbarKeys: toolbarActions.map((action) => action.key),
100
+ selection: selectable,
101
+ resource,
102
+ });
103
+ const [pendingIds, setPendingIds] = useState([]);
104
+ const [chosenId, setChosenId] = useState(null);
105
+ const signals = usePhiControlSignalController({
106
+ key: "siteAddressAction",
107
+ sender: widgetId == null ? null : createPhiSignalAddress("cms", widgetId),
108
+ signalRoutes: config.signalRoutes,
109
+ valueType: "json",
110
+ typeKey: "collection-action",
111
+ });
112
+ const tiles = useMemo(() => {
113
+ const names = new Intl.DisplayNames([locale], { type: "region", fallback: "code" });
114
+ return (binding.data?.items ?? []).flatMap((item) => {
115
+ const tile = readPhiSiteAddressTile(item, (code) => names.of(code) ?? code);
116
+ return tile ? [tile] : [];
117
+ });
118
+ }, [binding.data?.items, locale]);
119
+ if (toolFailure) {
120
+ return (_jsx(PhiWidgetFailure, { renderMode: renderMode, widgetType: PhiCmsWidgetType.CollectionView, widgetId: widgetId, title: toolFailure }));
121
+ }
122
+ async function runProviderAction(tile, actionKey) {
123
+ setPendingIds((current) => current.includes(tile.id) ? current : [...current, tile.id]);
124
+ try {
125
+ const data = await binding.activate({ actionKey, itemKey: tile.id, query: binding.query });
126
+ if (data.error)
127
+ throw new Error(data.error);
128
+ }
129
+ catch (error) {
130
+ showMessage({
131
+ level: "error",
132
+ content: error instanceof Error && error.message ? error.message : labels.failed,
133
+ durationSeconds: 2.8,
134
+ });
135
+ }
136
+ finally {
137
+ setPendingIds((current) => current.filter((id) => id !== tile.id));
138
+ }
139
+ }
140
+ function choose(tile) {
141
+ setChosenId(tile.id);
142
+ signals.emitCapability("selection", { addressId: tile.id });
143
+ }
144
+ function renderActions(tile) {
145
+ const pending = pendingIds.includes(tile.id);
146
+ const actions = resolvePhiSiteAddressTileActions(resource, tile);
147
+ if (actions.length === 0 && !selectable)
148
+ return null;
149
+ const label = (key) => key === "edit" ? labels.actions.edit
150
+ : key === "makeDefaultBilling" ? labels.actions.defaultBilling
151
+ : key === "makeDefaultShipping" ? labels.actions.defaultShipping
152
+ : labels.actions.remove;
153
+ return (_jsxs(PhiToolbarControl, { compact: true, size: controlSize, children: [selectable ? (_jsx(PhiButtonControl, { ariaLabel: labels.actions.select, ariaPressed: chosenId === tile.id, tooltip: labels.actions.select, icon: resolvePhiButtonIcon("check"), type: chosenId === tile.id ? "primary" : "default", size: controlSize, onClick: () => choose(tile) })) : null, actions.map((key) => key === "delete" ? (_jsx(PhiConfirmControl, { title: labels.remove.title, description: labels.remove.text || undefined, confirmLabel: labels.remove.ok, cancelLabel: labels.remove.cancel, danger: true, disabled: pending, onConfirm: () => runProviderAction(tile, key), children: _jsx(PhiButtonControl, { ariaLabel: label(key), tooltip: label(key), icon: resolvePhiButtonIcon(ACTION_ICONS[key]), danger: true, size: controlSize, disabled: pending,
154
+ // The confirmation reacts to the press; this only keeps the button a live one.
155
+ onClick: () => undefined }) }, key)) : (_jsx(PhiButtonControl, { ariaLabel: label(key), tooltip: label(key), icon: resolvePhiButtonIcon(ACTION_ICONS[key]), size: controlSize, disabled: pending, loading: pending && key !== "edit", onClick: key === "edit"
156
+ ? () => signals.emitCapability("actionActivate", { actionKey: key, itemKey: tile.id })
157
+ : () => void runProviderAction(tile, key) }, key)))] }));
158
+ }
159
+ const items = tiles.map((tile) => (_jsx(PhiCardControl, { size: "small", title: tile.title, toolbar: renderActions(tile), style: selectable && chosenId === tile.id ? { borderColor: token.colorPrimary } : undefined, children: _jsxs("div", { style: { display: "flex", flexDirection: "column", gap: token.paddingXS }, children: [_jsx("div", { style: { display: "flex", flexDirection: "column" }, children: tile.lines.map((line, index) => (_jsx(PhiTypographyControl, { children: line }, `${index}-${line}`))) }), tile.purposes.length > 0 ? (_jsx("div", { style: { display: "flex", flexWrap: "wrap", gap: token.paddingXXS }, children: tile.purposes.map((purpose) => (_jsx(PhiTagControl, { color: purpose.startsWith("default") ? "processing" : "default", children: labels.purposes[purpose] }, purpose))) })) : null] }) }, tile.id)));
160
+ const mode = presentation.mode;
161
+ const gap = presentation.gap;
162
+ const minColumnWidth = presentation.minColumnWidth ?? TILE_MIN_COLUMN_WIDTH;
163
+ const toolbar = toolbarActions.length > 0 || features.tools.reload ? (_jsxs(PhiToolbarControl, { compact: true, size: controlSize, children: [toolbarActions.map((action) => {
164
+ const display = action.display ?? "icon";
165
+ const actionLabel = action.label ?? action.key;
166
+ return (_jsx(PhiButtonControl, { label: display === "icon" ? undefined : actionLabel, ariaLabel: actionLabel, tooltip: action.description ?? (display === "icon" ? actionLabel : undefined), icon: display === "label" || !action.icon ? undefined : resolvePhiButtonIcon(action.icon), type: action.mode === "primary" ? "primary" : "default", danger: action.mode === "danger", size: controlSize, onClick: () => signals.emitCapability("actionActivate", { actionKey: action.key, query: binding.query }) }, action.key));
167
+ }), features.tools.reload ? (_jsx(PhiButtonControl, { ariaLabel: labels.actions.reload, tooltip: labels.actions.reload, icon: resolvePhiButtonIcon("reload"), size: controlSize, onClick: binding.reload })) : null] })) : null;
168
+ const emptyDescription = typeof binding.data?.meta?.emptyDescription === "string" && binding.data.meta.emptyDescription.trim()
169
+ ? binding.data.meta.emptyDescription
170
+ : presentation.emptyDescription ?? labels.empty;
171
+ const body = binding.data == null ? (binding.loading && !binding.error
172
+ ? _jsx(PhiCollectionViewSkeletonControl, { mode: mode, gap: gap, minColumnWidth: minColumnWidth, count: 3 })
173
+ : null) : tiles.length === 0 ? (_jsx(PhiEmptyControl, { description: emptyDescription })) : undefined;
174
+ return (_jsx(PhiCollectionViewControl, { title: presentation.title, description: presentation.description, toolbar: features.tools.mode === "external" ? null : toolbar, diagnostics: binding.error && binding.data != null ? _jsx(PhiAlertControl, { level: "error", title: binding.error }) : null, body: body, items: items, mode: mode, ...(gap ? { gap } : {}), minColumnWidth: minColumnWidth, pagination: null }));
175
+ }