@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.
- package/README.md +9 -2
- package/components/cms/phi-cms-layout-renderer.js +15 -7
- package/components/cms/phi-cms-render-diagnostic-client.d.ts +3 -1
- package/components/cms/phi-cms-render-diagnostic-client.js +4 -3
- package/components/cms/phi-cms-render-diagnostic.d.ts +8 -2
- package/components/cms/phi-cms-render-diagnostic.js +12 -2
- package/components/cms/phi-cms-render-error-boundary.d.ts +2 -0
- package/components/cms/phi-cms-render-error-boundary.js +1 -1
- package/components/cms/phi-cms-root-layout.js +3 -1
- package/components/controls/phi-media-picker-control.d.ts +9 -0
- package/components/controls/phi-media-picker-control.js +1 -1
- package/components/controls/phi-popover-control.js +4 -1
- package/components/controls/phi-table-control.d.ts +7 -1
- package/components/controls/phi-table-control.js +26 -11
- package/components/forms/form-descriptor-field-check.d.ts +18 -0
- package/components/forms/form-descriptor-field-check.js +41 -0
- package/components/forms/form-descriptor-runtime-client.js +11 -10
- package/components/forms/form-record-source.d.ts +38 -0
- package/components/forms/form-record-source.js +48 -0
- package/components/forms/shared-form-descriptors.d.ts +0 -34
- package/components/forms/shared-form-descriptors.js +0 -6
- package/components/forms/shared-form-ids.d.ts +1 -1
- package/components/forms/shared-form-ids.js +1 -1
- package/components/media/media-settings-labels.d.ts +1 -0
- package/components/media/media-settings-labels.js +2 -0
- package/components/media/media-upload-flow.d.ts +62 -5
- package/components/media/media-upload-flow.js +62 -24
- package/components/media/phi-area-upload-widget.d.ts +44 -1
- package/components/media/phi-area-upload-widget.js +32 -7
- package/components/media/phi-media-picker-binding.d.ts +41 -33
- package/components/media/phi-media-picker-binding.js +2 -1
- package/components/media/phi-media-upload.d.ts +10 -3
- package/components/media/phi-media-upload.js +11 -8
- package/components/media/use-media-library-add-picker.d.ts +33 -32
- package/components/overlays/phi-overlay-container-client.js +11 -9
- package/components/regions/presets/phi-settings-page-shell-tree.d.ts +7 -0
- package/components/regions/presets/phi-settings-page-shell-tree.js +3 -3
- package/components/shell/phi-icon-names.d.ts +3 -0
- package/components/shell/phi-icon-names.js +3 -0
- package/components/shell/phi-icon.d.ts +5 -7
- package/components/shell/phi-icon.js +8 -21
- package/components/shell/phi-widget-icon.js +1 -0
- package/components/tables/client/phi-table-binding-params.d.ts +24 -0
- package/components/tables/client/phi-table-binding-params.js +39 -0
- package/components/tables/client/phi-table-binding.d.ts +1 -3
- package/components/tables/client/phi-table-binding.js +5 -9
- package/components/widgets/client/html-editor-link-node.d.ts +12 -0
- package/components/widgets/client/html-editor-link-node.js +60 -0
- package/components/widgets/client/html-editor.js +10 -6
- package/components/widgets/client/shared/phi-button-icons.d.ts +6 -4
- package/components/widgets/client/shared/phi-button-icons.js +8 -12
- package/components/widgets/client/shared/phi-collection-binding-params.d.ts +8 -0
- package/components/widgets/client/shared/phi-collection-binding-params.js +13 -0
- package/components/widgets/client/shared/phi-collection-provider.d.ts +11 -1
- package/components/widgets/client/shared/phi-collection-provider.js +5 -0
- package/components/widgets/client/shared/phi-collection-view-binding.d.ts +1 -0
- package/components/widgets/client/shared/phi-collection-view-binding.js +33 -26
- package/components/widgets/client/shared/phi-command-buttons.d.ts +16 -0
- package/components/widgets/client/shared/phi-command-buttons.js +9 -1
- package/components/widgets/label-sets/admin-users.d.ts +1 -0
- package/components/widgets/label-sets/admin-users.js +2 -0
- package/components/widgets/label-sets/builder-modules.js +4 -0
- package/components/widgets/label-sets/profile.d.ts +0 -16
- package/components/widgets/label-sets/profile.js +0 -37
- package/components/widgets/label-sets/registration.d.ts +0 -1
- package/components/widgets/label-sets/registration.js +0 -2
- package/components/widgets/label-sets/revisions.js +2 -0
- package/components/widgets/label-sets/signals.js +2 -0
- package/components/widgets/label-types/builder-modules.d.ts +4 -0
- package/components/widgets/label-types/builder-modules.js +2 -0
- package/components/widgets/label-types/revisions.d.ts +2 -0
- package/components/widgets/label-types/revisions.js +2 -1
- package/components/widgets/label-types/signals.d.ts +2 -0
- package/components/widgets/label-types/signals.js +1 -0
- package/components/widgets/shared/widget-failure-audience.d.ts +7 -0
- package/components/widgets/shared/widget-failure-audience.js +21 -0
- package/components/widgets/shared/widget-failure-client.js +5 -2
- package/components/widgets/shared/widget-failure-notice-client.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice-client.js +10 -0
- package/components/widgets/shared/widget-failure-notice.d.ts +6 -0
- package/components/widgets/shared/widget-failure-notice.js +17 -0
- package/components/widgets/shared/widget-failure-staff.d.ts +3 -0
- package/components/widgets/shared/widget-failure-staff.js +18 -0
- package/components/widgets/shared/widget-failure.d.ts +9 -6
- package/components/widgets/shared/widget-failure.js +0 -9
- package/components/widgets/shared/widget-failure.server.d.ts +4 -2
- package/components/widgets/shared/widget-failure.server.js +8 -3
- package/constants/cms-widget-types.d.ts +1 -0
- package/constants/cms-widget-types.js +3 -0
- package/constants/customer-file.d.ts +12 -3
- package/constants/customer-file.js +12 -3
- package/constants/runtime-module-ownership.js +5 -3
- package/constants/site-address.d.ts +9 -0
- package/constants/site-address.js +10 -0
- package/constants/table-loading.d.ts +14 -0
- package/constants/table-loading.js +14 -0
- package/constants.d.ts +2 -1
- package/constants.js +3 -1
- package/gateway/site-cms-write-validation.js +19 -3
- package/gateway/site-proxy.d.ts +12 -0
- package/gateway/site-proxy.js +20 -0
- package/helpers/announced-action.d.ts +17 -0
- package/helpers/announced-action.js +29 -0
- package/helpers/phi-metadata.d.ts +0 -8
- package/helpers/phi-metadata.js +1 -10
- package/helpers/phi-site-description.d.ts +11 -0
- package/helpers/phi-site-description.js +13 -0
- package/helpers/preset-form-check.d.ts +14 -0
- package/helpers/preset-form-check.js +12 -0
- package/helpers/preset-table-check.d.ts +19 -15
- package/helpers/preset-table-check.js +33 -39
- package/helpers/record-widget-binding.d.ts +10 -0
- package/helpers/record-widget-binding.js +35 -0
- package/helpers/record-widget.d.ts +1 -10
- package/helpers/record-widget.js +4 -33
- package/helpers/table-widget-binding.d.ts +12 -0
- package/helpers/table-widget-binding.js +296 -0
- package/helpers/tree-widget-binding.d.ts +19 -0
- package/helpers/tree-widget-binding.js +72 -0
- package/helpers/typed-confirmation.d.ts +9 -0
- package/helpers/typed-confirmation.js +13 -0
- package/helpers/widget-binding-check.d.ts +22 -0
- package/helpers/widget-binding-check.js +91 -0
- package/module-page-check.d.ts +2 -0
- package/module-page-check.js +2 -0
- package/net/phi-next-proxy.d.ts +7 -0
- package/net/phi-next-proxy.js +1 -1
- package/next/root-route.js +2 -1
- package/package.json +27 -14
- package/plugins/runtime-modules/accounting/ids.d.ts +7 -4
- package/plugins/runtime-modules/accounting/ids.js +14 -3
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.d.ts +21 -9
- package/plugins/runtime-modules/accounting/trees/accounting-customer-file-label-set.js +29 -15
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.d.ts +11 -8
- package/plugins/runtime-modules/accounting/trees/phi-default-accounting-customer-file-page-tree.js +206 -137
- package/plugins/runtime-modules/app/client-data-providers.js +1 -1
- package/plugins/runtime-modules/app/data-providers.d.ts +14 -69
- package/plugins/runtime-modules/app/data-providers.js +19 -54
- package/plugins/runtime-modules/app/definition.d.ts +8 -80
- package/plugins/runtime-modules/app/forms.d.ts +1 -16
- package/plugins/runtime-modules/app/forms.js +0 -59
- package/plugins/runtime-modules/app/ids.d.ts +2 -1
- package/plugins/runtime-modules/app/ids.js +3 -2
- package/plugins/runtime-modules/app/module.d.ts +8 -80
- package/plugins/runtime-modules/app/services/addresses-collection.d.ts +59 -0
- package/plugins/runtime-modules/app/services/{addresses-table.js → addresses-collection.js} +23 -19
- package/plugins/runtime-modules/app/trees/account-addresses-panel.d.ts +10 -6
- package/plugins/runtime-modules/app/trees/account-addresses-panel.js +37 -73
- package/plugins/runtime-modules/app/trees/addresses-label-set.d.ts +0 -5
- package/plugins/runtime-modules/app/trees/addresses-label-set.js +2 -6
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.d.ts +1 -2
- package/plugins/runtime-modules/app/trees/phi-default-app-profile-page-tree.js +1 -17
- package/plugins/runtime-modules/app/trees/profile-label-set.d.ts +0 -2
- package/plugins/runtime-modules/app/trees/profile-label-set.js +2 -14
- package/plugins/runtime-modules/area-contributions/admin.d.ts +1 -1
- package/plugins/runtime-modules/area-contributions/admin.js +2 -0
- package/plugins/runtime-modules/asset/trees/phi-default-admin-media-settings-page-tree.js +5 -0
- package/plugins/runtime-modules/avatar/addresses.d.ts +1 -1
- package/plugins/runtime-modules/builder/clients/inspector-config-field.js +16 -6
- package/plugins/runtime-modules/builder/clients/inspector-image-field.js +3 -1
- package/plugins/runtime-modules/builder/clients/inspector-section-widget.js +3 -1
- package/plugins/runtime-modules/builder/controller/signal-wiring-controller.js +5 -1
- package/plugins/runtime-modules/builder/signal-wiring-options.js +9 -2
- package/plugins/runtime-modules/builder/trees/phi-builder-inspector-area-overlay-tree.server.js +5 -0
- package/plugins/runtime-modules/builder/trees/phi-default-builder-area-preset-tree.js +14 -1
- package/plugins/runtime-modules/cdn/authoring-widgets.d.ts +3 -0
- package/plugins/runtime-modules/cdn/authoring-widgets.js +7 -0
- package/plugins/runtime-modules/cdn/authoring.d.ts +1 -0
- package/plugins/runtime-modules/cdn/authoring.js +8 -0
- package/plugins/runtime-modules/cdn/bytes.d.ts +5 -0
- package/plugins/runtime-modules/cdn/bytes.js +17 -0
- package/plugins/runtime-modules/cdn/client-data-providers.d.ts +7 -0
- package/plugins/runtime-modules/cdn/client-data-providers.js +9 -0
- package/plugins/runtime-modules/cdn/data-providers.d.ts +134 -0
- package/plugins/runtime-modules/cdn/data-providers.js +117 -0
- package/plugins/runtime-modules/cdn/definition.d.ts +140 -0
- package/plugins/runtime-modules/cdn/definition.js +23 -0
- package/plugins/runtime-modules/cdn/ids.d.ts +18 -0
- package/plugins/runtime-modules/cdn/ids.js +20 -0
- package/plugins/runtime-modules/cdn/module.d.ts +131 -0
- package/plugins/runtime-modules/cdn/module.js +4 -0
- package/plugins/runtime-modules/cdn/platform.d.ts +25 -0
- package/plugins/runtime-modules/cdn/platform.js +73 -0
- package/plugins/runtime-modules/cdn/presets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/presets.js +20 -0
- package/plugins/runtime-modules/cdn/server.d.ts +1 -0
- package/plugins/runtime-modules/cdn/server.js +14 -0
- package/plugins/runtime-modules/cdn/services/table.d.ts +11 -0
- package/plugins/runtime-modules/cdn/services/table.js +296 -0
- package/plugins/runtime-modules/cdn/services/upload.d.ts +20 -0
- package/plugins/runtime-modules/cdn/services/upload.js +146 -0
- package/plugins/runtime-modules/cdn/table-params.d.ts +10 -0
- package/plugins/runtime-modules/cdn/table-params.js +10 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.d.ts +95 -0
- package/plugins/runtime-modules/cdn/trees/admin-cdn-label-set.js +156 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.d.ts +18 -0
- package/plugins/runtime-modules/cdn/trees/phi-default-admin-cdn-page-tree.js +479 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.d.ts +12 -0
- package/plugins/runtime-modules/cdn/widgets/upload/client.js +138 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.d.ts +29 -0
- package/plugins/runtime-modules/cdn/widgets/upload/config.js +43 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.d.ts +24 -0
- package/plugins/runtime-modules/cdn/widgets/upload/label-types.js +1 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.d.ts +4 -0
- package/plugins/runtime-modules/cdn/widgets/upload/labels.js +72 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.d.ts +3 -0
- package/plugins/runtime-modules/cdn/widgets/upload/plugin.js +7 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.d.ts +8 -0
- package/plugins/runtime-modules/cdn/widgets/upload/server.js +17 -0
- package/plugins/runtime-modules/cdn/widgets.d.ts +2 -0
- package/plugins/runtime-modules/cdn/widgets.js +13 -0
- package/plugins/runtime-modules/client-authoring-providers/admin.d.ts +1 -1
- package/plugins/runtime-modules/client-authoring-providers/admin.js +6 -0
- package/plugins/runtime-modules/client-manifests/admin.js +11 -1
- package/plugins/runtime-modules/client-manifests/common.js +6 -0
- package/plugins/runtime-modules/core/widgets/card/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/asset-binding.js +1 -1
- package/plugins/runtime-modules/core/widgets/collection-view/client.js +5 -2
- package/plugins/runtime-modules/core/widgets/collection-view/config.js +8 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.d.ts +55 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-binding.js +175 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.d.ts +48 -0
- package/plugins/runtime-modules/core/widgets/collection-view/site-address-tiles.js +67 -0
- package/plugins/runtime-modules/core/widgets/command-toolbar/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/description/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/entry-list/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/float-button/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/form/config.js +14 -1
- package/plugins/runtime-modules/core/widgets/gallery/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/markdown/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/record/client.js +2 -6
- package/plugins/runtime-modules/core/widgets/result/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/simple-text/config.d.ts +1 -1
- package/plugins/runtime-modules/core/widgets/table/client.js +36 -52
- package/plugins/runtime-modules/core/widgets/table/config.d.ts +3 -3
- package/plugins/runtime-modules/core/widgets/table/config.js +3 -0
- package/plugins/runtime-modules/core/widgets/thread-conversation/client.js +2 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.d.ts +6 -2
- package/plugins/runtime-modules/core/widgets/thread-conversation/config.js +6 -1
- package/plugins/runtime-modules/core/widgets/thread-widget-config.d.ts +10 -0
- package/plugins/runtime-modules/core/widgets/thread-widget-config.js +6 -0
- package/plugins/runtime-modules/core/widgets/tree/client.js +6 -6
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.d.ts +2 -0
- package/plugins/runtime-modules/localization/trees/editor-translations-widget-label-set.js +2 -0
- package/plugins/runtime-modules/localization/trees/phi-default-editor-translations-page-tree.js +5 -0
- package/plugins/runtime-modules/revisions/controller/binding.d.ts +37 -0
- package/plugins/runtime-modules/revisions/controller/binding.js +75 -0
- package/plugins/runtime-modules/revisions/controller/client.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/client.js +74 -50
- package/plugins/runtime-modules/revisions/controller/definition.d.ts +5 -0
- package/plugins/runtime-modules/revisions/controller/definition.js +10 -0
- package/plugins/runtime-modules/revisions/forms.js +1 -1
- package/plugins/runtime-modules/revisions/page-ids.d.ts +1 -1
- package/plugins/runtime-modules/revisions/page-ids.js +4 -1
- package/plugins/runtime-modules/revisions/services/options.js +14 -4
- package/plugins/runtime-modules/revisions/services/table.js +41 -21
- package/plugins/runtime-modules/revisions/trees/phi-default-builder-revisions-page-tree.js +76 -3
- package/plugins/runtime-modules/theme/controller/runtime.js +14 -2
- package/plugins/runtime-modules/theme/widgets/brand-controls/client.js +39 -13
- package/plugins/runtime-modules/threads/client-data-providers.js +5 -0
- package/plugins/runtime-modules/threads/controller/client.js +62 -2
- package/plugins/runtime-modules/threads/controller/definition.js +48 -0
- package/plugins/runtime-modules/threads/data-providers.d.ts +22 -37
- package/plugins/runtime-modules/threads/data-providers.js +35 -24
- package/plugins/runtime-modules/threads/definition.d.ts +22 -37
- package/plugins/runtime-modules/threads/ids.d.ts +2 -0
- package/plugins/runtime-modules/threads/ids.js +2 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.d.ts +30 -0
- package/plugins/runtime-modules/threads/services/customer-file-addresses.js +59 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.d.ts +22 -0
- package/plugins/runtime-modules/threads/services/customer-file-read.js +101 -0
- package/plugins/runtime-modules/threads/services/customer-file-table.d.ts +14 -80
- package/plugins/runtime-modules/threads/services/customer-file-table.js +27 -112
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.d.ts +4 -0
- package/plugins/runtime-modules/user-management/trees/admin-users-access-label-set.js +4 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-access-page-tree.js +15 -0
- package/plugins/runtime-modules/user-management/trees/phi-default-admin-users-page-tree.js +5 -0
- package/server-helpers/runtime.js +0 -1
- package/styles/controls.css +4 -2
- package/styles/layout.css +7 -0
- package/theme/phi-antd-token-resolver.d.ts +8 -0
- package/theme/phi-antd-token-resolver.js +10 -0
- package/theme/phi-theme-color.d.ts +19 -0
- package/theme/phi-theme-color.js +42 -0
- package/theme/phi-theme-gradients.js +4 -22
- package/theme/phi-theme-palette-defaults.d.ts +16 -0
- package/theme/phi-theme-palette-defaults.js +103 -0
- package/types/cms-plugins.d.ts +6 -1
- package/types/collection-provider.d.ts +27 -0
- package/types/collection-signal-values.d.ts +2 -0
- package/types/collection-signal-values.js +23 -0
- package/types/collection-view-widget.d.ts +9 -0
- package/types/core-widget-placements.d.ts +6 -0
- package/types/signals.d.ts +2 -0
- package/types/signals.js +2 -0
- package/types/table-widget.d.ts +17 -3
- package/types/table-widget.js +0 -282
- package/types/tree-widget.d.ts +0 -1
- package/types/tree-widget.js +0 -60
- package/types/widget-runtime.d.ts +0 -1
- package/types.d.ts +1 -1
- package/types.js +1 -1
- package/plugins/runtime-modules/app/services/addresses-table.d.ts +0 -135
|
@@ -226,40 +226,6 @@ export declare const PHI_REGISTRATION_FORM_DESCRIPTOR: {
|
|
|
226
226
|
readonly fallback: "/terms-and-conditions";
|
|
227
227
|
};
|
|
228
228
|
};
|
|
229
|
-
}, {
|
|
230
|
-
readonly key: "newsletter";
|
|
231
|
-
readonly fieldProviderKey: `${string}/${string}`;
|
|
232
|
-
readonly controlLabel: PhiFormTextDescriptor;
|
|
233
|
-
readonly placement: {
|
|
234
|
-
readonly label: {
|
|
235
|
-
readonly compact: {
|
|
236
|
-
readonly start: 1;
|
|
237
|
-
readonly end: number;
|
|
238
|
-
};
|
|
239
|
-
readonly medium: {
|
|
240
|
-
readonly start: 1;
|
|
241
|
-
readonly end: number;
|
|
242
|
-
};
|
|
243
|
-
readonly wide: {
|
|
244
|
-
readonly start: 1;
|
|
245
|
-
readonly end: number;
|
|
246
|
-
};
|
|
247
|
-
};
|
|
248
|
-
readonly control: {
|
|
249
|
-
readonly compact: {
|
|
250
|
-
readonly start: 1;
|
|
251
|
-
readonly end: number;
|
|
252
|
-
};
|
|
253
|
-
readonly medium: {
|
|
254
|
-
readonly start: 1;
|
|
255
|
-
readonly end: number;
|
|
256
|
-
};
|
|
257
|
-
readonly wide: {
|
|
258
|
-
readonly start: 1;
|
|
259
|
-
readonly end: number;
|
|
260
|
-
};
|
|
261
|
-
};
|
|
262
|
-
};
|
|
263
229
|
}];
|
|
264
230
|
readonly success: {
|
|
265
231
|
readonly title: PhiFormTextDescriptor;
|
|
@@ -176,12 +176,6 @@ export const PHI_REGISTRATION_FORM_DESCRIPTOR = {
|
|
|
176
176
|
href: { kind: "config", key: "termsHref", fallback: "/terms-and-conditions" },
|
|
177
177
|
},
|
|
178
178
|
},
|
|
179
|
-
{
|
|
180
|
-
key: "newsletter",
|
|
181
|
-
fieldProviderKey: PHI_FORM_FIELD_PROVIDER_KEYS.checkbox,
|
|
182
|
-
controlLabel: label("consent.newsletter", "Send me product and platform updates."),
|
|
183
|
-
placement: PHI_FORM_STACKED_FULL,
|
|
184
|
-
},
|
|
185
179
|
],
|
|
186
180
|
success: {
|
|
187
181
|
title: label("feedback.successTitle", "Account created"),
|
|
@@ -26,7 +26,7 @@ export declare const PHI_SHARED_FORM_IDS: {
|
|
|
26
26
|
/**
|
|
27
27
|
* The two credentials a signed-in person changes about themselves.
|
|
28
28
|
*
|
|
29
|
-
* They belong beside the sign-in Forms rather than with the profile's name and
|
|
29
|
+
* They belong beside the sign-in Forms rather than with the profile's name and language, for the
|
|
30
30
|
* same reason the security Page belongs to this Module: a password and the address it is tied to are
|
|
31
31
|
* how somebody proves who they are, and whoever answers that question owns the Forms that change it.
|
|
32
32
|
*/
|
|
@@ -28,7 +28,7 @@ export const PHI_SHARED_FORM_IDS = {
|
|
|
28
28
|
/**
|
|
29
29
|
* The two credentials a signed-in person changes about themselves.
|
|
30
30
|
*
|
|
31
|
-
* They belong beside the sign-in Forms rather than with the profile's name and
|
|
31
|
+
* They belong beside the sign-in Forms rather than with the profile's name and language, for the
|
|
32
32
|
* same reason the security Page belongs to this Module: a password and the address it is tied to are
|
|
33
33
|
* how somebody proves who they are, and whoever answers that question owns the Forms that change it.
|
|
34
34
|
*/
|
|
@@ -64,6 +64,7 @@ const PHI_MEDIA_SETTINGS_PAGE_LABEL_SET = definePhiLabelSet({
|
|
|
64
64
|
spaces_used: "Used",
|
|
65
65
|
spaces_search: "Search",
|
|
66
66
|
spaces_empty: definePhiMessageLabel("No Space of this kind exists yet."),
|
|
67
|
+
spaces_footer: "%1 Spaces",
|
|
67
68
|
},
|
|
68
69
|
});
|
|
69
70
|
export async function getPhiMediaSettingsPageLabels(options) {
|
|
@@ -139,6 +140,7 @@ export async function getPhiMediaSettingsPageLabels(options) {
|
|
|
139
140
|
used: labels.spaces_used,
|
|
140
141
|
search: labels.spaces_search,
|
|
141
142
|
empty: labels.spaces_empty,
|
|
143
|
+
footer: labels.spaces_footer,
|
|
142
144
|
},
|
|
143
145
|
submitLabel: labels.submit_label,
|
|
144
146
|
};
|
|
@@ -107,7 +107,7 @@ export type PhiMediaUploadProgressHandler = (progress: number) => void;
|
|
|
107
107
|
* uses the Add-on's root. Making it a parameter is what lets the acceptance, the progress, the refusal
|
|
108
108
|
* and the labels stay shared instead of being written twice with the second one drifting.
|
|
109
109
|
*/
|
|
110
|
-
export type PhiMediaUploadSessionRunner = (file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal) => Promise<{
|
|
110
|
+
export type PhiMediaUploadSessionRunner = (file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal, onPhase?: (phase: PhiUploadPhase) => void) => Promise<{
|
|
111
111
|
asset: {
|
|
112
112
|
id: number;
|
|
113
113
|
};
|
|
@@ -141,7 +141,7 @@ type PhiMediaUploadInitSession = {
|
|
|
141
141
|
/** Null where the Server asked for none: every plan but one sent in parts. */
|
|
142
142
|
heartbeat: PhiMediaUploadHeartbeat | null;
|
|
143
143
|
};
|
|
144
|
-
type PhiMediaUploadHeartbeat = {
|
|
144
|
+
export type PhiMediaUploadHeartbeat = {
|
|
145
145
|
url: string;
|
|
146
146
|
intervalMs: number;
|
|
147
147
|
};
|
|
@@ -272,16 +272,73 @@ export declare function uploadPhiMediaUploadBody(plan: PhiMediaUploadPlan, file:
|
|
|
272
272
|
/** Parts an earlier attempt delivered, where this session was taken over rather than opened. */
|
|
273
273
|
stored?: readonly PhiMediaUploadStoredPart[],
|
|
274
274
|
/** Stops the body where it is; what is in flight is aborted and the call throws `cancelled`. */
|
|
275
|
-
signal?: AbortSignal
|
|
275
|
+
signal?: AbortSignal,
|
|
276
|
+
/** What a delivered part answers with (`PhiUploadPartReceipt`); a storage's entity tag unless said. */
|
|
277
|
+
receipt?: PhiUploadPartReceipt): Promise<PhiMediaUploadUploadResponse>;
|
|
276
278
|
/**
|
|
277
|
-
*
|
|
279
|
+
* What a delivered part of a body answers with.
|
|
280
|
+
*
|
|
281
|
+
* `etag`: the storage's entity tag, which a completion names every part by -- a part delivered to a
|
|
282
|
+
* presigned storage address, whose tag the browser has to read and hand on. `none`: nothing to hand on --
|
|
283
|
+
* a part delivered to a route of this Site's server, which completes the assembly itself and asks the
|
|
284
|
+
* storage what it holds.
|
|
285
|
+
*/
|
|
286
|
+
export type PhiUploadPartReceipt = "etag" | "none";
|
|
287
|
+
/**
|
|
288
|
+
* Where an upload stands, for a surface that says more than a percentage: the file is hashed and the
|
|
289
|
+
* session opened (`checksum`), its body travels (`transfer`, which the progress figures belong to), and
|
|
290
|
+
* the place it went settles it (`finish`) -- an Asset made, a file hashed whole and recorded.
|
|
291
|
+
*/
|
|
292
|
+
export type PhiUploadPhase = "checksum" | "transfer" | "finish";
|
|
293
|
+
/** One upload, opened by its target: how the body travels, and how its target settles or drops it. */
|
|
294
|
+
export type PhiUploadSession<TResult> = {
|
|
295
|
+
plan: PhiMediaUploadPlan;
|
|
296
|
+
/** Parts an earlier attempt delivered; the plan addresses only what is missing. */
|
|
297
|
+
uploaded: readonly PhiMediaUploadStoredPart[];
|
|
298
|
+
/** Null where the target asks for none. */
|
|
299
|
+
heartbeat: PhiMediaUploadHeartbeat | null;
|
|
300
|
+
/** What a delivered part answers with. `etag` where the target says nothing. */
|
|
301
|
+
partReceipt?: PhiUploadPartReceipt;
|
|
302
|
+
/**
|
|
303
|
+
* Called when the body starts to travel; returns the way to stop. For a target that tells its server
|
|
304
|
+
* when the page goes away mid-body (`pagehide`).
|
|
305
|
+
*/
|
|
306
|
+
watchLeaving?: () => () => void;
|
|
307
|
+
/** The body did not arrive, for whichever reason the error says: what the target does about it. */
|
|
308
|
+
abandon: (error: unknown, signal: AbortSignal | undefined) => Promise<void>;
|
|
309
|
+
/** The body arrived: the target settles it, with what the transport reported back. */
|
|
310
|
+
finish: (completion: unknown, signal: AbortSignal | undefined) => Promise<TResult>;
|
|
311
|
+
};
|
|
312
|
+
/** Where an upload goes: Core's Media routes, or another place that takes a body the same way. */
|
|
313
|
+
export type PhiUploadTarget<TResult> = {
|
|
314
|
+
/** Hashes what it needs and opens -- or takes up again -- the session for this file. */
|
|
315
|
+
open: (file: File, signal: AbortSignal | undefined) => Promise<PhiUploadSession<TResult>>;
|
|
316
|
+
};
|
|
317
|
+
/**
|
|
318
|
+
* One file through an upload target, from chosen to settled.
|
|
319
|
+
*
|
|
320
|
+
* The sequence every upload of this package runs, whichever target it is for: open (hashing first), keep
|
|
321
|
+
* the session alive while parts travel, send the body by its plan -- the parts the target does not hold
|
|
322
|
+
* yet, several at once, each tried again after a transport failure or a `5xx` -- and settle it. `signal`
|
|
323
|
+
* stops it up to the moment `finish` begins: an open in flight is aborted, a body in flight is aborted
|
|
324
|
+
* and reported `cancelled`, and the target is told (`abandon`). Once `finish` runs it is not stopped
|
|
325
|
+
* midway -- the target is already turning the body into what it stores, and stopping would only hide the
|
|
326
|
+
* answer; `finish` itself decides whether it still waits for one.
|
|
327
|
+
*/
|
|
328
|
+
export declare function runPhiUploadSession<TResult>(target: PhiUploadTarget<TResult>, file: File, { onProgress, onPhase, signal, }?: {
|
|
329
|
+
onProgress?: PhiMediaUploadProgressHandler;
|
|
330
|
+
onPhase?: (phase: PhiUploadPhase) => void;
|
|
331
|
+
signal?: AbortSignal;
|
|
332
|
+
}): Promise<TResult>;
|
|
333
|
+
/**
|
|
334
|
+
* One file through Core's own upload routes (`runPhiUploadSession` with Core's Media target).
|
|
278
335
|
*
|
|
279
336
|
* `signal` stops it up to the moment finalize is sent: an init in flight is aborted, a body in flight is
|
|
280
337
|
* aborted and reported `cancelled`, so the Server clears up the reservation and whatever arrived. Once
|
|
281
338
|
* finalize is sent it is not stopped -- the Server is already turning the body into an Asset, and aborting
|
|
282
339
|
* the request would only hide the answer. A caller that stopped it ignores what comes back.
|
|
283
340
|
*/
|
|
284
|
-
export declare function runPhiMediaUploadSession(file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal): Promise<PhiMediaUploadSessionResult>;
|
|
341
|
+
export declare function runPhiMediaUploadSession(file: File, onProgress?: PhiMediaUploadProgressHandler, options?: PhiMediaUploadInitOptions, signal?: AbortSignal, onPhase?: (phase: PhiUploadPhase) => void): Promise<PhiMediaUploadSessionResult>;
|
|
285
342
|
/**
|
|
286
343
|
* A place an Add-on's route made for a file, as `assets:v1` answered it.
|
|
287
344
|
*
|
|
@@ -504,7 +504,7 @@ export async function initPhiMediaUploadSession(file, options, signal) {
|
|
|
504
504
|
* Retried on a transport failure and on a `5xx`, and never on a `4xx`: a signature the endpoint rejected
|
|
505
505
|
* will be rejected again, and repeating it only delays saying so.
|
|
506
506
|
*/
|
|
507
|
-
async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal) {
|
|
507
|
+
async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal, receipt = "etag") {
|
|
508
508
|
let lastError = null;
|
|
509
509
|
for (let attempt = 1; attempt <= PHI_MEDIA_UPLOAD_PART_ATTEMPTS; attempt += 1) {
|
|
510
510
|
throwIfPhiMediaUploadAborted(signal);
|
|
@@ -529,8 +529,8 @@ async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal) {
|
|
|
529
529
|
reject(new PhiMediaUploadError(`Part ${part.partNumber} was refused (${xhr.status}).`, PHI_MEDIA_UPLOAD_FAILURE_REASONS.StorageRejected, xhr.status));
|
|
530
530
|
return;
|
|
531
531
|
}
|
|
532
|
-
const eTag = (xhr.getResponseHeader("etag") ?? "").trim();
|
|
533
|
-
if (!eTag) {
|
|
532
|
+
const eTag = receipt === "etag" ? (xhr.getResponseHeader("etag") ?? "").trim() : "";
|
|
533
|
+
if (receipt === "etag" && !eTag) {
|
|
534
534
|
reject(new PhiMediaUploadError(`Part ${part.partNumber} arrived without an entity tag, so it cannot be assembled.`, PHI_MEDIA_UPLOAD_FAILURE_REASONS.ClientError, xhr.status));
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
@@ -582,7 +582,7 @@ async function uploadPhiMediaUploadPart(part, body, onPartProgress, signal) {
|
|
|
582
582
|
*/
|
|
583
583
|
async function uploadPhiMediaUploadParts(plan, file, onProgress,
|
|
584
584
|
/** What an earlier attempt already delivered, which this one neither sends nor waits for. */
|
|
585
|
-
stored = [], signal) {
|
|
585
|
+
stored = [], signal, receipt = "etag") {
|
|
586
586
|
const loadedByPart = new Map();
|
|
587
587
|
const report = () => onProgress?.(resolvePhiMediaUploadPartProgress(loadedByPart, file.size));
|
|
588
588
|
const stop = new AbortController();
|
|
@@ -616,7 +616,7 @@ stored = [], signal) {
|
|
|
616
616
|
return;
|
|
617
617
|
loadedByPart.set(part.partNumber, loadedBytes);
|
|
618
618
|
report();
|
|
619
|
-
}, stop.signal));
|
|
619
|
+
}, stop.signal, receipt));
|
|
620
620
|
}
|
|
621
621
|
catch (error) {
|
|
622
622
|
// The first failure is the one reported; the others are this one stopping them.
|
|
@@ -648,10 +648,12 @@ export async function uploadPhiMediaUploadBody(plan, file, onProgress,
|
|
|
648
648
|
/** Parts an earlier attempt delivered, where this session was taken over rather than opened. */
|
|
649
649
|
stored = [],
|
|
650
650
|
/** Stops the body where it is; what is in flight is aborted and the call throws `cancelled`. */
|
|
651
|
-
signal
|
|
651
|
+
signal,
|
|
652
|
+
/** What a delivered part answers with (`PhiUploadPartReceipt`); a storage's entity tag unless said. */
|
|
653
|
+
receipt = "etag") {
|
|
652
654
|
throwIfPhiMediaUploadAborted(signal);
|
|
653
655
|
if (plan.kind === "multipart-put") {
|
|
654
|
-
return await uploadPhiMediaUploadParts(plan, file, onProgress, stored, signal);
|
|
656
|
+
return await uploadPhiMediaUploadParts(plan, file, onProgress, stored, signal, receipt);
|
|
655
657
|
}
|
|
656
658
|
if (plan.kind !== "proxy-stream" && plan.kind !== "presigned-put") {
|
|
657
659
|
// A newer control plane issued a plan this Client cannot carry out. Saying so is the only safe
|
|
@@ -778,32 +780,36 @@ async function readPhiMediaUploadCancellation(run, signal) {
|
|
|
778
780
|
}
|
|
779
781
|
}
|
|
780
782
|
/**
|
|
781
|
-
* One file through
|
|
783
|
+
* One file through an upload target, from chosen to settled.
|
|
782
784
|
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
785
|
-
*
|
|
786
|
-
* the
|
|
785
|
+
* The sequence every upload of this package runs, whichever target it is for: open (hashing first), keep
|
|
786
|
+
* the session alive while parts travel, send the body by its plan -- the parts the target does not hold
|
|
787
|
+
* yet, several at once, each tried again after a transport failure or a `5xx` -- and settle it. `signal`
|
|
788
|
+
* stops it up to the moment `finish` begins: an open in flight is aborted, a body in flight is aborted
|
|
789
|
+
* and reported `cancelled`, and the target is told (`abandon`). Once `finish` runs it is not stopped
|
|
790
|
+
* midway -- the target is already turning the body into what it stores, and stopping would only hide the
|
|
791
|
+
* answer; `finish` itself decides whether it still waits for one.
|
|
787
792
|
*/
|
|
788
|
-
export async function
|
|
789
|
-
|
|
790
|
-
const
|
|
791
|
-
const
|
|
793
|
+
export async function runPhiUploadSession(target, file, { onProgress, onPhase, signal, } = {}) {
|
|
794
|
+
onPhase?.("checksum");
|
|
795
|
+
const session = await readPhiMediaUploadCancellation(() => target.open(file, signal), signal);
|
|
796
|
+
const standDown = session.watchLeaving?.() ?? (() => { });
|
|
797
|
+
const stopBeating = keepPhiMediaUploadHeartbeat(session.heartbeat);
|
|
798
|
+
onPhase?.("transfer");
|
|
792
799
|
let upload;
|
|
793
800
|
try {
|
|
794
|
-
upload = await uploadPhiMediaUploadBody(
|
|
795
|
-
// Stopped after the last byte and before
|
|
801
|
+
upload = await uploadPhiMediaUploadBody(session.plan, file, onProgress, session.uploaded, signal, session.partReceipt);
|
|
802
|
+
// Stopped after the last byte and before it was settled: the body is there, and nobody wants it.
|
|
796
803
|
throwIfPhiMediaUploadAborted(signal);
|
|
797
804
|
}
|
|
798
805
|
catch (uploadError) {
|
|
799
806
|
stopBeating();
|
|
800
807
|
standDown();
|
|
801
|
-
|
|
802
|
-
await reportPhiMediaUploadFailure(init.reportUrl, readPhiMediaUploadFailureReason(uploadError), uploadError instanceof Error ? uploadError.message : null);
|
|
808
|
+
await session.abandon(uploadError, signal);
|
|
803
809
|
throw uploadError;
|
|
804
810
|
}
|
|
805
811
|
/*
|
|
806
|
-
* Stood down before
|
|
812
|
+
* Stood down before settling begins, and deliberately not after it answers.
|
|
807
813
|
*
|
|
808
814
|
* Once the Server holds the finalize request it copies the staged object onto its final key and closes
|
|
809
815
|
* the session; a beacon arriving in the middle of that would be a second request racing the first for
|
|
@@ -814,12 +820,44 @@ export async function runPhiMediaUploadSession(file, onProgress, options, signal
|
|
|
814
820
|
*/
|
|
815
821
|
stopBeating();
|
|
816
822
|
standDown();
|
|
817
|
-
|
|
823
|
+
onPhase?.("finish");
|
|
824
|
+
return await session.finish(upload.completion, signal);
|
|
825
|
+
}
|
|
826
|
+
/** Core's own Media upload routes as an upload target: init, the report of a failure, and finalize. */
|
|
827
|
+
function createPhiMediaUploadTarget(options) {
|
|
818
828
|
return {
|
|
819
|
-
|
|
820
|
-
|
|
829
|
+
open: async (file, signal) => {
|
|
830
|
+
const init = await initPhiMediaUploadSession(file, options, signal);
|
|
831
|
+
return {
|
|
832
|
+
plan: init.plan,
|
|
833
|
+
uploaded: init.uploaded,
|
|
834
|
+
heartbeat: init.heartbeat,
|
|
835
|
+
watchLeaving: () => reportPhiMediaUploadAbandonmentOnLeaving(init.reportUrl, init.plan),
|
|
836
|
+
// The Server cannot see this leg, so it is told rather than left to infer it from an expiry.
|
|
837
|
+
abandon: (error) => reportPhiMediaUploadFailure(init.reportUrl, readPhiMediaUploadFailureReason(error), error instanceof Error ? error.message : null),
|
|
838
|
+
finish: async (completion) => {
|
|
839
|
+
const finalize = await finalizePhiMediaUploadSession(init.finalizeUrl, completion);
|
|
840
|
+
return { asset: finalize.asset, token: init.token };
|
|
841
|
+
},
|
|
842
|
+
};
|
|
843
|
+
},
|
|
821
844
|
};
|
|
822
845
|
}
|
|
846
|
+
/**
|
|
847
|
+
* One file through Core's own upload routes (`runPhiUploadSession` with Core's Media target).
|
|
848
|
+
*
|
|
849
|
+
* `signal` stops it up to the moment finalize is sent: an init in flight is aborted, a body in flight is
|
|
850
|
+
* aborted and reported `cancelled`, so the Server clears up the reservation and whatever arrived. Once
|
|
851
|
+
* finalize is sent it is not stopped -- the Server is already turning the body into an Asset, and aborting
|
|
852
|
+
* the request would only hide the answer. A caller that stopped it ignores what comes back.
|
|
853
|
+
*/
|
|
854
|
+
export async function runPhiMediaUploadSession(file, onProgress, options, signal, onPhase) {
|
|
855
|
+
return await runPhiUploadSession(createPhiMediaUploadTarget(options), file, {
|
|
856
|
+
...(onProgress ? { onProgress } : {}),
|
|
857
|
+
...(onPhase ? { onPhase } : {}),
|
|
858
|
+
...(signal ? { signal } : {}),
|
|
859
|
+
});
|
|
860
|
+
}
|
|
823
861
|
/**
|
|
824
862
|
* Carries out an upload an Add-on's own route reserved.
|
|
825
863
|
*
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
1
2
|
import type { PhiCmsAreaUploadWidgetConfig } from "../../types/media";
|
|
2
3
|
import type { PhiMediaAssetTile } from "../../types/media";
|
|
3
4
|
import type { PhiCollectionProviderQuery } from "../../types/collection-provider";
|
|
4
5
|
import type { PhiAreaUploadWidgetLabels } from "./media-widget-labels";
|
|
6
|
+
import { type PhiMediaUploadSessionRunner, type PhiUploadPhase } from "./media-upload-flow";
|
|
5
7
|
import { type PhiMediaUploadAcceptance } from "./phi-media-upload";
|
|
6
8
|
import { type PhiImagePreviewStoreState } from "./phi-image-preview-store";
|
|
7
9
|
export type PhiAreaUploadWidgetProps = {
|
|
@@ -44,5 +46,46 @@ export type PhiAreaUploadWidgetProps = {
|
|
|
44
46
|
query: PhiCollectionProviderQuery;
|
|
45
47
|
};
|
|
46
48
|
};
|
|
47
|
-
|
|
49
|
+
/**
|
|
50
|
+
* A Module's own upload through this surface, in place of the Media library's: its fields stand in front
|
|
51
|
+
* of the file, its runner takes the file somewhere else (`runPhiUploadSession` with the Module's target),
|
|
52
|
+
* and what arrived is the Module's to show. The drop area, the file's tile with its progress, its refusal
|
|
53
|
+
* and its retry, and the stop when the surface goes away stay this surface's. The CDN page's upload is
|
|
54
|
+
* the one that asked: a file published under a name, a version and a file name the person states.
|
|
55
|
+
*
|
|
56
|
+
* A file picked here is held until the person sends it (`startLabel`), because the Module's fields may
|
|
57
|
+
* start from it -- a file name, a platform read from the extension -- and are only complete once they do.
|
|
58
|
+
* One file at a time.
|
|
59
|
+
*
|
|
60
|
+
* Not part of `PhiAreaUploadWidgetProps`, which a Site can place: a target is code, never configuration.
|
|
61
|
+
*/
|
|
62
|
+
export type PhiAreaUploadModuleTarget<TResult> = {
|
|
63
|
+
/** The Module's fields, drawn in front of the file, told which file is held and whether one is on its way. */
|
|
64
|
+
renderFields: (state: {
|
|
65
|
+
file: File | null;
|
|
66
|
+
uploading: boolean;
|
|
67
|
+
}) => ReactNode;
|
|
68
|
+
/** A file was picked, for fields that start from it. */
|
|
69
|
+
onFilePicked?: (file: File) => void;
|
|
70
|
+
/** Whether the held file may be sent: the Module's fields hold what its target needs. */
|
|
71
|
+
ready: boolean;
|
|
72
|
+
startLabel: string;
|
|
73
|
+
cancelLabel: string;
|
|
74
|
+
/** Where the file goes (`usePhiMediaUpload`'s runner); its third argument, the Media init options, is unused. */
|
|
75
|
+
runSession: (...args: Parameters<PhiMediaUploadSessionRunner>) => Promise<{
|
|
76
|
+
asset: TResult;
|
|
77
|
+
}>;
|
|
78
|
+
/** The target's own words for a refusal; null falls back to the Media refusals. */
|
|
79
|
+
readError?: (error: unknown) => string | null;
|
|
80
|
+
/** What the file's tag says while it is hashed and while the target settles it, in place of a percentage. */
|
|
81
|
+
phaseLabels?: Partial<Record<PhiUploadPhase, string>>;
|
|
82
|
+
/** The abort reason Cancel stops the upload with, for a target that tells a stop from a discard. */
|
|
83
|
+
cancelReason?: unknown;
|
|
84
|
+
/** What arrived. The surface says so as it says it for an Asset, and holds no file any more. */
|
|
85
|
+
onUploaded: (result: TResult, file: File) => void;
|
|
86
|
+
};
|
|
87
|
+
export type PhiAreaUploadBindingProps = PhiAreaUploadWidgetProps & {
|
|
88
|
+
moduleTarget?: PhiAreaUploadModuleTarget<any>;
|
|
89
|
+
};
|
|
90
|
+
export declare function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly, collectionContext, moduleTarget, }: PhiAreaUploadBindingProps): import("react").JSX.Element;
|
|
48
91
|
export declare function PhiAreaUploadWidget(props: PhiAreaUploadWidgetProps): import("react").JSX.Element;
|
|
@@ -39,6 +39,7 @@ function buildUploadWallItem(asset, localId) {
|
|
|
39
39
|
height: asset.height ?? null,
|
|
40
40
|
presentationFlags: asset.presentationFlags,
|
|
41
41
|
progress: 100,
|
|
42
|
+
phase: null,
|
|
42
43
|
status: "done",
|
|
43
44
|
deleting: false,
|
|
44
45
|
error: null,
|
|
@@ -60,6 +61,7 @@ function buildPendingWallItem(item, presentationFlags) {
|
|
|
60
61
|
height: null,
|
|
61
62
|
presentationFlags,
|
|
62
63
|
progress: item.progress,
|
|
64
|
+
phase: item.phase,
|
|
63
65
|
status: item.status,
|
|
64
66
|
deleting: false,
|
|
65
67
|
error: item.error,
|
|
@@ -68,7 +70,7 @@ function buildPendingWallItem(item, presentationFlags) {
|
|
|
68
70
|
function resolveUploadWallDisplayDimensions(item) {
|
|
69
71
|
return resolvePhiMediaAssetDisplayDimensions(item);
|
|
70
72
|
}
|
|
71
|
-
export function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished = true, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly = false, collectionContext, }) {
|
|
73
|
+
export function PhiAreaUploadBinding({ config, labels, onUploadComplete, acceptance, showFinished = true, onAssetUploaded, onUploadingChange, refuseFile, siteSpaceOnly = false, collectionContext, moduleTarget, }) {
|
|
72
74
|
const { token } = usePhiConfig();
|
|
73
75
|
const { showMessage } = usePhiApplicationFeedback();
|
|
74
76
|
const uploadTileFrameSize = token.controlHeight * 3;
|
|
@@ -78,7 +80,8 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
78
80
|
const [uploadWall, setUploadWall] = useState([]);
|
|
79
81
|
const allowDelete = config?.allowDelete ?? true;
|
|
80
82
|
const configAccept = config?.accept?.trim() || "*/*";
|
|
81
|
-
const multiple = config?.multiple ?? true;
|
|
83
|
+
const multiple = moduleTarget ? false : config?.multiple ?? true;
|
|
84
|
+
const [heldFile, setHeldFile] = useState(null);
|
|
82
85
|
const collectionFolderId = collectionContext?.folderId ?? null;
|
|
83
86
|
const collectionPresentationFlags = collectionContext?.presentationFlags ?? null;
|
|
84
87
|
const hasCollectionContext = collectionContext != null;
|
|
@@ -154,8 +157,16 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
154
157
|
labels: labels.refusals,
|
|
155
158
|
...(acceptance ? { acceptance } : {}),
|
|
156
159
|
initOptions: uploadInitOptions,
|
|
157
|
-
|
|
158
|
-
|
|
160
|
+
...(moduleTarget ? { runSession: moduleTarget.runSession } : {}),
|
|
161
|
+
...(moduleTarget?.readError ? { readError: moduleTarget.readError } : {}),
|
|
162
|
+
onUploaded: (result, file) => {
|
|
163
|
+
if (moduleTarget) {
|
|
164
|
+
setHeldFile(null);
|
|
165
|
+
showUploadMessage("success", labels.uploadSuccessTemplate.replace("%1", file.name));
|
|
166
|
+
moduleTarget.onUploaded(result, file);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const uploadedTile = normalizePhiImagePreviewTile(result, []);
|
|
159
170
|
if (showFinished) {
|
|
160
171
|
setUploadWall((current) => [buildUploadWallItem(uploadedTile, `asset-${uploadedTile.id}`), ...current]);
|
|
161
172
|
}
|
|
@@ -181,7 +192,15 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
181
192
|
.map((item) => buildPendingWallItem(item, uploadInitOptions.presentationFlags ?? 0)),
|
|
182
193
|
...uploadWall,
|
|
183
194
|
];
|
|
184
|
-
return (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [_jsx(PhiUploadDropArea, { multiple: multiple, accept: accept, title: labels.dropTitle, hint: labels.dropHint, onFile: (file) => {
|
|
195
|
+
return (_jsxs(PhiFlexControl, { vertical: true, gap: 12, style: { width: "100%" }, children: [moduleTarget ? moduleTarget.renderFields({ file: heldFile, uploading }) : null, _jsx(PhiUploadDropArea, { multiple: multiple, accept: accept, title: moduleTarget && heldFile ? heldFile.name : labels.dropTitle, hint: labels.dropHint, onFile: (file) => {
|
|
196
|
+
if (moduleTarget) {
|
|
197
|
+
// Held, not sent: the Module's fields may start from it and are complete only once they do.
|
|
198
|
+
if (uploading)
|
|
199
|
+
return;
|
|
200
|
+
setHeldFile(file);
|
|
201
|
+
moduleTarget.onFilePicked?.(file);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
185
204
|
const refusal = refuseFile?.(file, sendingRef.current) ?? null;
|
|
186
205
|
if (refusal) {
|
|
187
206
|
showUploadMessage("error", refusal);
|
|
@@ -192,7 +211,12 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
192
211
|
void upload.upload(file).finally(() => {
|
|
193
212
|
sendingRef.current -= 1;
|
|
194
213
|
});
|
|
195
|
-
} }),
|
|
214
|
+
} }), moduleTarget ? (_jsxs(PhiFlexControl, { justify: "flex-end", gap: 8, children: [uploading ? (_jsx(PhiButtonControl, { label: moduleTarget.cancelLabel, onClick: () => upload.cancel(moduleTarget.cancelReason) })) : null, _jsx(PhiButtonControl, { type: "primary", label: moduleTarget.startLabel, icon: _jsx(PhiIcon, { name: "upload", size: "inherit" }), loading: uploading, disabled: !heldFile || !moduleTarget.ready || uploading, onClick: () => {
|
|
215
|
+
if (!heldFile)
|
|
216
|
+
return;
|
|
217
|
+
upload.reset();
|
|
218
|
+
void upload.upload(heldFile);
|
|
219
|
+
} })] })) : null, _jsx(PhiCollectionLayoutControl, { mode: "grid", gap: token.paddingSM, minColumnWidth: uploadTileFrameSize, items: wallItems.map((item) => {
|
|
196
220
|
const displayDimensions = resolveUploadWallDisplayDimensions(item);
|
|
197
221
|
return (_jsxs("div", { style: {
|
|
198
222
|
border: resolvePhiThemeBorderLine(token.colorBorderSecondary),
|
|
@@ -249,7 +273,8 @@ export function PhiAreaUploadBinding({ config, labels, onUploadComplete, accepta
|
|
|
249
273
|
color: "#fff",
|
|
250
274
|
}, children: _jsx(PhiSpinControl, {}) })) : null] }), _jsxs(PhiFlexControl, { vertical: true, gap: 6, style: { padding: token.paddingSM }, children: [_jsx(PhiFlexControl, { align: "center", justify: "space-between", gap: 8, children: _jsx(PhiTypographyControl, { strong: true, ellipsis: true, title: item.title ?? item.originalName, style: { minWidth: 0 }, children: item.title ?? item.originalName }) }), _jsxs(PhiFlexControl, { align: "center", justify: "space-between", gap: 8, wrap: true, children: [_jsx(PhiTypographyControl, { type: "secondary", ellipsis: true, style: { display: "block", minWidth: 0 }, children: resolvePhiMediaAssetTypeLabel(item.kind, item.contentType, item.originalName) }), allowDelete && item.assetId > 0 ? (_jsx(PhiButtonControl, { ariaLabel: labels.deleteLabel, icon: _jsx(PhiIcon, { name: "delete", size: "inherit" }), type: "text", size: "small", danger: true, onClick: () => {
|
|
251
275
|
void deleteUploadedAsset(item.localId, item.assetId);
|
|
252
|
-
} })) : null] }), _jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: true, children: [_jsx(PhiTagControl, { color: item.status === "error" ? "red" : item.status === "uploading" ? "blue" : "green", children:
|
|
276
|
+
} })) : null] }), _jsxs(PhiFlexControl, { align: "center", gap: 6, wrap: true, children: [_jsx(PhiTagControl, { color: item.status === "error" ? "red" : item.status === "uploading" ? "blue" : "green", children: (item.status === "uploading" && item.phase && moduleTarget?.phaseLabels?.[item.phase])
|
|
277
|
+
|| resolvePhiUploadStatusLabel(item, labels) }), item.status === "error" && item.file ? (_jsx(PhiButtonControl, { type: "primary", size: "small", onClick: () => {
|
|
253
278
|
void upload.retry(item.localId);
|
|
254
279
|
}, label: labels.retryLabel })) : null] })] })] }, item.localId));
|
|
255
280
|
}) })] }));
|
|
@@ -3,6 +3,7 @@ import { type PhisMediaSourceItem } from "@phis/contracts/media-source";
|
|
|
3
3
|
import type { PhiMediaAssetTile } from "../../types/media";
|
|
4
4
|
import type { PhiCmsMediaPickerWidgetConfig } from "../../types/media";
|
|
5
5
|
import type { PhiSearchWidgetLabels } from "../widgets/label-types/search";
|
|
6
|
+
import type { PhiPickerPlacement } from "../controls/phi-picker-control-contract";
|
|
6
7
|
import type { PhiAssetWidgetLabels } from "./media-widget-labels";
|
|
7
8
|
/**
|
|
8
9
|
* Where a file uploaded in the picker goes, as the binding hands it to the host's upload surface
|
|
@@ -48,6 +49,12 @@ export type PhiMediaPickerBindingProps = {
|
|
|
48
49
|
onDiscard?: (originalAssetId: number | null) => void;
|
|
49
50
|
onPopupOpenChange?: (open: boolean) => void;
|
|
50
51
|
trigger?: ReactNode;
|
|
52
|
+
/**
|
|
53
|
+
* Where the picker opens beside its trigger, which only the host can know: the Builder Inspector, a
|
|
54
|
+
* panel at the window's right, opens it to the left over the canvas; absent, the Control's default,
|
|
55
|
+
* centred below (`PhiMediaPickerControlProps.placement`).
|
|
56
|
+
*/
|
|
57
|
+
placement?: PhiPickerPlacement;
|
|
51
58
|
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
|
|
52
59
|
popupRootClassName?: string;
|
|
53
60
|
/**
|
|
@@ -80,7 +87,40 @@ export type PhiMediaPickerBindingProps = {
|
|
|
80
87
|
complete: boolean;
|
|
81
88
|
}>) | null;
|
|
82
89
|
};
|
|
83
|
-
export declare function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, getPopupContainer, popupRootClassName, siteSpaceOnly, isAssetSelectable, upload, openOnFolder, }: PhiMediaPickerBindingProps): {
|
|
90
|
+
export declare function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, placement, getPopupContainer, popupRootClassName, siteSpaceOnly, isAssetSelectable, upload, openOnFolder, }: PhiMediaPickerBindingProps): {
|
|
91
|
+
labels: {
|
|
92
|
+
trigger: string;
|
|
93
|
+
title: string;
|
|
94
|
+
search: string;
|
|
95
|
+
folder: string;
|
|
96
|
+
space: string;
|
|
97
|
+
empty: string;
|
|
98
|
+
sourceEmpty: string;
|
|
99
|
+
clear: string;
|
|
100
|
+
reload: string;
|
|
101
|
+
tileSize: string;
|
|
102
|
+
source: string;
|
|
103
|
+
importing: string;
|
|
104
|
+
loadMore: string;
|
|
105
|
+
upload: string;
|
|
106
|
+
};
|
|
107
|
+
getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;
|
|
108
|
+
popupRootClassName: string | undefined;
|
|
109
|
+
isAssetSelectable: ((asset: PhiMediaAssetTile) => boolean) | undefined;
|
|
110
|
+
onOpenChange: (next: boolean) => void;
|
|
111
|
+
onCommit: ((assetId: number | null, originalAssetId: number | null) => void) | undefined;
|
|
112
|
+
onDiscard: ((originalAssetId: number | null) => void) | undefined;
|
|
113
|
+
onQueryChange: (nextQuery: string) => void;
|
|
114
|
+
onSpaceChange: (nextSpace: string) => void;
|
|
115
|
+
onSourceChange: (nextSource: string) => void;
|
|
116
|
+
onSourceItemSelect: (item: PhisMediaSourceItem) => Promise<PhiMediaAssetTile | null>;
|
|
117
|
+
onSourceLoadMore: () => void;
|
|
118
|
+
onFolderChange: (nextFolder: string) => void;
|
|
119
|
+
onPageChange: (nextPage: number, nextPageSize: number) => void;
|
|
120
|
+
onMinColumnWidthChange: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
121
|
+
onReload: () => void;
|
|
122
|
+
onChange: (assetId: number | null) => void;
|
|
123
|
+
placement?: "top" | "right" | "bottom" | "left" | "topLeft" | "topRight" | "bottomRight" | "bottomLeft" | "auto" | "leftTop" | "leftBottom" | "rightTop" | "rightBottom" | undefined;
|
|
84
124
|
open: boolean;
|
|
85
125
|
value: number | null;
|
|
86
126
|
assets: PhiMediaAssetTile[];
|
|
@@ -120,37 +160,5 @@ export declare function usePhiMediaPickerBinding({ config, labels, searchLabels,
|
|
|
120
160
|
showFolderFilter: boolean;
|
|
121
161
|
showPagination: boolean;
|
|
122
162
|
trigger: ReactNode;
|
|
123
|
-
labels: {
|
|
124
|
-
trigger: string;
|
|
125
|
-
title: string;
|
|
126
|
-
search: string;
|
|
127
|
-
folder: string;
|
|
128
|
-
space: string;
|
|
129
|
-
empty: string;
|
|
130
|
-
sourceEmpty: string;
|
|
131
|
-
clear: string;
|
|
132
|
-
reload: string;
|
|
133
|
-
tileSize: string;
|
|
134
|
-
source: string;
|
|
135
|
-
importing: string;
|
|
136
|
-
loadMore: string;
|
|
137
|
-
upload: string;
|
|
138
|
-
};
|
|
139
|
-
getPopupContainer: ((triggerNode: HTMLElement) => HTMLElement) | undefined;
|
|
140
|
-
popupRootClassName: string | undefined;
|
|
141
|
-
isAssetSelectable: ((asset: PhiMediaAssetTile) => boolean) | undefined;
|
|
142
|
-
onOpenChange: (next: boolean) => void;
|
|
143
|
-
onCommit: ((assetId: number | null, originalAssetId: number | null) => void) | undefined;
|
|
144
|
-
onDiscard: ((originalAssetId: number | null) => void) | undefined;
|
|
145
|
-
onQueryChange: (nextQuery: string) => void;
|
|
146
|
-
onSpaceChange: (nextSpace: string) => void;
|
|
147
|
-
onSourceChange: (nextSource: string) => void;
|
|
148
|
-
onSourceItemSelect: (item: PhisMediaSourceItem) => Promise<PhiMediaAssetTile | null>;
|
|
149
|
-
onSourceLoadMore: () => void;
|
|
150
|
-
onFolderChange: (nextFolder: string) => void;
|
|
151
|
-
onPageChange: (nextPage: number, nextPageSize: number) => void;
|
|
152
|
-
onMinColumnWidthChange: import("react").Dispatch<import("react").SetStateAction<number>>;
|
|
153
|
-
onReload: () => void;
|
|
154
|
-
onChange: (assetId: number | null) => void;
|
|
155
163
|
};
|
|
156
164
|
export declare function PhiMediaPickerBinding(props: PhiMediaPickerBindingProps): import("react").JSX.Element;
|
|
@@ -17,7 +17,7 @@ import { buildPhiMediaSpaceOptions, usePhiMediaSpaceSelectionAllowed, } from "./
|
|
|
17
17
|
import { isPhiRecord } from "../../helpers/is-record";
|
|
18
18
|
import { readPhiMediaSourceImportErrorMessage, usePhiMediaSources, } from "./phi-media-sources";
|
|
19
19
|
import { usePhiCollectionProviderAction } from "../widgets/client/shared/phi-collection-provider";
|
|
20
|
-
export function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, getPopupContainer, popupRootClassName, siteSpaceOnly = false, isAssetSelectable, upload, openOnFolder, }) {
|
|
20
|
+
export function usePhiMediaPickerBinding({ config, labels, searchLabels, value: controlledValue, onAssetSelect, onAssetClear, open: controlledOpen, onOpenChange, onCommit, onDiscard, onPopupOpenChange, trigger, placement, getPopupContainer, popupRootClassName, siteSpaceOnly = false, isAssetSelectable, upload, openOnFolder, }) {
|
|
21
21
|
const [localOpen, setLocalOpen] = useState(false);
|
|
22
22
|
const [localValue, setLocalValue] = useState(controlledValue ?? null);
|
|
23
23
|
const [searchQuery, setSearchQuery] = useState("");
|
|
@@ -445,6 +445,7 @@ export function usePhiMediaPickerBinding({ config, labels, searchLabels, value:
|
|
|
445
445
|
showFolderFilter: config?.showFolderFilter ?? true,
|
|
446
446
|
showPagination: config?.showPagination ?? true,
|
|
447
447
|
trigger,
|
|
448
|
+
...(placement ? { placement } : {}),
|
|
448
449
|
labels: { trigger: labels.picker.triggerLabel, title: labels.picker.popoverTitle, search: labels.tool.searchPlaceholder ?? searchLabels.placeholder, folder: labels.tool.folderLabel, space: labels.space.label, empty: bindingError ?? (loadFailed ? labels.picker.loadFailedDescription : labels.picker.emptyDescription), sourceEmpty: sourceFailed ? labels.picker.sourceFailedText : labels.picker.emptyDescription, clear: labels.picker.clearLabel, reload: labels.tool.reloadLabel, tileSize: labels.picker.tileSizeLabel, source: labels.picker.sourceLabel, importing: labels.picker.importingLabel, loadMore: labels.picker.loadMoreLabel, upload: labels.upload.uploadToggleLabel },
|
|
449
450
|
getPopupContainer,
|
|
450
451
|
popupRootClassName,
|