@phis/ui 0.8.1 → 0.8.3

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 (223) hide show
  1. package/README.md +9 -2
  2. package/components/calendar/gregory-calendar-adapter-client.js +1 -0
  3. package/components/controls/phi-accordion-control.d.ts +6 -0
  4. package/components/controls/phi-accordion-control.js +8 -13
  5. package/components/controls/phi-background-control.js +2 -5
  6. package/components/controls/phi-builder-insert-picker-control-labels.d.ts +2 -0
  7. package/components/controls/phi-builder-insert-picker-control-labels.js +1 -0
  8. package/components/controls/phi-builder-insert-picker-control.js +10 -11
  9. package/components/controls/phi-cascader-control.d.ts +9 -3
  10. package/components/controls/phi-cascader-control.js +38 -10
  11. package/components/controls/phi-checkbox-group-control.d.ts +3 -1
  12. package/components/controls/phi-checkbox-group-control.js +2 -2
  13. package/components/controls/phi-collapse-control.d.ts +9 -2
  14. package/components/controls/phi-collapse-control.js +14 -2
  15. package/components/controls/phi-color-control.d.ts +3 -1
  16. package/components/controls/phi-color-control.js +2 -2
  17. package/components/controls/phi-color-field-control.d.ts +6 -1
  18. package/components/controls/phi-color-field-control.js +2 -2
  19. package/components/controls/phi-confirm-control.d.ts +1 -1
  20. package/components/controls/phi-confirm-control.js +71 -2
  21. package/components/controls/phi-confirm-dialog.js +2 -1
  22. package/components/controls/phi-date-picker-control.js +1 -1
  23. package/components/controls/phi-dimension-control.d.ts +3 -1
  24. package/components/controls/phi-dimension-control.js +2 -2
  25. package/components/controls/phi-geometry-control.js +1 -1
  26. package/components/controls/phi-length-control.d.ts +6 -1
  27. package/components/controls/phi-length-control.js +3 -2
  28. package/components/controls/phi-multi-select-control.d.ts +6 -1
  29. package/components/controls/phi-multi-select-control.js +3 -3
  30. package/components/controls/phi-segmented-control.d.ts +6 -1
  31. package/components/controls/phi-segmented-control.js +3 -3
  32. package/components/controls/phi-switch-control.d.ts +3 -1
  33. package/components/controls/phi-switch-control.js +3 -3
  34. package/components/controls/phi-table-control.d.ts +8 -1
  35. package/components/controls/phi-table-control.js +11 -5
  36. package/components/forms/compound-form-controls.js +16 -1
  37. package/components/layouts/clients/phi-collapsible-layout-client.js +2 -6
  38. package/components/media/media-upload-flow.d.ts +62 -5
  39. package/components/media/media-upload-flow.js +62 -24
  40. package/components/media/media-widget-labels.d.ts +2 -0
  41. package/components/media/media-widget-labels.js +2 -0
  42. package/components/media/phi-area-upload-widget.d.ts +44 -1
  43. package/components/media/phi-area-upload-widget.js +32 -7
  44. package/components/media/phi-asset-inspector-section.js +19 -1
  45. package/components/media/phi-media-upload.d.ts +10 -3
  46. package/components/media/phi-media-upload.js +11 -8
  47. package/components/regions/presets/phi-area-shell-preset-nodes.js +2 -0
  48. package/components/shell/phi-builder-icon.js +9 -1
  49. package/components/shell/phi-widget-icon.js +1 -0
  50. package/components/tables/phi-table-surface.d.ts +25 -0
  51. package/components/tables/phi-table-surface.js +25 -0
  52. package/components/widgets/builder/phi-static-rows-editor.js +4 -1
  53. package/components/widgets/client/html-editor-link-node.d.ts +12 -0
  54. package/components/widgets/client/html-editor-link-node.js +60 -0
  55. package/components/widgets/client/html-editor.js +10 -6
  56. package/components/widgets/client/shared/phi-choice-controller.d.ts +8 -1
  57. package/components/widgets/client/shared/phi-choice-controller.js +16 -1
  58. package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
  59. package/components/widgets/config/choice-shared.d.ts +2 -0
  60. package/components/widgets/config/choice-shared.js +1 -0
  61. package/components/widgets/config/image-variant-options.d.ts +4 -1
  62. package/components/widgets/config/image-variant-options.js +27 -14
  63. package/components/widgets/inspector-field-row.d.ts +14 -1
  64. package/components/widgets/inspector-field-row.js +21 -1
  65. package/components/widgets/label-sets/builder-chrome.js +2 -0
  66. package/components/widgets/label-sets/inspector.js +10 -0
  67. package/components/widgets/label-sets/security.js +2 -0
  68. package/components/widgets/label-types/inspector.d.ts +5 -0
  69. package/components/widgets/label-types/inspector.js +5 -0
  70. package/components/widgets/label-types/security.d.ts +2 -0
  71. package/components/widgets/signals/signal-endpoint-list.js +4 -1
  72. package/constants/cms-widget-types.d.ts +1 -0
  73. package/constants/cms-widget-types.js +3 -0
  74. package/constants/runtime-module-ownership.js +1 -0
  75. package/gateway/site-proxy.d.ts +12 -0
  76. package/gateway/site-proxy.js +20 -0
  77. package/helpers/cms-inspector-drawer.d.ts +15 -0
  78. package/helpers/cms-inspector-drawer.js +37 -0
  79. package/helpers/cms-layout-defaults.js +1 -1
  80. package/helpers/preset-tree-contract-check.js +56 -0
  81. package/helpers/text-source.js +2 -0
  82. package/net/phi-next-proxy.d.ts +7 -0
  83. package/net/phi-next-proxy.js +1 -1
  84. package/package.json +27 -14
  85. package/plugins/runtime-modules/accounting/definition.d.ts +1 -1
  86. package/plugins/runtime-modules/accounting/definition.js +0 -1
  87. package/plugins/runtime-modules/accounting/ids.d.ts +4 -4
  88. package/plugins/runtime-modules/accounting/ids.js +4 -2
  89. package/plugins/runtime-modules/accounting/module.d.ts +1 -1
  90. package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +2 -1
  91. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +5 -4
  92. package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +80 -38
  93. package/plugins/runtime-modules/admin/definition.d.ts +1 -1
  94. package/plugins/runtime-modules/admin/definition.js +0 -1
  95. package/plugins/runtime-modules/admin/module.d.ts +1 -1
  96. package/plugins/runtime-modules/app/definition.d.ts +1 -1
  97. package/plugins/runtime-modules/app/definition.js +0 -1
  98. package/plugins/runtime-modules/app/module.d.ts +1 -1
  99. package/plugins/runtime-modules/area-base-definition.d.ts +19 -1
  100. package/plugins/runtime-modules/area-base-definition.js +18 -0
  101. package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
  102. package/plugins/runtime-modules/area-contributions/admin.js +2 -0
  103. package/plugins/runtime-modules/area-definitions.d.ts +8 -8
  104. package/plugins/runtime-modules/area-definitions.js +4 -3
  105. package/plugins/runtime-modules/area-root-route.d.ts +8 -0
  106. package/plugins/runtime-modules/area-root-route.js +11 -1
  107. package/plugins/runtime-modules/asset/labels.js +4 -0
  108. package/plugins/runtime-modules/asset/metadata-form.d.ts +0 -28
  109. package/plugins/runtime-modules/asset/metadata-form.js +6 -10
  110. package/plugins/runtime-modules/asset/services/options.d.ts +3 -2
  111. package/plugins/runtime-modules/asset/services/options.js +4 -3
  112. package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +2 -1
  113. package/plugins/runtime-modules/asset/trees/phi-default-builder-media-page-tree.js +3 -3
  114. package/plugins/runtime-modules/auth/widgets/security/client.js +2 -2
  115. package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
  116. package/plugins/runtime-modules/builder/addresses.d.ts +1 -1
  117. package/plugins/runtime-modules/builder/addresses.js +1 -1
  118. package/plugins/runtime-modules/builder/area-settings-form.js +1 -1
  119. package/plugins/runtime-modules/builder/clients/inspector-condition-group.d.ts +16 -0
  120. package/plugins/runtime-modules/builder/clients/inspector-condition-group.js +9 -0
  121. package/plugins/runtime-modules/builder/clients/inspector-config-field.js +97 -10
  122. package/plugins/runtime-modules/builder/clients/pages-header.js +7 -6
  123. package/plugins/runtime-modules/builder/clients/region-visibility-fields.js +1 -1
  124. package/plugins/runtime-modules/builder/controller/workspace-controller.js +7 -4
  125. package/plugins/runtime-modules/builder/definition.d.ts +1 -1
  126. package/plugins/runtime-modules/builder/definition.js +0 -1
  127. package/plugins/runtime-modules/builder/offered-page-catalog.d.ts +10 -4
  128. package/plugins/runtime-modules/builder/offered-page-catalog.js +35 -8
  129. package/plugins/runtime-modules/builder/page-meta-form.js +5 -2
  130. package/plugins/runtime-modules/builder/plugin-meta-labels.js +8 -0
  131. package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +4 -2
  132. package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +20 -13
  133. package/plugins/runtime-modules/builder/workspace-catalog-actions.js +8 -1
  134. package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
  135. package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
  136. package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
  137. package/plugins/runtime-modules/cdn/authoring.js +8 -0
  138. package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
  139. package/plugins/runtime-modules/cdn/bytes.js +17 -0
  140. package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
  141. package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
  142. package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
  143. package/plugins/runtime-modules/cdn/data-providers.js +117 -0
  144. package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
  145. package/plugins/runtime-modules/cdn/definition.js +23 -0
  146. package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
  147. package/plugins/runtime-modules/cdn/ids.js +20 -0
  148. package/plugins/runtime-modules/cdn/module.d.ts +131 -0
  149. package/plugins/runtime-modules/cdn/module.js +4 -0
  150. package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
  151. package/plugins/runtime-modules/cdn/platform.js +73 -0
  152. package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
  153. package/plugins/runtime-modules/cdn/presets.js +20 -0
  154. package/plugins/runtime-modules/cdn/server.d.ts +1 -0
  155. package/plugins/runtime-modules/cdn/server.js +14 -0
  156. package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
  157. package/plugins/runtime-modules/cdn/services/table.js +296 -0
  158. package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
  159. package/plugins/runtime-modules/cdn/services/upload.js +146 -0
  160. package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
  161. package/plugins/runtime-modules/cdn/table-params.js +10 -0
  162. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
  163. package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
  164. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
  165. package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +491 -0
  166. package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
  167. package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
  168. package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
  169. package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
  170. package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
  171. package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
  172. package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
  173. package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
  174. package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
  175. package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
  176. package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
  177. package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
  178. package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
  179. package/plugins/runtime-modules/cdn/widgets.js +13 -0
  180. package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
  181. package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
  182. package/plugins/runtime-modules/client-manifests/admin.js +11 -1
  183. package/plugins/runtime-modules/core/authoring-widgets.js +2 -1
  184. package/plugins/runtime-modules/core/messaging/label-defaults.d.ts +49 -0
  185. package/plugins/runtime-modules/core/messaging/label-defaults.js +48 -0
  186. package/plugins/runtime-modules/core/messaging/labels.d.ts +2 -28
  187. package/plugins/runtime-modules/core/messaging/labels.js +52 -23
  188. package/plugins/runtime-modules/core/widgets/card/config.d.ts +14 -0
  189. package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
  190. package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +3 -1
  191. package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +14 -0
  192. package/plugins/runtime-modules/core/widgets/description/config.d.ts +14 -0
  193. package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +14 -0
  194. package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +14 -0
  195. package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +14 -0
  196. package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +14 -0
  197. package/plugins/runtime-modules/core/widgets/result/config.d.ts +14 -0
  198. package/plugins/runtime-modules/core/widgets/select-box/client.js +13 -4
  199. package/plugins/runtime-modules/core/widgets/select-box/config.js +1 -0
  200. package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +14 -0
  201. package/plugins/runtime-modules/core/widgets/table/client.js +17 -8
  202. package/plugins/runtime-modules/core/widgets/table/config.d.ts +1 -1143
  203. package/plugins/runtime-modules/core/widgets/table/config.js +144 -125
  204. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.d.ts +2 -0
  205. package/plugins/runtime-modules/core/widgets/thread-conversation/authoring.js +76 -0
  206. package/plugins/runtime-modules/core/widgets/thread-conversation/client.d.ts +44 -1
  207. package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +28 -13
  208. package/plugins/runtime-modules/editor/definition.d.ts +1 -1
  209. package/plugins/runtime-modules/editor/definition.js +0 -1
  210. package/plugins/runtime-modules/editor/module.d.ts +1 -1
  211. package/plugins/runtime-modules/phi-default-site-area-preset-tree.js +16 -8
  212. package/plugins/runtime-modules/public/definition.d.ts +1 -1
  213. package/plugins/runtime-modules/public/definition.js +0 -1
  214. package/plugins/runtime-modules/public/module.d.ts +1 -1
  215. package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +109 -86
  216. package/plugins/runtime-modules/threads/controller/client.js +10 -12
  217. package/plugins/runtime-modules/threads/controller/definition.d.ts +6 -0
  218. package/plugins/runtime-modules/threads/controller/definition.js +17 -6
  219. package/styles/controls.css +49 -1
  220. package/styles/layout.css +3 -2
  221. package/types/calendar.d.ts +5 -0
  222. package/types/cms-plugins.d.ts +30 -10
  223. package/types/table-widget.d.ts +8 -2
