@nodehive/nextjs 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auth/index.d.ts +2 -3
- package/dist/auth/index.js.map +1 -1
- package/dist/auth/internal/config.d.ts +15 -5
- package/dist/auth/internal/config.js.map +1 -1
- package/dist/auth/internal/draft-mode.d.ts +2 -3
- package/dist/auth/internal/draft-mode.js +3 -20
- package/dist/auth/internal/draft-mode.js.map +1 -1
- package/dist/auth/internal/editor-locale.d.ts +0 -1
- package/dist/auth/internal/handoff.d.ts +0 -1
- package/dist/auth/internal/has-session.d.ts +0 -1
- package/dist/auth/internal/has-session.js +1 -1
- package/dist/auth/internal/has-session.js.map +1 -1
- package/dist/auth/internal/i18n.d.ts +10 -0
- package/dist/auth/internal/i18n.js +25 -0
- package/dist/auth/internal/i18n.js.map +1 -0
- package/dist/auth/internal/logout.d.ts +1 -2
- package/dist/auth/internal/logout.js +3 -3
- package/dist/auth/internal/logout.js.map +1 -1
- package/dist/auth/internal/next-cookie-storage.d.ts +5 -2
- package/dist/auth/internal/next-cookie-storage.js +8 -1
- package/dist/auth/internal/next-cookie-storage.js.map +1 -1
- package/dist/auth/internal/nodehive-client.d.ts +6 -4
- package/dist/auth/internal/nodehive-client.js +6 -4
- package/dist/auth/internal/nodehive-client.js.map +1 -1
- package/dist/auth/internal/oauth-config.d.ts +0 -1
- package/dist/auth/internal/proxy-helpers.d.ts +0 -1
- package/dist/auth/internal/proxy-helpers.js +4 -4
- package/dist/auth/internal/proxy-helpers.js.map +1 -1
- package/dist/auth/internal/refresh.d.ts +1 -2
- package/dist/auth/internal/refresh.js +4 -4
- package/dist/auth/internal/refresh.js.map +1 -1
- package/dist/auth/internal/require-auth.d.ts +0 -1
- package/dist/auth/internal/require-auth.js +1 -1
- package/dist/auth/internal/require-auth.js.map +1 -1
- package/dist/auth/internal/return-to.d.ts +0 -1
- package/dist/auth/internal/roles.d.ts +17 -0
- package/dist/auth/internal/roles.js +39 -0
- package/dist/auth/internal/roles.js.map +1 -0
- package/dist/auth/internal/routes/callback.d.ts +1 -2
- package/dist/auth/internal/routes/callback.js +6 -6
- package/dist/auth/internal/routes/callback.js.map +1 -1
- package/dist/auth/internal/routes/chips-exchange.d.ts +1 -2
- package/dist/auth/internal/routes/chips-exchange.js +5 -5
- package/dist/auth/internal/routes/chips-exchange.js.map +1 -1
- package/dist/auth/internal/routes/draft.d.ts +1 -2
- package/dist/auth/internal/routes/draft.js +3 -3
- package/dist/auth/internal/routes/draft.js.map +1 -1
- package/dist/auth/internal/routes/index.d.ts +4 -2
- package/dist/auth/internal/routes/index.js +7 -7
- package/dist/auth/internal/routes/index.js.map +1 -1
- package/dist/auth/internal/routes/login.d.ts +0 -1
- package/dist/auth/internal/routes/login.js +3 -3
- package/dist/auth/internal/routes/login.js.map +1 -1
- package/dist/auth/internal/routes/popup-done.d.ts +2 -2
- package/dist/auth/internal/routes/popup-done.js +9 -7
- package/dist/auth/internal/routes/popup-done.js.map +1 -1
- package/dist/auth/internal/routes/refresh.d.ts +2 -5
- package/dist/auth/internal/routes/refresh.js +8 -2
- package/dist/auth/internal/routes/refresh.js.map +1 -1
- package/dist/auth/internal/same-origin.d.ts +0 -1
- package/dist/auth/internal/session-gates.d.ts +27 -3
- package/dist/auth/internal/session-gates.js +35 -3
- package/dist/auth/internal/session-gates.js.map +1 -1
- package/dist/auth/internal/update-session.d.ts +1 -2
- package/dist/auth/internal/update-session.js +1 -1
- package/dist/auth/internal/update-session.js.map +1 -1
- package/dist/auth/internal/use-editor-login.d.ts +0 -1
- package/dist/auth/internal/use-editor-login.js +2 -3
- package/dist/auth/internal/use-editor-login.js.map +1 -1
- package/dist/auth/proxy.d.ts +7 -8
- package/dist/auth/proxy.js +6 -6
- package/dist/auth/proxy.js.map +1 -1
- package/dist/auth/react.d.ts +1 -2
- package/dist/auth/react.js +1 -1
- package/dist/auth/react.js.map +1 -1
- package/dist/auth/routes.d.ts +3 -3
- package/dist/auth/routes.js +1 -1
- package/dist/auth/routes.js.map +1 -1
- package/dist/auth/server.d.ts +14 -12
- package/dist/auth/server.js +14 -9
- package/dist/auth/server.js.map +1 -1
- package/dist/bridge-protocol/index.d.ts +50 -0
- package/dist/bridge-protocol/index.js +25 -0
- package/dist/bridge-protocol/index.js.map +1 -0
- package/dist/puck-editor/editor.d.ts +8 -0
- package/dist/puck-editor/editor.js +9 -0
- package/dist/puck-editor/editor.js.map +1 -0
- package/dist/puck-editor/fields.d.ts +6 -7
- package/dist/puck-editor/fields.js +3 -3
- package/dist/puck-editor/fields.js.map +1 -1
- package/dist/puck-editor/index.d.ts +17 -14
- package/dist/puck-editor/index.js +13 -11
- package/dist/puck-editor/index.js.map +1 -1
- package/dist/puck-editor/internal/api/client.d.ts +19 -4
- package/dist/puck-editor/internal/api/client.js +56 -19
- package/dist/puck-editor/internal/api/client.js.map +1 -1
- package/dist/puck-editor/internal/api/config.d.ts +36 -3
- package/dist/puck-editor/internal/api/config.js.map +1 -1
- package/dist/puck-editor/internal/api/create-puck-api.d.ts +1 -2
- package/dist/puck-editor/internal/api/create-puck-api.js +10 -13
- package/dist/puck-editor/internal/api/create-puck-api.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts +1 -2
- package/dist/puck-editor/internal/api/handlers/create-page.js +6 -4
- package/dist/puck-editor/internal/api/handlers/create-page.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/entities.d.ts +6 -5
- package/dist/puck-editor/internal/api/handlers/entities.js +60 -15
- package/dist/puck-editor/internal/api/handlers/entities.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/publish.d.ts +3 -6
- package/dist/puck-editor/internal/api/handlers/publish.js +57 -14
- package/dist/puck-editor/internal/api/handlers/publish.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts +5 -2
- package/dist/puck-editor/internal/api/handlers/template.js +28 -60
- package/dist/puck-editor/internal/api/handlers/template.js.map +1 -1
- package/dist/puck-editor/internal/api/handlers/upload.d.ts +10 -2
- package/dist/puck-editor/internal/api/handlers/upload.js +93 -28
- package/dist/puck-editor/internal/api/handlers/upload.js.map +1 -1
- package/dist/puck-editor/internal/api/localize-message.d.ts +15 -0
- package/dist/puck-editor/internal/api/localize-message.js +15 -0
- package/dist/puck-editor/internal/api/localize-message.js.map +1 -0
- package/dist/puck-editor/internal/api/media-params.d.ts +3 -3
- package/dist/puck-editor/internal/api/media-params.js +23 -19
- package/dist/puck-editor/internal/api/media-params.js.map +1 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts +5 -3
- package/dist/puck-editor/internal/api/media-upload.js +33 -22
- package/dist/puck-editor/internal/api/media-upload.js.map +1 -1
- package/dist/puck-editor/internal/api/message-codes.d.ts +2 -0
- package/dist/puck-editor/internal/api/message-codes.js +2 -0
- package/dist/puck-editor/internal/api/message-codes.js.map +1 -0
- package/dist/puck-editor/internal/api/space.d.ts +0 -1
- package/dist/puck-editor/internal/api/type-segment.d.ts +2 -0
- package/dist/puck-editor/internal/api/type-segment.js +9 -0
- package/dist/puck-editor/internal/api/type-segment.js.map +1 -0
- package/dist/puck-editor/internal/content-model.d.ts +31 -3
- package/dist/puck-editor/internal/content-model.js +76 -6
- package/dist/puck-editor/internal/content-model.js.map +1 -1
- package/dist/puck-editor/internal/dictionaries.d.ts +225 -0
- package/dist/puck-editor/internal/dictionaries.js +673 -0
- package/dist/puck-editor/internal/dictionaries.js.map +1 -0
- package/dist/puck-editor/internal/editor/allowed-types.d.ts +1 -2
- package/dist/puck-editor/internal/editor/allowed-types.js +2 -2
- package/dist/puck-editor/internal/editor/allowed-types.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.js +108 -135
- package/dist/puck-editor/internal/editor/canvas-add-picker.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.js +4 -4
- package/dist/puck-editor/internal/editor/canvas-empty-state.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts +0 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.js +28 -41
- package/dist/puck-editor/internal/editor/canvas-quick-add.js.map +1 -1
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts +0 -1
- package/dist/puck-editor/internal/editor/component-icons.d.ts +1 -2
- package/dist/puck-editor/internal/editor/component-icons.js.map +1 -1
- package/dist/puck-editor/internal/editor/component-item.d.ts +0 -1
- package/dist/puck-editor/internal/editor/component-item.js +2 -2
- package/dist/puck-editor/internal/editor/component-item.js.map +1 -1
- package/dist/puck-editor/internal/editor/compose-save-issues.d.ts +15 -0
- package/dist/puck-editor/internal/editor/compose-save-issues.js +16 -0
- package/dist/puck-editor/internal/editor/compose-save-issues.js.map +1 -0
- package/dist/puck-editor/internal/editor/dirty-state.d.ts +3 -0
- package/dist/puck-editor/internal/editor/dirty-state.js +7 -0
- package/dist/puck-editor/internal/editor/dirty-state.js.map +1 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.d.ts +9 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.js +289 -0
- package/dist/puck-editor/internal/editor/draft-restore-banner.js.map +1 -0
- package/dist/puck-editor/internal/editor/draft-storage.d.ts +41 -0
- package/dist/puck-editor/internal/editor/draft-storage.js +129 -0
- package/dist/puck-editor/internal/editor/draft-storage.js.map +1 -0
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts +0 -1
- package/dist/puck-editor/internal/editor/editor-action-bar.js +4 -4
- package/dist/puck-editor/internal/editor/editor-action-bar.js.map +1 -1
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts +6 -4
- package/dist/puck-editor/internal/editor/editor-header-actions.js +119 -60
- package/dist/puck-editor/internal/editor/editor-header-actions.js.map +1 -1
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts +0 -1
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts +1 -2
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js +6 -6
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.js.map +1 -1
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts +7 -5
- package/dist/puck-editor/internal/editor/grouped-entry-list.js +85 -56
- package/dist/puck-editor/internal/editor/grouped-entry-list.js.map +1 -1
- package/dist/puck-editor/internal/editor/header-save-button.d.ts +4 -4
- package/dist/puck-editor/internal/editor/header-save-button.js +66 -27
- package/dist/puck-editor/internal/editor/header-save-button.js.map +1 -1
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.d.ts +5 -0
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.js +140 -0
- package/dist/puck-editor/internal/editor/leave-confirm-dialog.js.map +1 -0
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts +0 -1
- package/dist/puck-editor/internal/editor/page-template-picker.js +5 -5
- package/dist/puck-editor/internal/editor/page-template-picker.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts +1 -2
- package/dist/puck-editor/internal/editor/picker-entry-item.js +4 -4
- package/dist/puck-editor/internal/editor/picker-entry-item.js.map +1 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts +14 -5
- package/dist/puck-editor/internal/editor/picker-model.js +157 -132
- package/dist/puck-editor/internal/editor/picker-model.js.map +1 -1
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts +18 -4
- package/dist/puck-editor/internal/editor/publish-puck-data.js +25 -4
- package/dist/puck-editor/internal/editor/publish-puck-data.js.map +1 -1
- package/dist/puck-editor/internal/editor/puck-editor.d.ts +6 -4
- package/dist/puck-editor/internal/editor/puck-editor.js +270 -209
- package/dist/puck-editor/internal/editor/puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/editor/save-guard.d.ts +15 -0
- package/dist/puck-editor/internal/editor/save-guard.js +30 -0
- package/dist/puck-editor/internal/editor/save-guard.js.map +1 -0
- package/dist/puck-editor/internal/editor/save-page-context.d.ts +8 -0
- package/dist/puck-editor/internal/editor/save-page-context.js +34 -0
- package/dist/puck-editor/internal/editor/save-page-context.js.map +1 -0
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts +0 -1
- package/dist/puck-editor/internal/editor/section-template-modal.js +2 -2
- package/dist/puck-editor/internal/editor/section-template-modal.js.map +1 -1
- package/dist/puck-editor/internal/editor/unsaved-changes-guard.d.ts +3 -0
- package/dist/puck-editor/internal/editor/unsaved-changes-guard.js +38 -0
- package/dist/puck-editor/internal/editor/unsaved-changes-guard.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-dirty-baseline.d.ts +5 -0
- package/dist/puck-editor/internal/editor/use-dirty-baseline.js +72 -0
- package/dist/puck-editor/internal/editor/use-dirty-baseline.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.d.ts +16 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.js +194 -0
- package/dist/puck-editor/internal/editor/use-draft-recovery.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-frame-zoom.d.ts +1 -0
- package/dist/puck-editor/internal/editor/use-frame-zoom.js +59 -0
- package/dist/puck-editor/internal/editor/use-frame-zoom.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.d.ts +1 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.js +32 -0
- package/dist/puck-editor/internal/editor/use-is-dirty.js.map +1 -0
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts +0 -1
- package/dist/puck-editor/internal/editor-config.d.ts +16 -3
- package/dist/puck-editor/internal/editor-config.js +8 -1
- package/dist/puck-editor/internal/editor-config.js.map +1 -1
- package/dist/puck-editor/internal/editor-query-client.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js +2 -2
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js +1 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js +1 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts +0 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js +90 -73
- package/dist/puck-editor/internal/fields/date-picker/date-picker.js.map +1 -1
- package/dist/puck-editor/internal/fields/index.d.ts +10 -10
- package/dist/puck-editor/internal/fields/index.js +10 -9
- package/dist/puck-editor/internal/fields/index.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.js +1 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts +1 -2
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js +1 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js +208 -140
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts +1 -2
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js +6 -6
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts +25 -5
- package/dist/puck-editor/internal/fields/link-picker/link-value.js +56 -6
- package/dist/puck-editor/internal/fields/link-picker/link-value.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js +4 -4
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js +3 -3
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.js.map +1 -1
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js +1 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js +124 -115
- package/dist/puck-editor/internal/fields/media-array/media-array-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts +2 -3
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js +1 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts +1 -2
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js +4 -4
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js +19 -10
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts +8 -3
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js +59 -61
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts +1 -2
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js +281 -255
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts +15 -2
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js +23 -18
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.js.map +1 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts +0 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js +12 -6
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.js.map +1 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts +0 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js +2 -2
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.js.map +1 -1
- package/dist/puck-editor/internal/fields/required-field-label.d.ts +0 -1
- package/dist/puck-editor/internal/fields/required-field-label.js +1 -1
- package/dist/puck-editor/internal/fields/required-field-label.js.map +1 -1
- package/dist/puck-editor/internal/fields/required.d.ts +0 -1
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts +13 -3
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js +32 -22
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.js.map +1 -1
- package/dist/puck-editor/internal/i18n.d.ts +2 -181
- package/dist/puck-editor/internal/i18n.js +2 -358
- package/dist/puck-editor/internal/i18n.js.map +1 -1
- package/dist/puck-editor/internal/locale.d.ts +0 -1
- package/dist/puck-editor/internal/localize.d.ts +1 -2
- package/dist/puck-editor/internal/localize.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts +3 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js +41 -32
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts +3 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js +4 -3
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts +5 -6
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js +2 -2
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js +3 -3
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js +8 -8
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js +5 -5
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js +2 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js +224 -219
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts +5 -6
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js +5 -5
- package/dist/puck-editor/internal/plugins/templates-plugin/index.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js +3 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js +17 -16
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts +1 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js +171 -161
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts +2 -3
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js +9 -2
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js +22 -20
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.js.map +1 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts +14 -5
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js +23 -15
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.js.map +1 -1
- package/dist/puck-editor/internal/puck-augmentation.d.ts +0 -1
- package/dist/puck-editor/internal/puck-editor-provider.d.ts +0 -1
- package/dist/puck-editor/internal/puck-node.d.ts +0 -1
- package/dist/puck-editor/internal/puck-props.d.ts +13 -0
- package/dist/puck-editor/internal/puck-props.js +2 -0
- package/dist/puck-editor/internal/puck-props.js.map +1 -0
- package/dist/puck-editor/internal/puck-wrapper.d.ts +25 -6
- package/dist/puck-editor/internal/puck-wrapper.js +124 -115
- package/dist/puck-editor/internal/puck-wrapper.js.map +1 -1
- package/dist/puck-editor/internal/render/cropped-image.d.ts +1 -2
- package/dist/puck-editor/internal/render/cropped-image.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/action-selection.d.ts +8 -0
- package/dist/puck-editor/internal/smart-actions/action-selection.js +10 -0
- package/dist/puck-editor/internal/smart-actions/action-selection.js.map +1 -0
- package/dist/puck-editor/internal/smart-actions/index.d.ts +10 -4
- package/dist/puck-editor/internal/smart-actions/index.js +27 -12
- package/dist/puck-editor/internal/smart-actions/index.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts +3 -2
- package/dist/puck-editor/internal/smart-actions/new-page.js +6 -6
- package/dist/puck-editor/internal/smart-actions/new-page.js.map +1 -1
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts +3 -2
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js +49 -37
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.js.map +1 -1
- package/dist/puck-editor/internal/ui/calendar.d.ts +0 -1
- package/dist/puck-editor/internal/ui/calendar.js +1 -1
- package/dist/puck-editor/internal/ui/calendar.js.map +1 -1
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts +0 -1
- package/dist/puck-editor/internal/ui/dialog.d.ts +0 -1
- package/dist/puck-editor/internal/ui/dialog.js +33 -20
- package/dist/puck-editor/internal/ui/dialog.js.map +1 -1
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts +0 -1
- package/dist/puck-editor/internal/ui/icon-button.d.ts +0 -1
- package/dist/puck-editor/internal/ui/icon-button.js +1 -1
- package/dist/puck-editor/internal/ui/icon-button.js.map +1 -1
- package/dist/puck-editor/internal/ui/load-error-notice.d.ts +6 -0
- package/dist/puck-editor/internal/ui/load-error-notice.js +81 -0
- package/dist/puck-editor/internal/ui/load-error-notice.js.map +1 -0
- package/dist/puck-editor/internal/ui/popover.d.ts +0 -1
- package/dist/puck-editor/internal/ui/popover.js +1 -1
- package/dist/puck-editor/internal/ui/popover.js.map +1 -1
- package/dist/puck-editor/internal/ui/required-mark.d.ts +0 -1
- package/dist/puck-editor/internal/ui/search-control.d.ts +3 -3
- package/dist/puck-editor/internal/ui/search-control.js +29 -26
- package/dist/puck-editor/internal/ui/search-control.js.map +1 -1
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts +0 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts +1 -2
- package/dist/puck-editor/internal/use-puck-overlay.js +6 -5
- package/dist/puck-editor/internal/use-puck-overlay.js.map +1 -1
- package/dist/puck-editor/internal/utils.d.ts +0 -1
- package/dist/puck-editor/render.d.ts +2 -3
- package/dist/puck-editor/render.js +1 -1
- package/dist/puck-editor/render.js.map +1 -1
- package/dist/puck-editor/server.d.ts +3 -4
- package/dist/puck-editor/server.js +1 -1
- package/dist/puck-editor/server.js.map +1 -1
- package/dist/puck-editor/smart-actions.d.ts +1 -2
- package/dist/puck-editor/smart-actions.js +1 -1
- package/dist/puck-editor/smart-actions.js.map +1 -1
- package/dist/shared/cn.d.ts +0 -1
- package/dist/shared/i18n.d.ts +0 -1
- package/dist/shared/revalidate-path.d.ts +1 -0
- package/dist/shared/revalidate-path.js +2 -0
- package/dist/shared/revalidate-path.js.map +1 -0
- package/dist/shared/toolbar-action.d.ts +0 -1
- package/dist/shared/use-is-hydrated.d.ts +0 -1
- package/dist/shared/use-is-in-iframe.d.ts +0 -1
- package/dist/shared/use-is-in-iframe.js +1 -1
- package/dist/shared/use-is-in-iframe.js.map +1 -1
- package/dist/smart-actions/internal/assemble-smart-actions.d.ts +14 -0
- package/dist/smart-actions/internal/assemble-smart-actions.js +11 -0
- package/dist/smart-actions/internal/assemble-smart-actions.js.map +1 -0
- package/dist/smart-actions/internal/backend-edit-link.d.ts +6 -0
- package/dist/smart-actions/internal/backend-edit-link.js +60 -0
- package/dist/smart-actions/internal/backend-edit-link.js.map +1 -0
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts +1 -2
- package/dist/smart-actions/internal/get-smart-actions-context.js +2 -2
- package/dist/smart-actions/internal/get-smart-actions-context.js.map +1 -1
- package/dist/smart-actions/internal/i18n.d.ts +1 -2
- package/dist/smart-actions/internal/i18n.js +16 -2
- package/dist/smart-actions/internal/i18n.js.map +1 -1
- package/dist/smart-actions/internal/logout-form.d.ts +2 -2
- package/dist/smart-actions/internal/logout-form.js +47 -40
- package/dist/smart-actions/internal/logout-form.js.map +1 -1
- package/dist/smart-actions/internal/refresh-page.d.ts +3 -2
- package/dist/smart-actions/internal/refresh-page.js +60 -53
- package/dist/smart-actions/internal/refresh-page.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-button.d.ts +22 -4
- package/dist/smart-actions/internal/smart-actions-button.js +36 -13
- package/dist/smart-actions/internal/smart-actions-button.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-config.d.ts +12 -4
- package/dist/smart-actions/internal/smart-actions-config.js +36 -80
- package/dist/smart-actions/internal/smart-actions-config.js.map +1 -1
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts +5 -11
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js +13 -53
- package/dist/smart-actions/internal/smart-actions-toolbar-client.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js +4 -4
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/storage.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/storage.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/types.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/types.js.map +1 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts +1 -2
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js +1 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.js.map +1 -1
- package/dist/smart-actions/internal/ui/tooltip.d.ts +0 -1
- package/dist/smart-actions/internal/ui/tooltip.js +1 -1
- package/dist/smart-actions/internal/ui/tooltip.js.map +1 -1
- package/dist/smart-actions/internal/user-profile.d.ts +0 -1
- package/dist/smart-actions/internal/user-profile.js +71 -24
- package/dist/smart-actions/internal/user-profile.js.map +1 -1
- package/dist/smart-actions/server.d.ts +5 -4
- package/dist/smart-actions/server.js +2 -2
- package/dist/smart-actions/server.js.map +1 -1
- package/dist/theme.css +1 -1
- package/dist/visual-editor/index.d.ts +3 -4
- package/dist/visual-editor/index.js +3 -3
- package/dist/visual-editor/index.js.map +1 -1
- package/dist/visual-editor/internal/bridge/connector.d.ts +4 -3
- package/dist/visual-editor/internal/bridge/connector.js +22 -21
- package/dist/visual-editor/internal/bridge/connector.js.map +1 -1
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts +5 -3
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js +7 -8
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.js.map +1 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts +3 -3
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js +4 -2
- package/dist/visual-editor/internal/bridge/editor-auth-gate.js.map +1 -1
- package/dist/visual-editor/internal/i18n.d.ts +3 -2
- package/dist/visual-editor/internal/i18n.js +32 -4
- package/dist/visual-editor/internal/i18n.js.map +1 -1
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts +1 -7
- package/dist/visual-editor/internal/overlays/drupal-origin.js +16 -3
- package/dist/visual-editor/internal/overlays/drupal-origin.js.map +1 -1
- package/dist/visual-editor/internal/overlays/edit-button.d.ts +5 -4
- package/dist/visual-editor/internal/overlays/edit-button.js +46 -44
- package/dist/visual-editor/internal/overlays/edit-button.js.map +1 -1
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts +0 -1
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts +11 -2
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js +18 -7
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts +0 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js +1 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts +12 -3
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js +14 -5
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts +4 -2
- package/dist/visual-editor/internal/overlays/node/node-metadata.js +10 -4
- package/dist/visual-editor/internal/overlays/node/node-metadata.js.map +1 -1
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts +5 -3
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js +4 -2
- package/dist/visual-editor/internal/overlays/node/node-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts +11 -2
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js +18 -7
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.js.map +1 -1
- package/dist/visual-editor/internal/revalidate-route.d.ts +0 -1
- package/dist/visual-editor/internal/revalidate-route.js +1 -1
- package/dist/visual-editor/internal/revalidate-route.js.map +1 -1
- package/dist/visual-editor/server.d.ts +6 -7
- package/dist/visual-editor/server.js +6 -6
- package/dist/visual-editor/server.js.map +1 -1
- package/package.json +19 -3
- package/dist/auth/index.d.ts.map +0 -1
- package/dist/auth/internal/config.d.ts.map +0 -1
- package/dist/auth/internal/draft-mode.d.ts.map +0 -1
- package/dist/auth/internal/editor-locale.d.ts.map +0 -1
- package/dist/auth/internal/handoff.d.ts.map +0 -1
- package/dist/auth/internal/has-session.d.ts.map +0 -1
- package/dist/auth/internal/logout.d.ts.map +0 -1
- package/dist/auth/internal/next-cookie-storage.d.ts.map +0 -1
- package/dist/auth/internal/nodehive-client.d.ts.map +0 -1
- package/dist/auth/internal/oauth-config.d.ts.map +0 -1
- package/dist/auth/internal/proxy-helpers.d.ts.map +0 -1
- package/dist/auth/internal/refresh.d.ts.map +0 -1
- package/dist/auth/internal/require-auth.d.ts.map +0 -1
- package/dist/auth/internal/return-to.d.ts.map +0 -1
- package/dist/auth/internal/routes/callback.d.ts.map +0 -1
- package/dist/auth/internal/routes/chips-exchange.d.ts.map +0 -1
- package/dist/auth/internal/routes/draft.d.ts.map +0 -1
- package/dist/auth/internal/routes/index.d.ts.map +0 -1
- package/dist/auth/internal/routes/login.d.ts.map +0 -1
- package/dist/auth/internal/routes/popup-done.d.ts.map +0 -1
- package/dist/auth/internal/routes/refresh.d.ts.map +0 -1
- package/dist/auth/internal/same-origin.d.ts.map +0 -1
- package/dist/auth/internal/session-gates.d.ts.map +0 -1
- package/dist/auth/internal/update-session.d.ts.map +0 -1
- package/dist/auth/internal/use-editor-login.d.ts.map +0 -1
- package/dist/auth/proxy.d.ts.map +0 -1
- package/dist/auth/react.d.ts.map +0 -1
- package/dist/auth/routes.d.ts.map +0 -1
- package/dist/auth/server.d.ts.map +0 -1
- package/dist/puck-editor/fields.d.ts.map +0 -1
- package/dist/puck-editor/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/client.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/config.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/create-puck-api.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/create-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/entities.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/publish.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/template.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/handlers/upload.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/media-params.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/media-upload.d.ts.map +0 -1
- package/dist/puck-editor/internal/api/space.d.ts.map +0 -1
- package/dist/puck-editor/internal/content-model.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/allowed-types.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-add-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-empty-state.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-quick-add.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/canvas-scroll.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/component-icons.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/component-item.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/editor-action-bar.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/editor-header-actions.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/find-missing-required-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/grouped-drawer-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/grouped-entry-list.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/header-save-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/page-template-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/picker-entry-item.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/picker-model.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/publish-puck-data.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/puck-editor.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/section-template-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor/use-scroll-lock-outside.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor-config.d.ts.map +0 -1
- package/dist/puck-editor/internal/editor-query-client.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/checkbox-group-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/checkbox-group/create-checkbox-group-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/date-picker/create-date-picker-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/date-picker/date-picker.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/anchor.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/create-link-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/humanize.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-picker-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/link-value.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/rich-text-link-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/richtext-extensions.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/segmented-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/link-picker/types.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/create-media-array-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/media-array-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-array/reorder.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/create-media-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-editor-dialog.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/crop-types.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/extract-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/image-upload-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/media-selector-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-debounced-value.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/use-media-library.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/media-selector/video-upload-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/node-selector/create-node-selector-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/required-field-label.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/required.d.ts.map +0 -1
- package/dist/puck-editor/internal/fields/rich-text/create-rich-text-field.d.ts.map +0 -1
- package/dist/puck-editor/internal/i18n.d.ts.map +0 -1
- package/dist/puck-editor/internal/locale.d.ts.map +0 -1
- package/dist/puck-editor/internal/localize.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-bridge.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-info-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/agent-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/apply-patch-to-puck.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/catalog.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/constants.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/create-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/find-component-location.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/help.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/list-media.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/upload-media.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/agent-plugin/use-agent-handle.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/blocks-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/blocks-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/outline-plugin/outline-tree.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/sections-plugin/sections-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/ai-options-fields.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/apply-vehicle-slot-constraints.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/component-template-modal.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/custom-template-list.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/root-drop-zone.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-form.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/template-vehicles.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-panel.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates-plugin.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-template-dnd.d.ts.map +0 -1
- package/dist/puck-editor/internal/plugins/templates-plugin/use-templates.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-augmentation.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-editor-provider.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-node.d.ts.map +0 -1
- package/dist/puck-editor/internal/puck-wrapper.d.ts.map +0 -1
- package/dist/puck-editor/internal/render/cropped-image.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/index.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/new-page.d.ts.map +0 -1
- package/dist/puck-editor/internal/smart-actions/open-puck-editor.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/calendar.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/component-list-accordion.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/dialog.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/drawer-item-content.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/icon-button.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/popover.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/required-mark.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/search-control.d.ts.map +0 -1
- package/dist/puck-editor/internal/ui/use-panel-search-focus.d.ts.map +0 -1
- package/dist/puck-editor/internal/use-puck-overlay.d.ts.map +0 -1
- package/dist/puck-editor/internal/utils.d.ts.map +0 -1
- package/dist/puck-editor/render.d.ts.map +0 -1
- package/dist/puck-editor/server.d.ts.map +0 -1
- package/dist/puck-editor/smart-actions.d.ts.map +0 -1
- package/dist/shared/cn.d.ts.map +0 -1
- package/dist/shared/i18n.d.ts.map +0 -1
- package/dist/shared/toolbar-action.d.ts.map +0 -1
- package/dist/shared/use-is-hydrated.d.ts.map +0 -1
- package/dist/shared/use-is-in-iframe.d.ts.map +0 -1
- package/dist/smart-actions/internal/get-smart-actions-context.d.ts.map +0 -1
- package/dist/smart-actions/internal/i18n.d.ts.map +0 -1
- package/dist/smart-actions/internal/logout-form.d.ts.map +0 -1
- package/dist/smart-actions/internal/refresh-page.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-button.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-config.d.ts.map +0 -1
- package/dist/smart-actions/internal/smart-actions-toolbar-client.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/smart-actions-toolbar.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/storage.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/types.d.ts.map +0 -1
- package/dist/smart-actions/internal/toolbar/use-smart-actions-toolbar-mode.d.ts.map +0 -1
- package/dist/smart-actions/internal/ui/tooltip.d.ts.map +0 -1
- package/dist/smart-actions/internal/user-profile.d.ts.map +0 -1
- package/dist/smart-actions/server.d.ts.map +0 -1
- package/dist/visual-editor/index.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/connector.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/draft-mode-self-heal.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate-server.d.ts.map +0 -1
- package/dist/visual-editor/internal/bridge/editor-auth-gate.d.ts.map +0 -1
- package/dist/visual-editor/internal/i18n.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/drupal-origin.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/edit-button.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/edit-icon.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/fragment/fragment-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/iframe-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/menu/menu-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/node/node-metadata.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/node/node-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/overlays/paragraph/paragraph-wrapper.d.ts.map +0 -1
- package/dist/visual-editor/internal/revalidate-route.d.ts.map +0 -1
- package/dist/visual-editor/server.d.ts.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { mediaEntityType } from "../content-model.js";
|
|
2
|
+
import { buildMediaParams } from "./media-params.js";
|
|
3
|
+
async function enrichCreatedMedia(client, created, type, media, lang) {
|
|
3
4
|
try {
|
|
4
5
|
const enriched = await client.getMedia(created.id, type, {
|
|
5
6
|
lang: created?.attributes?.langcode || lang || 'en',
|
|
6
|
-
params: buildMediaParams(type)
|
|
7
|
+
params: buildMediaParams(type, media)
|
|
7
8
|
});
|
|
8
9
|
return enriched?.data || created;
|
|
9
10
|
} catch (error) {
|
|
@@ -17,7 +18,7 @@ async function enrichCreatedMedia(client, created, type, lang) {
|
|
|
17
18
|
* the JSON:API file upload process: upload the binary to create a file entity,
|
|
18
19
|
* then create a media entity referencing it.
|
|
19
20
|
*/
|
|
20
|
-
export async function uploadImage(client, {
|
|
21
|
+
export async function uploadImage(client, media, {
|
|
21
22
|
file,
|
|
22
23
|
alt,
|
|
23
24
|
name,
|
|
@@ -27,13 +28,14 @@ export async function uploadImage(client, {
|
|
|
27
28
|
if (!token) {
|
|
28
29
|
return {
|
|
29
30
|
success: false,
|
|
30
|
-
message: 'Authentication required'
|
|
31
|
+
message: 'Authentication required',
|
|
32
|
+
code: 'authRequired'
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
const mediaName = name || file.name || 'Image';
|
|
34
36
|
try {
|
|
35
37
|
const fileBuffer = Buffer.from(await file.arrayBuffer());
|
|
36
|
-
const fileUploadUrl = `${client.baseUrl}/jsonapi/media
|
|
38
|
+
const fileUploadUrl = `${client.baseUrl}/jsonapi/media/${media.imageType}/${media.imageFileField}`;
|
|
37
39
|
const asciiFilename = file.name.replace(/[^\x20-\x7e]/g, '_').replace(/"/g, '');
|
|
38
40
|
const contentDisposition = `attachment; filename="${asciiFilename}"; filename*=UTF-8''${encodeURIComponent(file.name)}`;
|
|
39
41
|
const fileUploadResponse = await fetch(fileUploadUrl, {
|
|
@@ -50,20 +52,21 @@ export async function uploadImage(client, {
|
|
|
50
52
|
console.error('File upload failed:', await fileUploadResponse.text());
|
|
51
53
|
return {
|
|
52
54
|
success: false,
|
|
53
|
-
message: 'File upload failed'
|
|
55
|
+
message: 'File upload failed',
|
|
56
|
+
code: 'fileUploadFailed'
|
|
54
57
|
};
|
|
55
58
|
}
|
|
56
59
|
const fileResult = await fileUploadResponse.json();
|
|
57
60
|
const fileUuid = fileResult.data.id;
|
|
58
61
|
const mediaData = {
|
|
59
62
|
data: {
|
|
60
|
-
type:
|
|
63
|
+
type: mediaEntityType(media.imageType),
|
|
61
64
|
attributes: {
|
|
62
65
|
name: mediaName,
|
|
63
66
|
status: true
|
|
64
67
|
},
|
|
65
68
|
relationships: {
|
|
66
|
-
|
|
69
|
+
[media.imageFileField]: {
|
|
67
70
|
data: {
|
|
68
71
|
type: 'file--file',
|
|
69
72
|
id: fileUuid,
|
|
@@ -75,7 +78,7 @@ export async function uploadImage(client, {
|
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
|
-
const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media
|
|
81
|
+
const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media/${media.imageType}`, {
|
|
79
82
|
method: 'POST',
|
|
80
83
|
body: JSON.stringify(mediaData),
|
|
81
84
|
headers: {
|
|
@@ -88,27 +91,30 @@ export async function uploadImage(client, {
|
|
|
88
91
|
console.error('Media entity creation failed:', await mediaResponse.text());
|
|
89
92
|
return {
|
|
90
93
|
success: false,
|
|
91
|
-
message: 'Media entity creation failed'
|
|
94
|
+
message: 'Media entity creation failed',
|
|
95
|
+
code: 'mediaCreateFailed'
|
|
92
96
|
};
|
|
93
97
|
}
|
|
94
98
|
const mediaResult = await mediaResponse.json();
|
|
95
|
-
const data = await enrichCreatedMedia(client, mediaResult.data,
|
|
99
|
+
const data = await enrichCreatedMedia(client, mediaResult.data, media.imageType, media, lang);
|
|
96
100
|
return {
|
|
97
101
|
success: true,
|
|
98
102
|
message: 'Image uploaded successfully',
|
|
103
|
+
code: 'imageUploaded',
|
|
99
104
|
data
|
|
100
105
|
};
|
|
101
106
|
} catch (error) {
|
|
102
107
|
console.error('Error uploading image media:', error);
|
|
103
108
|
return {
|
|
104
109
|
success: false,
|
|
105
|
-
message: 'An unexpected error occurred'
|
|
110
|
+
message: 'An unexpected error occurred',
|
|
111
|
+
code: 'unexpectedError'
|
|
106
112
|
};
|
|
107
113
|
}
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
/** Creates a remote video media entity in Drupal from a YouTube/Vimeo page URL. */
|
|
111
|
-
export async function uploadRemoteVideo(client, {
|
|
117
|
+
export async function uploadRemoteVideo(client, media, {
|
|
112
118
|
videoUrl,
|
|
113
119
|
name,
|
|
114
120
|
lang
|
|
@@ -117,27 +123,29 @@ export async function uploadRemoteVideo(client, {
|
|
|
117
123
|
if (!token) {
|
|
118
124
|
return {
|
|
119
125
|
success: false,
|
|
120
|
-
message: 'Authentication required'
|
|
126
|
+
message: 'Authentication required',
|
|
127
|
+
code: 'authRequired'
|
|
121
128
|
};
|
|
122
129
|
}
|
|
123
130
|
if (!videoUrl) {
|
|
124
131
|
return {
|
|
125
132
|
success: false,
|
|
126
|
-
message: 'No video URL provided'
|
|
133
|
+
message: 'No video URL provided',
|
|
134
|
+
code: 'videoUrlRequired'
|
|
127
135
|
};
|
|
128
136
|
}
|
|
129
137
|
try {
|
|
130
138
|
const mediaData = {
|
|
131
139
|
data: {
|
|
132
|
-
type:
|
|
140
|
+
type: mediaEntityType(media.remoteVideoType),
|
|
133
141
|
attributes: {
|
|
134
142
|
name: name,
|
|
135
143
|
status: true,
|
|
136
|
-
|
|
144
|
+
[media.remoteVideoUrlField]: videoUrl
|
|
137
145
|
}
|
|
138
146
|
}
|
|
139
147
|
};
|
|
140
|
-
const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media
|
|
148
|
+
const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media/${media.remoteVideoType}`, {
|
|
141
149
|
method: 'POST',
|
|
142
150
|
body: JSON.stringify(mediaData),
|
|
143
151
|
headers: {
|
|
@@ -150,21 +158,24 @@ export async function uploadRemoteVideo(client, {
|
|
|
150
158
|
console.error('Remote video entity creation failed:', await mediaResponse.text());
|
|
151
159
|
return {
|
|
152
160
|
success: false,
|
|
153
|
-
message: 'Remote video entity creation failed'
|
|
161
|
+
message: 'Remote video entity creation failed',
|
|
162
|
+
code: 'remoteVideoCreateFailed'
|
|
154
163
|
};
|
|
155
164
|
}
|
|
156
165
|
const mediaResult = await mediaResponse.json();
|
|
157
|
-
const data = await enrichCreatedMedia(client, mediaResult.data,
|
|
166
|
+
const data = await enrichCreatedMedia(client, mediaResult.data, media.remoteVideoType, media, lang);
|
|
158
167
|
return {
|
|
159
168
|
success: true,
|
|
160
169
|
message: 'Remote video added successfully',
|
|
170
|
+
code: 'remoteVideoAdded',
|
|
161
171
|
data
|
|
162
172
|
};
|
|
163
173
|
} catch (error) {
|
|
164
174
|
console.error('Error adding remote video:', error);
|
|
165
175
|
return {
|
|
166
176
|
success: false,
|
|
167
|
-
message: 'An unexpected error occurred'
|
|
177
|
+
message: 'An unexpected error occurred',
|
|
178
|
+
code: 'unexpectedError'
|
|
168
179
|
};
|
|
169
180
|
}
|
|
170
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"media-upload.js","names":["buildMediaParams","enrichCreatedMedia","client","created","type","lang","enriched","getMedia","id","attributes","langcode","params","data","error","console","uploadImage","file","alt","name","token","getToken","success","message","mediaName","fileBuffer","Buffer","from","arrayBuffer","fileUploadUrl","baseUrl","asciiFilename","replace","contentDisposition","encodeURIComponent","fileUploadResponse","fetch","method","headers","Accept","Authorization","body","ok","text","fileResult","json","fileUuid","mediaData","status","relationships","field_media_image","meta","mediaResponse","JSON","stringify","mediaResult","uploadRemoteVideo","videoUrl","field_media_oembed_video"],"sources":["../../../../src/puck-editor/internal/api/media-upload.ts"],"sourcesContent":["import type { NodeHiveClient } from 'nodehive-js';\n\nimport { buildMediaParams } from './media-params';\n\nexport type MediaUploadResult = {\n success: boolean;\n message: string;\n data?: unknown;\n};\n\nasync function enrichCreatedMedia(\n client: NodeHiveClient,\n created: { id: string; attributes?: { langcode?: string } },\n type: string,\n lang?: string\n) {\n try {\n const enriched = await client.getMedia(created.id, type, {\n lang: created?.attributes?.langcode || lang || 'en',\n params: buildMediaParams(type),\n });\n return enriched?.data || created;\n } catch (error) {\n console.error('Error enriching created media:', error);\n return created;\n }\n}\n\n/**\n * Uploads an image file to Drupal and creates a media entity, using Flow 2 of\n * the JSON:API file upload process: upload the binary to create a file entity,\n * then create a media entity referencing it.\n */\nexport async function uploadImage(\n client: NodeHiveClient,\n {\n file,\n alt,\n name,\n lang,\n }: { file: File; alt?: string; name?: string; lang?: string }\n): Promise<MediaUploadResult> {\n const token = await client.getToken();\n if (!token) {\n return { success: false, message: 'Authentication required' };\n }\n\n const mediaName = name || file.name || 'Image';\n\n try {\n const fileBuffer = Buffer.from(await file.arrayBuffer());\n const fileUploadUrl = `${client.baseUrl}/jsonapi/media/image/field_media_image`;\n\n const asciiFilename = file.name\n .replace(/[^\\x20-\\x7e]/g, '_')\n .replace(/\"/g, '');\n const contentDisposition = `attachment; filename=\"${asciiFilename}\"; filename*=UTF-8''${encodeURIComponent(file.name)}`;\n\n const fileUploadResponse = await fetch(fileUploadUrl, {\n method: 'POST',\n headers: {\n Accept: 'application/vnd.api+json',\n 'Content-Type': 'application/octet-stream',\n 'Content-Disposition': contentDisposition,\n Authorization: `Bearer ${token}`,\n },\n body: fileBuffer,\n });\n\n if (!fileUploadResponse.ok) {\n console.error('File upload failed:', await fileUploadResponse.text());\n return { success: false, message: 'File upload failed' };\n }\n\n const fileResult = await fileUploadResponse.json();\n const fileUuid = fileResult.data.id;\n\n const mediaData = {\n data: {\n type: 'media--image',\n attributes: {\n name: mediaName,\n status: true,\n },\n relationships: {\n field_media_image: {\n data: {\n type: 'file--file',\n id: fileUuid,\n meta: {\n alt: alt || mediaName,\n },\n },\n },\n },\n },\n };\n\n const mediaResponse = await fetch(`${client.baseUrl}/jsonapi/media/image`, {\n method: 'POST',\n body: JSON.stringify(mediaData),\n headers: {\n 'Content-Type': 'application/vnd.api+json',\n Accept: 'application/vnd.api+json',\n Authorization: `Bearer ${token}`,\n },\n });\n\n if (!mediaResponse.ok) {\n console.error(\n 'Media entity creation failed:',\n await mediaResponse.text()\n );\n return { success: false, message: 'Media entity creation failed' };\n }\n\n const mediaResult = await mediaResponse.json();\n const data = await enrichCreatedMedia(\n client,\n mediaResult.data,\n 'image',\n lang\n );\n\n return { success: true, message: 'Image uploaded successfully', data };\n } catch (error) {\n console.error('Error uploading image media:', error);\n return { success: false, message: 'An unexpected error occurred' };\n }\n}\n\n/** Creates a remote video media entity in Drupal from a YouTube/Vimeo page URL. */\nexport async function uploadRemoteVideo(\n client: NodeHiveClient,\n { videoUrl, name, lang }: { videoUrl: string; name?: string; lang?: string }\n): Promise<MediaUploadResult> {\n const token = await client.getToken();\n if (!token) {\n return { success: false, message: 'Authentication required' };\n }\n\n if (!videoUrl) {\n return { success: false, message: 'No video URL provided' };\n }\n\n try {\n const mediaData = {\n data: {\n type: 'media--remote_video',\n attributes: {\n name: name,\n status: true,\n field_media_oembed_video: videoUrl,\n },\n },\n };\n\n const mediaResponse = await fetch(\n `${client.baseUrl}/jsonapi/media/remote_video`,\n {\n method: 'POST',\n body: JSON.stringify(mediaData),\n headers: {\n 'Content-Type': 'application/vnd.api+json',\n Accept: 'application/vnd.api+json',\n Authorization: `Bearer ${token}`,\n },\n }\n );\n\n if (!mediaResponse.ok) {\n console.error(\n 'Remote video entity creation failed:',\n await mediaResponse.text()\n );\n return { success: false, message: 'Remote video entity creation failed' };\n }\n\n const mediaResult = await mediaResponse.json();\n const data = await enrichCreatedMedia(\n client,\n mediaResult.data,\n 'remote_video',\n lang\n );\n\n return { success: true, message: 'Remote video added successfully', data };\n } catch (error) {\n console.error('Error adding remote video:', error);\n return { success: false, message: 'An unexpected error occurred' };\n }\n}\n"],"mappings":"AAEA,SAASA,gBAAgB,QAAQ,gBAAgB;AAQjD,eAAeC,kBAAkBA,CAC/BC,MAAsB,EACtBC,OA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AE,IAAI;UACZU,wBAAwB,EAAED;QAC5B;MACF;IACF,CAAC;IAED,MAAML,aAAa,GAAG,MAAMhB,KAAK,CAC/B,GAAGjC,MAAM,CAAC2B,OAAO,6BAA6B,EAC9C;MACEO,MAAM,EAAE,MAAM;MACdI,IAAI,EAAEY,IAAI,CAACC,SAAS,CAACP,SAAS,CAAC;MAC/BT,OAAO,EAAE;QACP,cAAc,EAAE,0BAA0B;QAC1CC,MAAM,EAAE,0BAA0B;QAClCC,aAAa,EAAE,UAAUpB,KAAK;MAChC;IACF,CACF,CAAC;IAED,IAAI,CAACgC,aAAa,CAACV,EAAE,EAAE;MACrB3B,OAAO,CAACD,KAAK,CACX,sCAAsC,EACtC,MAAMsC,aAAa,CAACT,IAAI,CAAC,CAC3B,CAAC;MACD,OAAO;QAAErB,OAAO,EAAE,KAAK;QAAEC,OAAO,EAAE;MAAsC,CAAC;IAC3E;IAEA,MAAMgC,WAAW,GAAG,MAAMH,aAAa,CAACP,IAAI,CAAC,CAAC;IAC9C,MAAMhC,IAAI,GAAG,MAAMX,kBAAkB,CACnCC,MAAM,EACNoD,WAAW,CAAC1C,IAAI,EAChB,cAAc,EACdP,IACF,CAAC;IAED,OAAO;MAAEgB,OAAO,EAAE,IAAI;MAAEC,OAAO,EAAE,iCAAiC;MAAEV;IAAK,CAAC;EAC5E,CAAC,CAAC,OAAOC,KAAK,EAAE;IACdC,OAAO,CAACD,KAAK,CAAC,4BAA4B,EAAEA,KAAK,CAAC;IAClD,OAAO;MAAEQ,OAAO,EAAE,KAAK;MAAEC,OAAO,EAAE;IAA+B,CAAC;EACpE;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"media-upload.js","names":["mediaEntityType","buildMediaParams","enrichCreatedMedia","client","created","type","media","lang","enriched","getMedia","id","attributes","langcode","params","data","error","console","uploadImage","file","alt","name","token","getToken","success","message","code","mediaName","fileBuffer","Buffer","from","arrayBuffer","fileUploadUrl","baseUrl","imageType","imageFileField","asciiFilename","replace","contentDisposition","encodeURIComponent","fileUploadResponse","fetch","method","headers","Accept","Authorization","body","ok","text","fileResult","json","fileUuid","mediaData","status","relationships","meta","mediaResponse","JSON","stringify","mediaResult","uploadRemoteVideo","videoUrl","remoteVideoType","remoteVideoUrlField"],"sources":["../../../../src/puck-editor/internal/api/media-upload.ts"],"sourcesContent":["import type { NodeHiveClient } from 'nodehive-js';\n\nimport { mediaEntityType, type PuckMediaConfig } from '../content-model.ts';\nimport type { PuckApiMessageCode } from './localize-message.ts';\nimport { buildMediaParams } from './media-params.ts';\n\nexport type MediaUploadResult = {\n success: boolean;\n message: string;\n code?: PuckApiMessageCode;\n data?: unknown;\n};\n\nasync function enrichCreatedMedia(\n client: NodeHiveClient,\n created: { id: string; attributes?: { langcode?: string } },\n type: string,\n media: PuckMediaConfig,\n lang?: string\n) {\n try {\n const enriched = await client.getMedia(created.id, type, {\n lang: created?.attributes?.langcode || lang || 'en',\n params: buildMediaParams(type, media),\n });\n return enriched?.data || created;\n } catch (error) {\n console.error('Error enriching created media:', error);\n return created;\n }\n}\n\n/**\n * Uploads an image file to Drupal and creates a media entity, using Flow 2 of\n * the JSON:API file upload process: upload the binary to create a file entity,\n * then create a media entity referencing it.\n */\nexport async function uploadImage(\n client: NodeHiveClient,\n media: PuckMediaConfig,\n {\n file,\n alt,\n name,\n lang,\n }: { file: File; alt?: string; name?: string; lang?: string }\n): Promise<MediaUploadResult> {\n const token = await client.getToken();\n if (!token) {\n return {\n success: false,\n message: 'Authentication required',\n code: 'authRequired',\n };\n }\n\n const mediaName = name || file.name || 'Image';\n\n try {\n const fileBuffer = Buffer.from(await file.arrayBuffer());\n const fileUploadUrl = `${client.baseUrl}/jsonapi/media/${media.imageType}/${media.imageFileField}`;\n\n const asciiFilename = file.name\n .replace(/[^\\x20-\\x7e]/g, '_')\n .replace(/\"/g, '');\n const contentDisposition = `attachment; filename=\"${asciiFilename}\"; filename*=UTF-8''${encodeURIComponent(file.name)}`;\n\n const fileUploadResponse = await fetch(fileUploadUrl, {\n method: 'POST',\n headers: {\n Accept: 'application/vnd.api+json',\n 'Content-Type': 'application/octet-stream',\n 'Content-Disposition': contentDisposition,\n Authorization: `Bearer ${token}`,\n },\n body: fileBuffer,\n });\n\n if (!fileUploadResponse.ok) {\n console.error('File upload failed:', await fileUploadResponse.text());\n return {\n success: false,\n message: 'File upload failed',\n code: 'fileUploadFailed',\n };\n }\n\n const fileResult = await fileUploadResponse.json();\n const fileUuid = fileResult.data.id;\n\n const mediaData = {\n data: {\n type: mediaEntityType(media.imageType),\n attributes: {\n name: mediaName,\n status: true,\n },\n relationships: {\n [media.imageFileField]: {\n data: {\n type: 'file--file',\n id: fileUuid,\n meta: {\n alt: alt || mediaName,\n },\n },\n },\n },\n },\n };\n\n const mediaResponse = await fetch(\n `${client.baseUrl}/jsonapi/media/${media.imageType}`,\n {\n method: 'POST',\n body: JSON.stringify(mediaData),\n headers: {\n 'Content-Type': 'application/vnd.api+json',\n Accept: 'application/vnd.api+json',\n Authorization: `Bearer ${token}`,\n },\n }\n );\n\n if (!mediaResponse.ok) {\n console.error(\n 'Media entity creation failed:',\n await mediaResponse.text()\n );\n return {\n success: false,\n message: 'Media entity creation failed',\n code: 'mediaCreateFailed',\n };\n }\n\n const mediaResult = await mediaResponse.json();\n const data = await enrichCreatedMedia(\n client,\n mediaResult.data,\n media.imageType,\n media,\n lang\n );\n\n return {\n success: true,\n message: 'Image uploaded successfully',\n code: 'imageUploaded',\n data,\n };\n } catch (error) {\n console.error('Error uploading image media:', error);\n return {\n success: false,\n message: 'An unexpected error occurred',\n code: 'unexpectedError',\n };\n }\n}\n\n/** Creates a remote video media entity in Drupal from a YouTube/Vimeo page URL. */\nexport async function uploadRemoteVideo(\n client: NodeHiveClient,\n media: PuckMediaConfig,\n { videoUrl, name, lang }: { videoUrl: string; name?: string; lang?: string }\n): Promise<MediaUploadResult> {\n const token = await client.getToken();\n if (!token) {\n return {\n success: false,\n message: 'Authentication required',\n code: 'authRequired',\n };\n }\n\n if (!videoUrl) {\n return {\n success: false,\n message: 'No video URL provided',\n code: 'videoUrlRequired',\n };\n }\n\n try {\n const mediaData = {\n data: {\n type: mediaEntityType(media.remoteVideoType),\n attributes: {\n name: name,\n status: true,\n [media.remoteVideoUrlField]: videoUrl,\n },\n },\n };\n\n const mediaResponse = await fetch(\n `${client.baseUrl}/jsonapi/media/${media.remoteVideoType}`,\n {\n method: 'POST',\n body: JSON.stringify(mediaData),\n headers: {\n 'Content-Type': 'application/vnd.api+json',\n Accept: 'application/vnd.api+json',\n Authorization: `Bearer ${token}`,\n },\n }\n );\n\n if (!mediaResponse.ok) {\n console.error(\n 'Remote video entity creation failed:',\n await mediaResponse.text()\n );\n return {\n success: false,\n message: 'Remote video entity creation failed',\n code: 'remoteVideoCreateFailed',\n };\n }\n\n const mediaResult = await mediaResponse.json();\n const data = await enrichCreatedMedia(\n client,\n mediaResult.data,\n media.remoteVideoType,\n media,\n lang\n );\n\n return {\n success: true,\n message: 'Remote video added successfully',\n code: 'remoteVideoAdded',\n data,\n };\n } catch (error) {\n console.error('Error adding remote video:', error);\n return {\n success: false,\n message: 'An unexpected error occurred',\n code: 'unexpectedError',\n };\n }\n}\n"],"mappings":"AAEA,SAASA,eAAe,QAA8B,qBAAqB;AAE3E,SAASC,gBAAgB,QAAQ,mBAAmB;AASpD,eAAeC,kBAAkBA,CAC/BC,MAAsB,EACtBC,OAA2D,EAC3DC,IAAY,EACZC,KAAsB,EACtBC,IAAa,EACb;EACA,IAAI;IACF,MAAMC,QAAQ,GAAG,MAAML,MAAM,CAACM,QAAQ,CAACL,OAAO,CAACM,EAAE,EAAEL,IAAI,EAAE;MACvDE,IAAI,EAAEH,OAAO,EAAEO,UAAU,EAAEC,QAAQ,IAAIL,IAAI,IAAI,IAAI;MACnDM,MAAM,EAAEZ,gBAAgB,CAACI,IAAI,EAAEC,KAAK;IACtC,CAAC,CAAC;IACF,OAAOE,QAAQ,EAAEM,IAAI,IAAIV,OAAO;EAClC,CAAC,CAAC,O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ode = 'authRequired' | 'fileUploadFailed' | 'mediaCreateFailed' | 'imageUploaded' | 'unexpectedError' | 'videoUrlRequired' | 'remoteVideoCreateFailed' | 'remoteVideoAdded' | 'payloadTooLarge' | 'invalidMediaType' | 'invalidVideoUrl' | 'fileRequired' | 'nameRequired' | 'contentRequired' | 'spaceUnresolved' | 'templateSaveError' | 'templateSaved' | 'templateUpdateError' | 'templateUpdated' | 'templateDeleteError' | 'templateDeleted' | 'builtinNotEditable' | 'builtinNotDeletable';
|
|
2
|
+
export type ApiMessageParams = Record<string, string | number>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-codes.js","names":[],"sources":["../../../../src/puck-editor/internal/api/message-codes.ts"],"sourcesContent":["export type PuckApiMessageCode =\n | 'authRequired'\n | 'fileUploadFailed'\n | 'mediaCreateFailed'\n | 'imageUploaded'\n | 'unexpectedError'\n | 'videoUrlRequired'\n | 'remoteVideoCreateFailed'\n | 'remoteVideoAdded'\n | 'payloadTooLarge'\n | 'invalidMediaType'\n | 'invalidVideoUrl'\n | 'fileRequired'\n | 'nameRequired'\n | 'contentRequired'\n | 'spaceUnresolved'\n | 'templateSaveError'\n | 'templateSaved'\n | 'templateUpdateError'\n | 'templateUpdated'\n | 'templateDeleteError'\n | 'templateDeleted'\n | 'builtinNotEditable'\n | 'builtinNotDeletable';\n\nexport type ApiMessageParams = Record<string, string | number>;\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// node/media/fragment type segments land in JSON:API URLs; reject anything
|
|
2
|
+
// that could smuggle path segments before the handlers interpolate them. The
|
|
3
|
+
// allowed shape is a Drupal machine name: lowercase letters, digits and
|
|
4
|
+
// underscores.
|
|
5
|
+
export const TYPE_SEGMENT_RE = /^[a-z0-9_]+$/;
|
|
6
|
+
export function isValidTypeSegment(segment) {
|
|
7
|
+
return typeof segment === 'string' && TYPE_SEGMENT_RE.test(segment);
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=type-segment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type-segment.js","names":["TYPE_SEGMENT_RE","isValidTypeSegment","segment","test"],"sources":["../../../../src/puck-editor/internal/api/type-segment.ts"],"sourcesContent":["// node/media/fragment type segments land in JSON:API URLs; reject anything\n// that could smuggle path segments before the handlers interpolate them. The\n// allowed shape is a Drupal machine name: lowercase letters, digits and\n// underscores.\nexport const TYPE_SEGMENT_RE = /^[a-z0-9_]+$/;\n\nexport function isValidTypeSegment(segment: string | undefined): boolean {\n return typeof segment === 'string' && TYPE_SEGMENT_RE.test(segment);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA,OAAO,MAAMA,eAAe,GAAG,cAAc;AAE7C,OAAO,SAASC,kBAAkBA,CAACC,OAA2B,EAAW;EACvE,OAAO,OAAOA,OAAO,KAAK,QAAQ,IAAIF,eAAe,CAACG,IAAI,CAACD,OAAO,CAAC;AACrE","ignoreList":[]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { transformProps } from '@puckeditor/core';
|
|
2
|
+
import type { Config, Data } from '@puckeditor/core';
|
|
3
|
+
export type PuckPropTransforms = Parameters<typeof transformProps>[1];
|
|
2
4
|
export type PuckMetadataFields = {
|
|
3
5
|
/** Node field for the SEO title; false when the bundle has no such field. */
|
|
4
6
|
title?: string | false;
|
|
@@ -27,10 +29,33 @@ export type PuckTemplatesConfig = {
|
|
|
27
29
|
aiDescriptionField: string;
|
|
28
30
|
aiInstructionsField: string;
|
|
29
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* The Drupal media model. Bundle machine names are the slug only (the module
|
|
34
|
+
* derives the JSON:API `media--<slug>` type and the `/jsonapi/media/<slug>`
|
|
35
|
+
* endpoints); source field names are the raw Drupal field machine names.
|
|
36
|
+
* Defaults are the NodeHive standard, so consumers with a standard backend
|
|
37
|
+
* pass nothing.
|
|
38
|
+
*/
|
|
39
|
+
export type PuckMediaConfig = {
|
|
40
|
+
imageType: string;
|
|
41
|
+
imageFileField: string;
|
|
42
|
+
remoteVideoType: string;
|
|
43
|
+
remoteVideoUrlField: string;
|
|
44
|
+
videoType: string;
|
|
45
|
+
videoFileField: string;
|
|
46
|
+
audioType: string;
|
|
47
|
+
documentType: string;
|
|
48
|
+
/**
|
|
49
|
+
* Bundles the upload endpoint accepts. Defaults to the image + remote_video
|
|
50
|
+
* types (the only bundles with an implemented upload flow).
|
|
51
|
+
*/
|
|
52
|
+
uploadTypes: string[];
|
|
53
|
+
};
|
|
30
54
|
export type PuckContentModelInput = {
|
|
31
55
|
bundles?: PuckBundleConfig[];
|
|
32
56
|
templates?: Partial<PuckTemplatesConfig>;
|
|
33
57
|
maxUploadBytes?: number;
|
|
58
|
+
media?: Partial<PuckMediaConfig>;
|
|
34
59
|
};
|
|
35
60
|
export type ResolvedPuckBundle = {
|
|
36
61
|
type: string;
|
|
@@ -46,10 +71,13 @@ export type PuckContentModel = {
|
|
|
46
71
|
bundles: ResolvedPuckBundle[];
|
|
47
72
|
templates: PuckTemplatesConfig;
|
|
48
73
|
maxUploadBytes: number;
|
|
74
|
+
media: PuckMediaConfig;
|
|
49
75
|
};
|
|
76
|
+
/** JSON:API resource type for a media bundle slug, e.g. 'image' → 'media--image'. */
|
|
77
|
+
export declare function mediaEntityType(slug: string): string;
|
|
50
78
|
export declare const DEFAULT_METADATA_FIELDS: Required<PuckMetadataFields>;
|
|
51
79
|
export declare function resolveContentModel(input?: PuckContentModelInput): PuckContentModel;
|
|
52
80
|
export declare function getBundle(model: PuckContentModel, type: string | undefined): ResolvedPuckBundle | undefined;
|
|
53
|
-
export declare function
|
|
81
|
+
export declare function applyPropTransforms(data: Data, propTransforms: PuckPropTransforms | undefined, config: Config | undefined, source: string): Data;
|
|
82
|
+
export declare function parsePuckData(raw: unknown, nodeId?: string, propTransforms?: PuckPropTransforms, config?: Config): Data;
|
|
54
83
|
export declare function creatableBundles(model: PuckContentModel): ResolvedPuckBundle[];
|
|
55
|
-
//# sourceMappingURL=content-model.d.ts.map
|
|
@@ -3,6 +3,20 @@
|
|
|
3
3
|
// and the client editor (PuckEditorConfigProvider); passing different values
|
|
4
4
|
// to the two sides makes publish validation drift from the editor UI.
|
|
5
5
|
|
|
6
|
+
import { transformProps } from '@puckeditor/core';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The Drupal media model. Bundle machine names are the slug only (the module
|
|
10
|
+
* derives the JSON:API `media--<slug>` type and the `/jsonapi/media/<slug>`
|
|
11
|
+
* endpoints); source field names are the raw Drupal field machine names.
|
|
12
|
+
* Defaults are the NodeHive standard, so consumers with a standard backend
|
|
13
|
+
* pass nothing.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** JSON:API resource type for a media bundle slug, e.g. 'image' → 'media--image'. */
|
|
17
|
+
export function mediaEntityType(slug) {
|
|
18
|
+
return `media--${slug}`;
|
|
19
|
+
}
|
|
6
20
|
export const DEFAULT_METADATA_FIELDS = {
|
|
7
21
|
title: 'field_metadata_title',
|
|
8
22
|
description: 'field_metadata_description',
|
|
@@ -20,6 +34,27 @@ const DEFAULT_TEMPLATES = {
|
|
|
20
34
|
aiInstructionsField: 'field_puck_ai_instructions'
|
|
21
35
|
};
|
|
22
36
|
const DEFAULT_MAX_UPLOAD_BYTES = 8 * 1024 * 1024;
|
|
37
|
+
const DEFAULT_MEDIA = {
|
|
38
|
+
imageType: 'image',
|
|
39
|
+
imageFileField: 'field_media_image',
|
|
40
|
+
remoteVideoType: 'remote_video',
|
|
41
|
+
remoteVideoUrlField: 'field_media_oembed_video',
|
|
42
|
+
videoType: 'video',
|
|
43
|
+
videoFileField: 'field_media_video_file',
|
|
44
|
+
audioType: 'audio',
|
|
45
|
+
documentType: 'document',
|
|
46
|
+
uploadTypes: ['image', 'remote_video']
|
|
47
|
+
};
|
|
48
|
+
function resolveMedia(input) {
|
|
49
|
+
const media = {
|
|
50
|
+
...DEFAULT_MEDIA,
|
|
51
|
+
...input
|
|
52
|
+
};
|
|
53
|
+
if (input?.uploadTypes == null) {
|
|
54
|
+
media.uploadTypes = [media.imageType, media.remoteVideoType];
|
|
55
|
+
}
|
|
56
|
+
return media;
|
|
57
|
+
}
|
|
23
58
|
function humanizeType(type) {
|
|
24
59
|
const slug = type.replace(/^node--/, '').replace(/[_-]+/g, ' ');
|
|
25
60
|
return slug.charAt(0).toUpperCase() + slug.slice(1);
|
|
@@ -44,26 +79,61 @@ export function resolveContentModel(input) {
|
|
|
44
79
|
...DEFAULT_TEMPLATES,
|
|
45
80
|
...input?.templates
|
|
46
81
|
},
|
|
47
|
-
maxUploadBytes: input?.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES
|
|
82
|
+
maxUploadBytes: input?.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES,
|
|
83
|
+
media: resolveMedia(input?.media)
|
|
48
84
|
};
|
|
49
85
|
}
|
|
50
86
|
export function getBundle(model, type) {
|
|
51
87
|
return model.bundles.find(bundle => bundle.type === type);
|
|
52
88
|
}
|
|
89
|
+
|
|
90
|
+
// root.props must always exist: transformProps treats a root without props
|
|
91
|
+
// as legacy data and would write root transforms to top-level root keys.
|
|
53
92
|
const normalizePuckData = parsed => ({
|
|
54
|
-
root:
|
|
55
|
-
props: {}
|
|
93
|
+
root: {
|
|
94
|
+
props: {},
|
|
95
|
+
...parsed?.root
|
|
56
96
|
},
|
|
57
97
|
content: parsed?.content ?? [],
|
|
58
98
|
zones: parsed?.zones ?? {}
|
|
59
99
|
});
|
|
60
100
|
const emptyPuckData = () => normalizePuckData(null);
|
|
61
|
-
|
|
101
|
+
const isValidComponent = entry => typeof entry === 'object' && entry !== null && typeof entry.type === 'string' && typeof entry.props === 'object' && entry.props !== null;
|
|
102
|
+
function sanitizeContent(data, source) {
|
|
103
|
+
if (!Array.isArray(data.content)) return {
|
|
104
|
+
...data,
|
|
105
|
+
content: []
|
|
106
|
+
};
|
|
107
|
+
const content = data.content.filter(isValidComponent);
|
|
108
|
+
const dropped = data.content.length - content.length;
|
|
109
|
+
if (dropped > 0) {
|
|
110
|
+
console.warn(`puck-editor: dropped ${dropped} malformed content ${dropped === 1 ? 'entry' : 'entries'} for ${source}`);
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
...data,
|
|
114
|
+
content
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function applyPropTransforms(data, propTransforms, config, source) {
|
|
118
|
+
if (!propTransforms || Object.keys(propTransforms).length === 0) return data;
|
|
119
|
+
if (!config) {
|
|
120
|
+
console.warn(`puck-editor: propTransforms for ${source} were applied without a config; components nested in slots are not transformed. Pass the Puck config alongside the transforms.`);
|
|
121
|
+
}
|
|
122
|
+
try {
|
|
123
|
+
return transformProps(data, propTransforms, config);
|
|
124
|
+
} catch (error) {
|
|
125
|
+
console.error(`puck-editor: propTransforms failed for ${source}; using untransformed data`, error);
|
|
126
|
+
return data;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
export function parsePuckData(raw, nodeId, propTransforms, config) {
|
|
130
|
+
const source = `node "${nodeId ?? 'unknown'}"`;
|
|
62
131
|
if (typeof raw !== 'string' || !raw) return emptyPuckData();
|
|
63
132
|
try {
|
|
64
|
-
|
|
133
|
+
const data = sanitizeContent(normalizePuckData(JSON.parse(raw)), source);
|
|
134
|
+
return applyPropTransforms(data, propTransforms, config, source);
|
|
65
135
|
} catch (error) {
|
|
66
|
-
console.error(`puck-editor: failed to parse Puck data for
|
|
136
|
+
console.error(`puck-editor: failed to parse Puck data for ${source}`, error);
|
|
67
137
|
return emptyPuckData();
|
|
68
138
|
}
|
|
69
139
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-model.js","names":["DEFAULT_METADATA_FIELDS","title","description","image","DEFAULT_BUNDLES","type","dataField","DEFAULT_TEMPLATES","fragmentType","categoryField","aiDescriptionField","aiInstructionsField","DEFAULT_MAX_UPLOAD_BYTES","humanizeType","slug","replace","charAt","toUpperCase","slice","resolveContentModel","input","bundles","length","map","bundle","label","creatable","createDefaults","metadataFields","templates","maxUploadBytes","getBundle","model","find","normalizePuckData","parsed","root","props","content","zones","emptyPuckData","parsePuckData","raw","nodeId","JSON","parse","error","console","creatableBundles","filter"],"sources":["../../../src/puck-editor/internal/content-model.ts"],"sourcesContent":["// Single source for everything the module assumes about the Drupal content\n// model. The same resolved model drives the server handlers (createPuckApi)\n// and the client editor (PuckEditorConfigProvider); passing different values\n// to the two sides makes publish validation drift from the editor UI.\n\nimport type { Data } from '@puckeditor/core';\n\nexport type PuckMetadataFields = {\n /** Node field for the SEO title; false when the bundle has no such field. */\n title?: string | false;\n description?: string | false;\n image?: string | false;\n};\n\nexport type PuckBundleConfig = {\n /** JSON:API resource type, e.g. 'node--puck_page'. */\n type: string;\n /** Node field holding the serialized Puck data. */\n dataField: string;\n /** Shown in the new-page type chooser; defaults to a humanized type. */\n label?: string;\n /** Offered by the new-page action; defaults to true. */\n creatable?: boolean;\n createDefaults?: { title?: string };\n metadataFields?: PuckMetadataFields;\n};\n\nexport type PuckTemplatesConfig = {\n /** NodeHive fragment type storing editor templates. */\n fragmentType: string;\n dataField: string;\n categoryField: string;\n aiDescriptionField: string;\n aiInstructionsField: string;\n};\n\nexport type PuckContentModelInput = {\n bundles?: PuckBundleConfig[];\n templates?: Partial<PuckTemplatesConfig>;\n maxUploadBytes?: number;\n};\n\nexport type ResolvedPuckBundle = {\n type: string;\n dataField: string;\n label: string;\n creatable: boolean;\n createDefaults: { title?: string };\n metadataFields: Required<PuckMetadataFields>;\n};\n\nexport type PuckContentModel = {\n bundles: ResolvedPuckBundle[];\n templates: PuckTemplatesConfig;\n maxUploadBytes: number;\n};\n\nexport const DEFAULT_METADATA_FIELDS: Required<PuckMetadataFields> = {\n title: 'field_metadata_title',\n description: 'field_metadata_description',\n image: 'field_metadata_image',\n};\n\nconst DEFAULT_BUNDLES: PuckBundleConfig[] = [\n { type: 'node--puck_page', dataField: 'field_puck_data' },\n];\n\nconst DEFAULT_TEMPLATES: PuckTemplatesConfig = {\n fragmentType: 'puck_template',\n dataField: 'field_puck_template_data',\n categoryField: 'field_puck_template_category',\n aiDescriptionField: 'field_puck_ai_description',\n aiInstructionsField: 'field_puck_ai_instructions',\n};\n\nconst DEFAULT_MAX_UPLOAD_BYTES = 8 * 1024 * 1024;\n\nfunction humanizeType(type: string): string {\n const slug = type.replace(/^node--/, '').replace(/[_-]+/g, ' ');\n return slug.charAt(0).toUpperCase() + slug.slice(1);\n}\n\nexport function resolveContentModel(\n input?: PuckContentModelInput\n): PuckContentModel {\n const bundles = (\n input?.bundles?.length ? input.bundles : DEFAULT_BUNDLES\n ).map((bundle) => ({\n type: bundle.type,\n dataField: bundle.dataField,\n label: bundle.label ?? humanizeType(bundle.type),\n creatable: bundle.creatable ?? true,\n createDefaults: { title: bundle.createDefaults?.title },\n metadataFields: { ...DEFAULT_METADATA_FIELDS, ...bundle.metadataFields },\n }));\n return {\n bundles,\n templates: { ...DEFAULT_TEMPLATES, ...input?.templates },\n maxUploadBytes: input?.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES,\n };\n}\n\nexport function getBundle(\n model: PuckContentModel,\n type: string | undefined\n): ResolvedPuckBundle | undefined {\n return model.bundles.find((bundle) => bundle.type === type);\n}\n\nconst normalizePuckData = (parsed: Partial<Data> | null): Data =>\n ({\n root: parsed?.root ?? { props: {} },\n content: parsed?.content ?? [],\n zones: parsed?.zones ?? {},\n }) as Data;\n\nconst emptyPuckData = (): Data => normalizePuckData(null);\n\nexport function parsePuckData(raw: unknown, nodeId?: string): Data {\n if (typeof raw !== 'string' || !raw) return emptyPuckData();\n try {\n return normalizePuckData(JSON.parse(raw) as Partial<Data> | null);\n } catch (error) {\n console.error(\n `puck-editor: failed to parse Puck data for node \"${nodeId ?? 'unknown'}\"`,\n error\n );\n return emptyPuckData();\n }\n}\n\nexport function creatableBundles(\n model: PuckContentModel\n): ResolvedPuckBundle[] {\n return model.bundles.filter((bundle) => bundle.creatable);\n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AK,CAACX,OAAO,CAAC4B,MAAM,CAAEzB,MAAM,IAAKA,MAAM,CAACE,SAAS,CAAC;AAC3D","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"content-model.js","names":["transformProps","mediaEntityType","slug","DEFAULT_METADATA_FIELDS","title","description","image","DEFAULT_BUNDLES","type","dataField","DEFAULT_TEMPLATES","fragmentType","categoryField","aiDescriptionField","aiInstructionsField","DEFAULT_MAX_UPLOAD_BYTES","DEFAULT_MEDIA","imageType","imageFileField","remoteVideoType","remoteVideoUrlField","videoType","videoFileField","audioType","documentType","uploadTypes","resolveMedia","input","media","humanizeType","replace","charAt","toUpperCase","slice","resolveContentModel","bundles","length","map","bundle","label","creatable","createDefaults","metadataFields","templates","maxUploadBytes","getBundle","model","find","normalizePuckData","parsed","root","props","content","zones","emptyPuckData","isValidComponent","entry","sanitizeContent","data","source","Array","isArray","filter","dropped","console","warn","applyPropTransforms","propTransforms","config","Object","keys","error","parsePuckData","raw","nodeId","JSON","parse","creatableBundles"],"sources":["../../../src/puck-editor/internal/content-model.ts"],"sourcesContent":["// Single source for everything the module assumes about the Drupal content\n// model. The same resolved model drives the server handlers (createPuckApi)\n// and the client editor (PuckEditorConfigProvider); passing different values\n// to the two sides makes publish validation drift from the editor UI.\n\nimport { transformProps } from '@puckeditor/core';\nimport type { Config, Data } from '@puckeditor/core';\n\nexport type PuckPropTransforms = Parameters<typeof transformProps>[1];\n\nexport type PuckMetadataFields = {\n /** Node field for the SEO title; false when the bundle has no such field. */\n title?: string | false;\n description?: string | false;\n image?: string | false;\n};\n\nexport type PuckBundleConfig = {\n /** JSON:API resource type, e.g. 'node--puck_page'. */\n type: string;\n /** Node field holding the serialized Puck data. */\n dataField: string;\n /** Shown in the new-page type chooser; defaults to a humanized type. */\n label?: string;\n /** Offered by the new-page action; defaults to true. */\n creatable?: boolean;\n createDefaults?: { title?: string };\n metadataFields?: PuckMetadataFields;\n};\n\nexport type PuckTemplatesConfig = {\n /** NodeHive fragment type storing editor templates. */\n fragmentType: string;\n dataField: string;\n categoryField: string;\n aiDescriptionField: string;\n aiInstructionsField: string;\n};\n\n/**\n * The Drupal media model. Bundle machine names are the slug only (the module\n * derives the JSON:API `media--<slug>` type and the `/jsonapi/media/<slug>`\n * endpoints); source field names are the raw Drupal field machine names.\n * Defaults are the NodeHive standard, so consumers with a standard backend\n * pass nothing.\n */\nexport type PuckMediaConfig = {\n imageType: string;\n imageFileField: string;\n remoteVideoType: string;\n remoteVideoUrlField: string;\n videoType: string;\n videoFileField: string;\n audioType: string;\n documentType: string;\n /**\n * Bundles the upload endpoint accepts. Defaults to the image + remote_video\n * types (the only bundles with an implemented upload flow).\n */\n uploadTypes: string[];\n};\n\nexport type PuckContentModelInput = {\n bundles?: PuckBundleConfig[];\n templates?: Partial<PuckTemplatesConfig>;\n maxUploadBytes?: number;\n media?: Partial<PuckMediaConfig>;\n};\n\nexport type ResolvedPuckBundle = {\n type: string;\n dataField: string;\n label: string;\n creatable: boolean;\n createDefaults: { title?: string };\n metadataFields: Required<PuckMetadataFields>;\n};\n\nexport type PuckContentModel = {\n bundles: ResolvedPuckBundle[];\n templates: PuckTemplatesConfig;\n maxUploadBytes: number;\n media: PuckMediaConfig;\n};\n\n/** JSON:API resource type for a media bundle slug, e.g. 'image' → 'media--image'. */\nexport function mediaEntityType(slug: string): string {\n return `media--${slug}`;\n}\n\nexport const DEFAULT_METADATA_FIELDS: Required<PuckMetadataFields> = {\n title: 'field_metadata_title',\n description: 'field_metadata_description',\n image: 'field_metadata_image',\n};\n\nconst DEFAULT_BUNDLES: PuckBundleConfig[] = [\n { type: 'node--puck_page', dataField: 'field_puck_data' },\n];\n\nconst DEFAULT_TEMPLATES: PuckTemplatesConfig = {\n fragmentType: 'puck_template',\n dataField: 'field_puck_template_data',\n categoryField: 'field_puck_template_category',\n aiDescriptionField: 'field_puck_ai_description',\n aiInstructionsField: 'field_puck_ai_instructions',\n};\n\nconst DEFAULT_MAX_UPLOAD_BYTES = 8 * 1024 * 1024;\n\nconst DEFAULT_MEDIA: PuckMediaConfig = {\n imageType: 'image',\n imageFileField: 'field_media_image',\n remoteVideoType: 'remote_video',\n remoteVideoUrlField: 'field_media_oembed_video',\n videoType: 'video',\n videoFileField: 'field_media_video_file',\n audioType: 'audio',\n documentType: 'document',\n uploadTypes: ['image', 'remote_video'],\n};\n\nfunction resolveMedia(input?: Partial<PuckMediaConfig>): PuckMediaConfig {\n const media = { ...DEFAULT_MEDIA, ...input };\n if (input?.uploadTypes == null) {\n media.uploadTypes = [media.imageType, media.remoteVideoType];\n }\n return media;\n}\n\nfunction humanizeType(type: string): string {\n const slug = type.replace(/^node--/, '').replace(/[_-]+/g, ' ');\n return slug.charAt(0).toUpperCase() + slug.slice(1);\n}\n\nexport function resolveContentModel(\n input?: PuckContentModelInput\n): PuckContentModel {\n const bundles = (\n input?.bundles?.length ? input.bundles : DEFAULT_BUNDLES\n ).map((bundle) => ({\n type: bundle.type,\n dataField: bundle.dataField,\n label: bundle.label ?? humanizeType(bundle.type),\n creatable: bundle.creatable ?? true,\n createDefaults: { title: bundle.createDefaults?.title },\n metadataFields: { ...DEFAULT_METADATA_FIELDS, ...bundle.metadataFields },\n }));\n return {\n bundles,\n templates: { ...DEFAULT_TEMPLATES, ...input?.templates },\n maxUploadBytes: input?.maxUploadBytes ?? DEFAULT_MAX_UPLOAD_BYTES,\n media: resolveMedia(input?.media),\n };\n}\n\nexport function getBundle(\n model: PuckContentModel,\n type: string | undefined\n): ResolvedPuckBundle | undefined {\n return model.bundles.find((bundle) => bundle.type === type);\n}\n\n// root.props must always exist: transformProps treats a root without props\n// as legacy data and would write root transforms to top-level root keys.\nconst normalizePuckData = (parsed: Partial<Data> | null): Data =>\n ({\n root: { props: {}, ...parsed?.root },\n content: parsed?.content ?? [],\n zones: parsed?.zones ?? {},\n }) as Data;\n\nconst emptyPuckData = (): Data => normalizePuckData(null);\n\nconst isValidComponent = (entry: unknown): boolean =>\n typeof entry === 'object' &&\n entry !== null &&\n typeof (entry as { type?: unknown }).type === 'string' &&\n typeof (entry as { props?: unknown }).props === 'object' &&\n (entry as { props?: unknown }).props !== null;\n\nfunction sanitizeContent(data: Data, source: string): Data {\n if (!Array.isArray(data.content)) return { ...data, content: [] };\n const content = data.content.filter(isValidComponent);\n const dropped = data.content.length - content.length;\n if (dropped > 0) {\n console.warn(\n `puck-editor: dropped ${dropped} malformed content ${\n dropped === 1 ? 'entry' : 'entries'\n } for ${source}`\n );\n }\n return { ...data, content };\n}\n\nexport function applyPropTransforms(\n data: Data,\n propTransforms: PuckPropTransforms | undefined,\n config: Config | undefined,\n source: string\n): Data {\n if (!propTransforms || Object.keys(propTransforms).length === 0) return data;\n if (!config) {\n console.warn(\n `puck-editor: propTransforms for ${source} were applied without a config; components nested in slots are not transformed. Pass the Puck config alongside the transforms.`\n );\n }\n try {\n return transformProps(data, propTransforms, config);\n } catch (error) {\n console.error(\n `puck-editor: propTransforms failed for ${source}; using untransformed data`,\n error\n );\n return data;\n }\n}\n\nexport function parsePuckData(\n raw: unknown,\n nodeId?: string,\n propTransforms?: PuckPropTransforms,\n config?: Config\n): Data {\n const source = `node \"${nodeId ?? 'unknown'}\"`;\n if (typeof raw !== 'string' || !raw) return emptyPuckData();\n try {\n const data = sanitizeContent(\n normalizePuckData(JSON.parse(raw) as Partial<Data> | null),\n source\n );\n return applyPropTransforms(data, propTransforms, config, source);\n } catch (error) {\n console.error(\n `puck-editor: failed to parse Puck data for ${source}`,\n error\n );\n return emptyPuckData();\n }\n}\n\nexport function creatableBundles(\n model: PuckContentModel\n): ResolvedPuckBundle[] {\n return model.bundles.filter((bundle) => bundle.creatable);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,kBAAkB;;AAkCjD;AACA;AACA;AACA;AACA;AACA;AACA;;AAwCA;AACA,OAAO,SAASC,eAAeA,CAACC,IAAY,EAAU;EACpD,OAAO,UAAUA,IAAI,EAAE;AACzB;AAEA,OAAO,MAAMC,uBAAqD,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