@@ -0,0 +1,12 @@
1
+ import type { PhiAreaUploadWidgetLabels } from "../../../../../components/media/media-widget-labels";
2
+ import type { PhiCdnUploadWidgetConfig } from "./config";
3
+ import type { PhiCdnUploadWidgetLabels } from "./label-types";
4
+ /** What is wrong with one segment as the person typed it, before Core is asked; null where nothing is. */
5
+ export declare function readPhiCdnSegmentProblem(value: string, kind: "name" | "version" | "fileName", labels: Pick<PhiCdnUploadWidgetLabels, "required" | "invalidSegment" | "invalidVersion" | "reservedName">): string | null;
6
+ export type PhiCdnUploadWidgetClientProps = {
7
+ config?: PhiCdnUploadWidgetConfig;
8
+ labels: PhiCdnUploadWidgetLabels;
9
+ /** The Media upload surface's own words. */
10
+ uploadLabels: PhiAreaUploadWidgetLabels;
11
+ };
12
+ export declare function PhiCdnUploadWidgetClient({ config, labels, uploadLabels }: PhiCdnUploadWidgetClientProps): import("react").JSX.Element;
@@ -0,0 +1,138 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
4
+ import { PHIS_CDN_KEY_SEGMENT_PATTERN, PHIS_CDN_KEY_VERSION_PATTERN, } from "@phis/contracts/addon";
5
+ import { PhiCheckboxGroupControl } from "../../../../../components/controls/phi-checkbox-group-control";
6
+ import { PhiFlexControl } from "../../../../../components/controls/phi-flex-control";
7
+ import { PhiLabeledControl } from "../../../../../components/controls/phi-labeled-control";
8
+ import { PhiSelectControl } from "../../../../../components/controls/phi-select-control";
9
+ import { PhiTextControl } from "../../../../../components/controls/phi-text-control";
10
+ import { PhiAreaUploadBinding, } from "../../../../../components/media/phi-area-upload-widget";
11
+ import { PhiMediaUploadError, runPhiUploadSession, } from "../../../../../components/media/media-upload-flow";
12
+ import { emitPhiSignalCapability, usePhiSignalEmitter, } from "../../../../../components/runtime/runtime-signal-identity";
13
+ import { PHI_CDN_ARCH_KEYS, PHI_CDN_OS_KEYS, guessPhiCdnPlatform, readPhiCdnArchKeys, readPhiCdnOsKeys, writePhiCdnArchBits, writePhiCdnOsBits, } from "../../platform";
14
+ import { PHI_CDN_UPLOAD_DISCARD, createPhiCdnUploadTarget, loadPhiCdnNames, } from "../../services/upload";
15
+ const EMPTY_DRAFT = { name: "", version: "", fileName: "", os: [], arch: [] };
16
+ /** The three text fields as wide as the dialog, the label beside each (`PhiLabeledControl`'s `fill`). */
17
+ const FIELD_STYLE = { width: "100%" };
18
+ /*
19
+ * What a file was last started with, remembered in this browser by the file's name, size and date, so
20
+ * picking the same file after a reload fills the fields it was started with -- the same key, size and
21
+ * digests are what make Core answer with the open session and its parts. A convenience of this browser
22
+ * only; without storage the fields start from the file name as usual.
23
+ */
24
+ const DRAFT_STORAGE_KEY = "phi-cdn-upload-drafts";
25
+ function fileIdentity(file) {
26
+ return `${file.name}:${file.size}:${file.lastModified}`;
27
+ }
28
+ function readStoredDraft(file) {
29
+ try {
30
+ const stored = JSON.parse(window.localStorage.getItem(DRAFT_STORAGE_KEY) ?? "{}");
31
+ return stored[fileIdentity(file)] ?? null;
32
+ }
33
+ catch {
34
+ return null;
35
+ }
36
+ }
37
+ function storeDraft(file, draft) {
38
+ try {
39
+ const stored = JSON.parse(window.localStorage.getItem(DRAFT_STORAGE_KEY) ?? "{}");
40
+ if (draft)
41
+ stored[fileIdentity(file)] = draft;
42
+ else
43
+ delete stored[fileIdentity(file)];
44
+ window.localStorage.setItem(DRAFT_STORAGE_KEY, JSON.stringify(stored));
45
+ }
46
+ catch {
47
+ // Storage refused: nothing is remembered, and the upload is not affected.
48
+ }
49
+ }
50
+ function draftFromFile(file, name) {
51
+ const platform = guessPhiCdnPlatform(file.name);
52
+ return {
53
+ name,
54
+ version: "",
55
+ fileName: file.name,
56
+ os: readPhiCdnOsKeys(platform.os),
57
+ arch: readPhiCdnArchKeys(platform.arch),
58
+ };
59
+ }
60
+ /** What is wrong with one segment as the person typed it, before Core is asked; null where nothing is. */
61
+ export function readPhiCdnSegmentProblem(value, kind, labels) {
62
+ const trimmed = value.trim();
63
+ if (!trimmed)
64
+ return labels.required;
65
+ if (kind === "version")
66
+ return PHIS_CDN_KEY_VERSION_PATTERN.test(trimmed) ? null : labels.invalidVersion;
67
+ if (!PHIS_CDN_KEY_SEGMENT_PATTERN.test(trimmed))
68
+ return labels.invalidSegment;
69
+ return kind === "name" && trimmed === "api" ? labels.reservedName : null;
70
+ }
71
+ export function PhiCdnUploadWidgetClient({ config, labels, uploadLabels }) {
72
+ const emitRoutes = useMemo(() => config?.signalRoutes?.emits ?? [], [config?.signalRoutes?.emits]);
73
+ const emitSignal = usePhiSignalEmitter();
74
+ const [names, setNames] = useState([]);
75
+ const [draft, setDraft] = useState(EMPTY_DRAFT);
76
+ // The draft the runner sends with, read when it starts rather than captured when it was made.
77
+ const draftRef = useRef(draft);
78
+ useEffect(() => {
79
+ draftRef.current = draft;
80
+ }, [draft]);
81
+ useEffect(() => {
82
+ const abort = new AbortController();
83
+ void loadPhiCdnNames(abort.signal).then(setNames, () => undefined);
84
+ return () => abort.abort();
85
+ }, []);
86
+ const problems = {
87
+ name: readPhiCdnSegmentProblem(draft.name, "name", labels),
88
+ version: readPhiCdnSegmentProblem(draft.version, "version", labels),
89
+ fileName: readPhiCdnSegmentProblem(draft.fileName, "fileName", labels),
90
+ };
91
+ const runSession = useCallback(async (file, onProgress, _options, signal, onPhase) => {
92
+ const current = draftRef.current;
93
+ const input = {
94
+ name: current.name.trim(),
95
+ version: current.version.trim(),
96
+ fileName: current.fileName.trim(),
97
+ os: writePhiCdnOsBits(current.os),
98
+ arch: writePhiCdnArchBits(current.arch),
99
+ };
100
+ storeDraft(file, { ...current, name: input.name, version: input.version, fileName: input.fileName });
101
+ try {
102
+ const published = await runPhiUploadSession(createPhiCdnUploadTarget(input), file, {
103
+ ...(onProgress ? { onProgress } : {}),
104
+ ...(onPhase ? { onPhase } : {}),
105
+ ...(signal ? { signal } : {}),
106
+ });
107
+ storeDraft(file, null);
108
+ return { asset: published };
109
+ }
110
+ catch (error) {
111
+ if (signal?.aborted && signal.reason === PHI_CDN_UPLOAD_DISCARD)
112
+ storeDraft(file, null);
113
+ throw error;
114
+ }
115
+ }, []);
116
+ const moduleTarget = useMemo(() => ({
117
+ ready: !problems.name && !problems.version && !problems.fileName,
118
+ startLabel: labels.start,
119
+ cancelLabel: labels.cancel,
120
+ cancelReason: PHI_CDN_UPLOAD_DISCARD,
121
+ phaseLabels: { checksum: labels.steps.checksum, finish: labels.steps.verify },
122
+ runSession,
123
+ readError: (error) => {
124
+ if (error instanceof PhiMediaUploadError && error.code === "checksum-unavailable")
125
+ return labels.checksumUnavailable;
126
+ // Core words its refusals for a person (`{ error, message }`); a transport failure says what failed.
127
+ return error instanceof PhiMediaUploadError && error.message ? error.message : null;
128
+ },
129
+ onFilePicked: (file) => setDraft((previous) => readStoredDraft(file) ?? draftFromFile(file, previous.name)),
130
+ onUploaded: () => {
131
+ setDraft(EMPTY_DRAFT);
132
+ void loadPhiCdnNames().then(setNames, () => undefined);
133
+ emitPhiSignalCapability(emitSignal, emitRoutes, "uploaded", null);
134
+ },
135
+ renderFields: ({ file, uploading }) => (_jsxs(PhiFlexControl, { vertical: true, gap: 12, children: [_jsx(PhiSelectControl, { label: labels.name, description: (file && problems.name) || labels.nameHint, presentation: "autocomplete", allowCustom: true, style: FIELD_STYLE, value: draft.name, options: names.map((name) => ({ value: name, label: name })), disabled: uploading, onChange: (name) => setDraft((previous) => ({ ...previous, name: typeof name === "string" ? name : "" })) }), _jsx(PhiTextControl, { label: labels.version, style: FIELD_STYLE, description: (file && problems.version) || undefined, value: draft.version, disabled: uploading, onChange: (version) => setDraft((previous) => ({ ...previous, version: version ?? "" })) }), _jsx(PhiTextControl, { label: labels.fileFileName, style: FIELD_STYLE, description: (file && problems.fileName) || undefined, value: draft.fileName, disabled: uploading || !file, onChange: (fileName) => setDraft((previous) => ({ ...previous, fileName: fileName ?? "" })) }), _jsx(PhiLabeledControl, { label: labels.os, children: _jsx(PhiCheckboxGroupControl, { value: draft.os, options: PHI_CDN_OS_KEYS.map(([key]) => ({ value: key, label: labels.osNames[key] })), disabled: uploading, onChange: (os) => setDraft((previous) => ({ ...previous, os: [...os] })) }) }), _jsx(PhiLabeledControl, { label: labels.arch, children: _jsx(PhiCheckboxGroupControl, { value: draft.arch, options: PHI_CDN_ARCH_KEYS.map(([key]) => ({ value: key, label: labels.archNames[key] })), disabled: uploading, onChange: (arch) => setDraft((previous) => ({ ...previous, arch: [...arch] })) }) })] })),
136
+ }), [draft, emitRoutes, emitSignal, labels, names, problems.fileName, problems.name, problems.version, runSession]);
137
+ return (_jsx(PhiAreaUploadBinding, { labels: uploadLabels, showFinished: false, config: { allowDelete: false, multiple: false, accept: "*/*" }, moduleTarget: moduleTarget }));
138
+ }
@@ -0,0 +1,29 @@
1
+ import { type PhiSignalRouteSet } from "../../../../../types/signals";
2
+ import { type PhiCmsWidgetConfigBase } from "../../../../../widget-config";
3
+ export declare const PHI_CDN_UPLOAD_WIDGET_TYPE: string;
4
+ export type PhiCdnUploadWidgetConfig = PhiCmsWidgetConfigBase & {
5
+ signalRoutes?: PhiSignalRouteSet | null;
6
+ };
7
+ declare function parsePhiCdnUploadWidgetConfig(config: Record<string, unknown>): PhiCdnUploadWidgetConfig;
8
+ export declare const PHI_CDN_UPLOAD_WIDGET_DEFINITION: {
9
+ kind: "widget";
10
+ pluginKey: string;
11
+ typeKey: string;
12
+ slotSizePolicy: "fill-inline";
13
+ title: string;
14
+ category: "media";
15
+ description: string;
16
+ iconFamily: string;
17
+ fields: never[];
18
+ defaultConfig: {};
19
+ parseConfig: typeof parsePhiCdnUploadWidgetConfig;
20
+ runtimeSignals: {
21
+ emits: {
22
+ id: string;
23
+ action: "activate";
24
+ valueType: "none";
25
+ }[];
26
+ listens: never[];
27
+ };
28
+ };
29
+ export {};
@@ -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,
@@ -106,7 +106,8 @@ export default createPhiAuthoringWidgetModule([
106
106
  definePhiAuthoringWidgetModuleLoader(PHI_ENTRY_LIST_WIDGET_DEFINITION, () => import("./widgets/entry-list/authoring").then((module) => module.PHI_ENTRY_LIST_WIDGET_BUILDER_PLUGIN)),
107
107
  definePhiAuthoringWidgetModuleLoader(PHI_ENTRY_DETAIL_WIDGET_DEFINITION, () => import("./widgets/entry-detail/authoring").then((module) => module.PHI_ENTRY_DETAIL_WIDGET_BUILDER_PLUGIN)),
108
108
  definePhiAuthoringWidgetModuleLoader(PHI_ENTRY_HEADER_WIDGET_DEFINITION, () => import("./widgets/entry-header/authoring").then((module) => module.PHI_ENTRY_HEADER_WIDGET_BUILDER_PLUGIN)),
109
- definePhiAuthoringWidgetModuleLoader(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION, () => Promise.resolve(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION)),
109
+ definePhiAuthoringWidgetModuleLoader(PHI_THREAD_CONVERSATION_WIDGET_DEFINITION, () => import("./widgets/thread-conversation/authoring")
110
+ .then((module) => module.PHI_THREAD_CONVERSATION_WIDGET_BUILDER_PLUGIN)),
110
111
  definePhiAuthoringWidgetModuleLoader(PHI_FLOAT_BUTTON_WIDGET_DEFINITION, () => import("./widgets/float-button/authoring").then((module) => module.PHI_FLOAT_BUTTON_WIDGET_BUILDER_PLUGIN)),
111
112
  definePhiAuthoringWidgetModuleLoader(PHI_SPACER_WIDGET_DEFINITION, () => import("./widgets/spacer/authoring").then((module) => module.PHI_SPACER_WIDGET_BUILDER_PLUGIN)),
112
113
  definePhiAuthoringWidgetModuleLoader(PHI_SWITCH_WIDGET_DEFINITION, () => import("./widgets/switch/authoring").then((module) => module.PHI_SWITCH_WIDGET_BUILDER_PLUGIN)),
@@ -0,0 +1,49 @@
1
+ export type PhiThreadConversationLabels = {
2
+ noThreadText: string;
3
+ loadingText: string;
4
+ emptyText: string;
5
+ subjectFallback: string;
6
+ olderLabel: string;
7
+ archivedLabel: string;
8
+ lockedLabel: string;
9
+ lockedText: string;
10
+ replyLabel: string;
11
+ participantsLabel: string;
12
+ internalLabel: string;
13
+ translateLabel: string;
14
+ originalLabel: string;
15
+ machineTranslationLabel: string;
16
+ redactedText: string;
17
+ withheldText: string;
18
+ systemAuthorLabel: string;
19
+ unnamedAuthorLabel: string;
20
+ feedback: {
21
+ errorTitle: string;
22
+ errorGeneric: string;
23
+ errorNetwork: string;
24
+ errorNotFound: string;
25
+ errorTranslation: string;
26
+ };
27
+ /**
28
+ * The made-up conversation the Builder canvas draws in place of one it may not read: who wrote, what
29
+ * they wrote and what hung on it. Never shown on a live Page.
30
+ */
31
+ sample: {
32
+ /** On the heading, so nobody takes the sample for somebody's conversation. */
33
+ tag: string;
34
+ subject: string;
35
+ memberName: string;
36
+ staffName: string;
37
+ /** A conversation: the member asks, staff note it internally and answer with an attachment. */
38
+ question: string;
39
+ note: string;
40
+ answer: string;
41
+ answerAttachment: string;
42
+ /** A file (a placement that names its conversation): staff's notes, one with an attachment. */
43
+ fileCall: string;
44
+ fileAddress: string;
45
+ fileContract: string;
46
+ fileAttachment: string;
47
+ };
48
+ };
49
+ export declare const PHI_THREAD_CONVERSATION_DEFAULT_LABELS: PhiThreadConversationLabels;
@@ -0,0 +1,48 @@
1
+ /*
2
+ * The words of a conversation reader in their source language, where the browser can read them.
3
+ *
4
+ * The Label Set in `labels.ts` is built from these, so each sentence is written once; the server
5
+ * translates the set for the live Widget, and the Builder canvas, which shows every text in its source
6
+ * language, reads them here.
7
+ */
8
+ export const PHI_THREAD_CONVERSATION_DEFAULT_LABELS = {
9
+ noThreadText: "Choose a conversation to read.",
10
+ loadingText: "Loading the conversation.",
11
+ emptyText: "Nothing has been said here yet.",
12
+ subjectFallback: "Conversation",
13
+ olderLabel: "Show earlier messages",
14
+ archivedLabel: "Archived",
15
+ lockedLabel: "Locked",
16
+ lockedText: "This conversation is locked. Nobody can write in it until it is unlocked.",
17
+ replyLabel: "Reply",
18
+ participantsLabel: "In this conversation",
19
+ internalLabel: "Internal note",
20
+ translateLabel: "Translate",
21
+ originalLabel: "Show the original",
22
+ machineTranslationLabel: "Machine translation",
23
+ redactedText: "This message was withdrawn.",
24
+ withheldText: "This message is not shown to you.",
25
+ systemAuthorLabel: "System",
26
+ unnamedAuthorLabel: "Someone",
27
+ feedback: {
28
+ errorTitle: "That did not work",
29
+ errorGeneric: "The conversation could not be loaded.",
30
+ errorNetwork: "The site could not be reached.",
31
+ errorNotFound: "This conversation is not there, or is not yours to read.",
32
+ errorTranslation: "The translation could not be fetched.",
33
+ },
34
+ sample: {
35
+ tag: "Sample",
36
+ subject: "Missing manual",
37
+ memberName: "Alex Example",
38
+ staffName: "Robin Sample",
39
+ question: "Hello, my order arrived without the manual. Could you send it to me?",
40
+ note: "The whole batch shipped without manuals; the warehouse knows.",
41
+ answer: "Thank you for telling us. The manual is attached, and a printed copy is on its way to you.",
42
+ answerAttachment: "manual.pdf",
43
+ fileCall: "Called about the open invoice. Payment follows by the end of the month.",
44
+ fileAddress: "A parcel came back undelivered; the delivery address is corrected.",
45
+ fileContract: "Signed contract received and filed.",
46
+ fileAttachment: "contract.pdf",
47
+ },
48
+ };
@@ -1,5 +1,6 @@
1
1
  import "server-only";
2
2
  import { type PhiGlobalTranslatorOptions } from "../../../../gateway/tr";
3
+ import { type PhiThreadConversationLabels } from "./label-defaults";
3
4
  export declare function getPhiThreadReplyFormLabels(options: PhiGlobalTranslatorOptions): Promise<{
4
5
  replyLabel: string;
5
6
  replyPlaceholder: string;
@@ -9,31 +10,4 @@ export declare function getPhiThreadReplyFormLabels(options: PhiGlobalTranslator
9
10
  audienceInternal: string;
10
11
  replySendLabel: string;
11
12
  }>;
12
- export declare function getPhiThreadConversationLabels(options: PhiGlobalTranslatorOptions): Promise<{
13
- noThreadText: string;
14
- loadingText: string;
15
- emptyText: string;
16
- subjectFallback: string;
17
- olderLabel: string;
18
- archivedLabel: string;
19
- lockedLabel: string;
20
- lockedText: string;
21
- replyLabel: string;
22
- participantsLabel: string;
23
- internalLabel: string;
24
- translateLabel: string;
25
- originalLabel: string;
26
- machineTranslationLabel: string;
27
- redactedText: string;
28
- withheldText: string;
29
- systemAuthorLabel: string;
30
- unnamedAuthorLabel: string;
31
- feedback: {
32
- errorTitle: string;
33
- errorGeneric: string;
34
- errorNetwork: string;
35
- errorNotFound: string;
36
- errorTranslation: string;
37
- };
38
- }>;
39
- export type PhiThreadConversationLabels = Awaited<ReturnType<typeof getPhiThreadConversationLabels>>;
13
+ export declare function getPhiThreadConversationLabels(options: PhiGlobalTranslatorOptions): Promise<PhiThreadConversationLabels>;