@strapi/content-manager 5.50.2 → 5.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/admin/content-manager.js +31 -4
  2. package/dist/admin/content-manager.js.map +1 -1
  3. package/dist/admin/content-manager.mjs +31 -4
  4. package/dist/admin/content-manager.mjs.map +1 -1
  5. package/dist/admin/index.js +1 -1
  6. package/dist/admin/index.js.map +1 -1
  7. package/dist/admin/index.mjs +1 -1
  8. package/dist/admin/index.mjs.map +1 -1
  9. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js +23 -7
  10. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.js.map +1 -1
  11. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs +23 -7
  12. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.mjs.map +1 -1
  13. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js +5 -13
  14. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
  15. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs +5 -13
  16. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
  17. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +4 -1
  18. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  19. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +4 -1
  20. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  21. package/dist/admin/pages/EditView/utils/draftRelationCounts.js +14 -7
  22. package/dist/admin/pages/EditView/utils/draftRelationCounts.js.map +1 -1
  23. package/dist/admin/pages/EditView/utils/draftRelationCounts.mjs +14 -8
  24. package/dist/admin/pages/EditView/utils/draftRelationCounts.mjs.map +1 -1
  25. package/dist/admin/preview/components/PreviewSidePanel.js +46 -9
  26. package/dist/admin/preview/components/PreviewSidePanel.js.map +1 -1
  27. package/dist/admin/preview/components/PreviewSidePanel.mjs +27 -10
  28. package/dist/admin/preview/components/PreviewSidePanel.mjs.map +1 -1
  29. package/dist/admin/src/index.d.ts +1 -1
  30. package/dist/admin/src/pages/EditView/components/FormInputs/Relations/Relations.d.ts +9 -1
  31. package/dist/admin/src/pages/EditView/utils/draftRelationCounts.d.ts +1 -0
  32. package/dist/server/src/history/routes/index.d.ts +3 -1
  33. package/dist/server/src/history/routes/index.d.ts.map +1 -1
  34. package/dist/server/src/homepage/index.d.ts +6 -2
  35. package/dist/server/src/homepage/index.d.ts.map +1 -1
  36. package/dist/server/src/homepage/routes/index.d.ts +3 -1
  37. package/dist/server/src/homepage/routes/index.d.ts.map +1 -1
  38. package/dist/server/src/index.d.ts +3 -1
  39. package/dist/server/src/index.d.ts.map +1 -1
  40. package/dist/server/src/preview/routes/index.d.ts +3 -1
  41. package/dist/server/src/preview/routes/index.d.ts.map +1 -1
  42. package/dist/server/src/routes/index.d.ts +3 -1
  43. package/dist/server/src/routes/index.d.ts.map +1 -1
  44. package/package.json +6 -6
@@ -1 +1 @@
1
- {"version":3,"file":"draftRelationCounts.mjs","sources":["../../../../../admin/src/pages/EditView/utils/draftRelationCounts.ts"],"sourcesContent":["import type { Component } from '../../../../../shared/contracts/components';\nimport type { ComponentsDictionary, Schema } from '../../../hooks/useDocument';\nimport type { RelationsFormValue } from '../components/FormInputs/Relations/Relations';\n\nexport interface DraftRelationCounts {\n unpublishedRelations: number;\n draftM2mLinks: number;\n}\n\nexport const EMPTY_DRAFT_RELATION_COUNTS: DraftRelationCounts = {\n unpublishedRelations: 0,\n draftM2mLinks: 0,\n};\n\nexport const isBidirectionalManyToMany = (attribute: Schema['attributes'][string]) => {\n if (attribute.type !== 'relation' || attribute.relation !== 'manyToMany') {\n return false;\n }\n\n const relationAttribute = attribute as Extract<\n Schema['attributes'][string],\n { type: 'relation'; relation: 'manyToMany' }\n > & {\n inversedBy?: string;\n mappedBy?: string;\n };\n\n return Boolean(relationAttribute.inversedBy || relationAttribute.mappedBy);\n};\n\nexport const mergeDraftRelationCounts = (\n left: DraftRelationCounts,\n right: DraftRelationCounts\n): DraftRelationCounts => ({\n unpublishedRelations: left.unpublishedRelations + right.unpublishedRelations,\n draftM2mLinks: left.draftM2mLinks + right.draftM2mLinks,\n});\n\nexport const normalizeDraftRelationCounts = (payload: unknown): DraftRelationCounts => {\n if (\n payload &&\n typeof payload === 'object' &&\n 'unpublishedRelations' in payload &&\n 'draftM2mLinks' in payload\n ) {\n return payload as DraftRelationCounts;\n }\n\n if (payload && typeof payload === 'object' && 'data' in payload) {\n return normalizeDraftRelationCounts((payload as { data: unknown }).data);\n }\n\n return EMPTY_DRAFT_RELATION_COUNTS;\n};\n\nexport const resolveDraftRelationCounts = (\n documentId: string | undefined,\n modified: boolean,\n localCounts: DraftRelationCounts,\n serverCounts: DraftRelationCounts\n): DraftRelationCounts => {\n if (!documentId) {\n return localCounts;\n }\n\n const hasUnsavedDraftRelations =\n localCounts.unpublishedRelations > 0 || localCounts.draftM2mLinks > 0;\n\n if (modified || hasUnsavedDraftRelations) {\n return mergeDraftRelationCounts(localCounts, serverCounts);\n }\n\n return serverCounts;\n};\n\nexport interface DraftRelationsPublishState {\n hasUnpublishedRelations: boolean;\n hasDraftM2mLinks: boolean;\n hasDraftRelations: boolean;\n isM2mOnlyDraftRelations: boolean;\n dialogVariant: 'default' | 'danger';\n bodyIcon: 'default' | 'danger';\n confirmLabel: 'publish' | 'publish-without-relations';\n}\n\nexport const getDraftRelationsPublishState = (\n counts: DraftRelationCounts\n): DraftRelationsPublishState => {\n const hasUnpublishedRelations = counts.unpublishedRelations > 0;\n const hasDraftM2mLinks = counts.draftM2mLinks > 0;\n const hasDraftRelations = hasUnpublishedRelations || hasDraftM2mLinks;\n const isM2mOnlyDraftRelations = hasDraftM2mLinks && !hasUnpublishedRelations;\n\n return {\n hasUnpublishedRelations,\n hasDraftM2mLinks,\n hasDraftRelations,\n isM2mOnlyDraftRelations,\n dialogVariant: isM2mOnlyDraftRelations ? 'default' : 'danger',\n bodyIcon: isM2mOnlyDraftRelations ? 'default' : 'danger',\n confirmLabel: isM2mOnlyDraftRelations ? 'publish' : 'publish-without-relations',\n };\n};\n\n/**\n * Counts draft relations in unsaved form values, excluding self-referential relations\n * (preserved on publish via document-service self-referential-relations).\n */\nexport const countLocalDraftRelations = (\n data: Record<string, unknown>,\n schema: Schema | Component | undefined,\n components: ComponentsDictionary,\n contentTypeUid: string\n): DraftRelationCounts => {\n if (!schema?.attributes) {\n return EMPTY_DRAFT_RELATION_COUNTS;\n }\n\n return Object.keys(schema.attributes).reduce((counts, attributeName) => {\n const attribute = schema.attributes[attributeName];\n const value = data[attributeName];\n\n if (!value) {\n return counts;\n }\n\n switch (attribute.type) {\n case 'relation': {\n if (!('target' in attribute) || attribute.target === contentTypeUid) {\n return counts;\n }\n\n if (typeof value === 'object' && value !== null && 'connect' in value) {\n const draftConnectCount =\n (value as RelationsFormValue).connect?.filter((relation) => relation.status === 'draft')\n .length ?? 0;\n\n if (draftConnectCount === 0) {\n return counts;\n }\n\n if (isBidirectionalManyToMany(attribute)) {\n return {\n ...counts,\n draftM2mLinks: counts.draftM2mLinks + draftConnectCount,\n };\n }\n\n return {\n ...counts,\n unpublishedRelations: counts.unpublishedRelations + draftConnectCount,\n };\n }\n\n return counts;\n }\n case 'component': {\n const componentItems = Array.isArray(value) ? value : [value];\n const componentSchema = components[attribute.component];\n\n return componentItems.reduce(\n (componentCounts, componentValue) =>\n mergeDraftRelationCounts(\n componentCounts,\n countLocalDraftRelations(\n componentValue as Record<string, unknown>,\n componentSchema,\n components,\n contentTypeUid\n )\n ),\n counts\n );\n }\n case 'dynamiczone': {\n return (value as Array<Record<string, unknown>>).reduce((zoneCounts, componentValue) => {\n const componentUid = componentValue.__component as string;\n\n return mergeDraftRelationCounts(\n zoneCounts,\n countLocalDraftRelations(\n componentValue,\n components[componentUid],\n components,\n contentTypeUid\n )\n );\n }, counts);\n }\n default:\n return counts;\n }\n }, EMPTY_DRAFT_RELATION_COUNTS);\n};\n"],"names":["EMPTY_DRAFT_RELATION_COUNTS","unpublishedRelations","draftM2mLinks","isBidirectionalManyToMany","attribute","type","relation","relationAttribute","Boolean","inversedBy","mappedBy","mergeDraftRelationCounts","left","right","normalizeDraftRelationCounts","payload","data","resolveDraftRelationCounts","documentId","modified","localCounts","serverCounts","hasUnsavedDraftRelations","getDraftRelationsPublishState","counts","hasUnpublishedRelations","hasDraftM2mLinks","hasDraftRelations","isM2mOnlyDraftRelations","dialogVariant","bodyIcon","confirmLabel","countLocalDraftRelations","schema","components","contentTypeUid","attributes","Object","keys","reduce","attributeName","value","target","draftConnectCount","connect","filter","status","length","componentItems","Array","isArray","componentSchema","component","componentCounts","componentValue","zoneCounts","componentUid","__component"],"mappings":"MASaA,2BAAAA,GAAmD;IAC9DC,oBAAAA,EAAsB,CAAA;IACtBC,aAAAA,EAAe;AACjB;AAEO,MAAMC,4BAA4B,CAACC,SAAAA,GAAAA;AACxC,IAAA,IAAIA,UAAUC,IAAI,KAAK,cAAcD,SAAAA,CAAUE,QAAQ,KAAK,YAAA,EAAc;QACxE,OAAO,KAAA;AACT,IAAA;AAEA,IAAA,MAAMC,iBAAAA,GAAoBH,SAAAA;AAQ1B,IAAA,OAAOI,OAAAA,CAAQD,iBAAAA,CAAkBE,UAAU,IAAIF,kBAAkBG,QAAQ,CAAA;AAC3E;AAEO,MAAMC,wBAAAA,GAA2B,CACtCC,IAAAA,EACAC,SACyB;AACzBZ,QAAAA,oBAAAA,EAAsBW,IAAAA,CAAKX,oBAAoB,GAAGY,KAAAA,CAAMZ,oBAAoB;AAC5EC,QAAAA,aAAAA,EAAeU,IAAAA,CAAKV,aAAa,GAAGW,KAAAA,CAAMX;AAC5C,KAAA;AAEO,MAAMY,+BAA+B,CAACC,OAAAA,GAAAA;AAC3C,IAAA,IAC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4BAAA,GAAGnB,MAAM;4BACTvB,oBAAAA,EAAsBuB,MAAAA,CAAOvB,oBAAoB,GAAG0C;AACtD,yBAAA;AACF,oBAAA;oBAEA,OAAOnB,MAAAA;AACT,gBAAA;YACA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAMwB,cAAAA,GAAiBC,KAAAA,CAAMC,OAAO,CAACT,SAASA,KAAAA,GAAQ;AAACA,wBAAAA;AAAM,qBAAA;AAC7D,oBAAA,MAAMU,eAAAA,GAAkBjB,UAAU,CAAC9B,SAAAA,CAAUgD,SAAS,CAAC;AAEvD,oBAAA,OAAOJ,cAAAA,CAAeT,MAAM,CAC1B,CAACc,eAAAA,EAAiBC,cAAAA,GAChB3C,wBAAAA,CACE0C,eAAAA,EACArB,wBAAAA,CACEsB,cAAAA,EACAH,eAAAA,EACAjB,UAAAA,EACAC,cAAAA,CAAAA,CAAAA,EAGNX,MAAAA,CAAAA;AAEJ,gBAAA;YACA,KAAK,aAAA;AAAe,gBAAA;AAClB,oBAAA,OAAO,KAACiB,CAAyCF,MAAM,CAAC,CAACgB,UAAAA,EAAYD,cAAAA,GAAAA;wBACnE,MAAME,YAAAA,GAAeF,eAAeG,WAAW;wBAE/C,OAAO9C,wBAAAA,CACL4C,YACAvB,wBAAAA,CACEsB,cAAAA,EACApB,UAAU,CAACsB,YAAAA,CAAa,EACxBtB,UAAAA,EACAC,cAAAA,CAAAA,CAAAA;oBAGN,CAAA,EAAGX,MAAAA,CAAAA;AACL,gBAAA;AACA,YAAA;gBACE,OAAOA,MAAAA;AACX;IACF,CAAA,EAAGxB,2BAAAA,CAAAA;AACL;;;;"}
1
+ {"version":3,"file":"draftRelationCounts.mjs","sources":["../../../../../admin/src/pages/EditView/utils/draftRelationCounts.ts"],"sourcesContent":["import type { Component } from '../../../../../shared/contracts/components';\nimport type { ComponentsDictionary, Schema } from '../../../hooks/useDocument';\nimport type { RelationsFormValue } from '../components/FormInputs/Relations/Relations';\n\nexport interface DraftRelationCounts {\n unpublishedRelations: number;\n draftM2mLinks: number;\n}\n\nexport const EMPTY_DRAFT_RELATION_COUNTS: DraftRelationCounts = {\n unpublishedRelations: 0,\n draftM2mLinks: 0,\n};\n\nexport const isBidirectionalManyToMany = (attribute: Schema['attributes'][string]) => {\n if (attribute.type !== 'relation' || attribute.relation !== 'manyToMany') {\n return false;\n }\n\n const relationAttribute = attribute as Extract<\n Schema['attributes'][string],\n { type: 'relation'; relation: 'manyToMany' }\n > & {\n inversedBy?: string;\n mappedBy?: string;\n };\n\n return Boolean(relationAttribute.inversedBy || relationAttribute.mappedBy);\n};\n\nexport const mergeDraftRelationCounts = (\n left: DraftRelationCounts,\n right: DraftRelationCounts\n): DraftRelationCounts => ({\n unpublishedRelations: left.unpublishedRelations + right.unpublishedRelations,\n draftM2mLinks: left.draftM2mLinks + right.draftM2mLinks,\n});\n\nexport const clampDraftRelationCounts = (counts: DraftRelationCounts): DraftRelationCounts => ({\n unpublishedRelations: Math.max(0, counts.unpublishedRelations),\n draftM2mLinks: Math.max(0, counts.draftM2mLinks),\n});\n\nexport const normalizeDraftRelationCounts = (payload: unknown): DraftRelationCounts => {\n if (\n payload &&\n typeof payload === 'object' &&\n 'unpublishedRelations' in payload &&\n 'draftM2mLinks' in payload\n ) {\n return payload as DraftRelationCounts;\n }\n\n if (payload && typeof payload === 'object' && 'data' in payload) {\n return normalizeDraftRelationCounts((payload as { data: unknown }).data);\n }\n\n return EMPTY_DRAFT_RELATION_COUNTS;\n};\n\nexport const resolveDraftRelationCounts = (\n documentId: string | undefined,\n modified: boolean,\n localCounts: DraftRelationCounts,\n serverCounts: DraftRelationCounts\n): DraftRelationCounts => {\n if (!documentId) {\n return clampDraftRelationCounts(localCounts);\n }\n\n const hasUnsavedDraftRelations =\n localCounts.unpublishedRelations > 0 || localCounts.draftM2mLinks > 0;\n\n if (modified || hasUnsavedDraftRelations) {\n return clampDraftRelationCounts(mergeDraftRelationCounts(localCounts, serverCounts));\n }\n\n return serverCounts;\n};\n\nexport interface DraftRelationsPublishState {\n hasUnpublishedRelations: boolean;\n hasDraftM2mLinks: boolean;\n hasDraftRelations: boolean;\n isM2mOnlyDraftRelations: boolean;\n dialogVariant: 'default' | 'danger';\n bodyIcon: 'default' | 'danger';\n confirmLabel: 'publish' | 'publish-without-relations';\n}\n\nexport const getDraftRelationsPublishState = (\n counts: DraftRelationCounts\n): DraftRelationsPublishState => {\n const hasUnpublishedRelations = counts.unpublishedRelations > 0;\n const hasDraftM2mLinks = counts.draftM2mLinks > 0;\n const hasDraftRelations = hasUnpublishedRelations || hasDraftM2mLinks;\n const isM2mOnlyDraftRelations = hasDraftM2mLinks && !hasUnpublishedRelations;\n\n return {\n hasUnpublishedRelations,\n hasDraftM2mLinks,\n hasDraftRelations,\n isM2mOnlyDraftRelations,\n dialogVariant: isM2mOnlyDraftRelations ? 'default' : 'danger',\n bodyIcon: isM2mOnlyDraftRelations ? 'default' : 'danger',\n confirmLabel: isM2mOnlyDraftRelations ? 'publish' : 'publish-without-relations',\n };\n};\n\n/**\n * Counts draft relations in unsaved form values, excluding self-referential relations\n * (preserved on publish via document-service self-referential-relations).\n */\nexport const countLocalDraftRelations = (\n data: Record<string, unknown>,\n schema: Schema | Component | undefined,\n components: ComponentsDictionary,\n contentTypeUid: string\n): DraftRelationCounts => {\n if (!schema?.attributes) {\n return EMPTY_DRAFT_RELATION_COUNTS;\n }\n\n return Object.keys(schema.attributes).reduce((counts, attributeName) => {\n const attribute = schema.attributes[attributeName];\n const value = data[attributeName];\n\n if (!value) {\n return counts;\n }\n\n switch (attribute.type) {\n case 'relation': {\n if (!('target' in attribute) || attribute.target === contentTypeUid) {\n return counts;\n }\n\n if (\n typeof value === 'object' &&\n value !== null &&\n ('connect' in value || 'disconnect' in value)\n ) {\n const formValue = value as RelationsFormValue;\n const draftConnectCount =\n formValue.connect?.filter((relation) => relation.status === 'draft').length ?? 0;\n const draftDisconnectCount =\n formValue.disconnect?.filter((relation) => relation.status === 'draft').length ?? 0;\n\n if (draftConnectCount === 0 && draftDisconnectCount === 0) {\n return counts;\n }\n\n if (isBidirectionalManyToMany(attribute)) {\n return {\n ...counts,\n draftM2mLinks: counts.draftM2mLinks + draftConnectCount - draftDisconnectCount,\n };\n }\n\n return {\n ...counts,\n unpublishedRelations:\n counts.unpublishedRelations + draftConnectCount - draftDisconnectCount,\n };\n }\n\n return counts;\n }\n case 'component': {\n const componentItems = Array.isArray(value) ? value : [value];\n const componentSchema = components[attribute.component];\n\n return componentItems.reduce(\n (componentCounts, componentValue) =>\n mergeDraftRelationCounts(\n componentCounts,\n countLocalDraftRelations(\n componentValue as Record<string, unknown>,\n componentSchema,\n components,\n contentTypeUid\n )\n ),\n counts\n );\n }\n case 'dynamiczone': {\n return (value as Array<Record<string, unknown>>).reduce((zoneCounts, componentValue) => {\n const componentUid = componentValue.__component as string;\n\n return mergeDraftRelationCounts(\n zoneCounts,\n countLocalDraftRelations(\n componentValue,\n components[componentUid],\n components,\n contentTypeUid\n )\n );\n }, counts);\n }\n default:\n return counts;\n }\n }, EMPTY_DRAFT_RELATION_COUNTS);\n};\n"],"names":["EMPTY_DRAFT_RELATION_COUNTS","unpublishedRelations","draftM2mLinks","isBidirectionalManyToMany","attribute","type","relation","relationAttribute","Boolean","inversedBy","mappedBy","mergeDraftRelationCounts","left","right","clampDraftRelationCounts","counts","Math","max","normalizeDraftRelationCounts","payload","data","resolveDraftRelationCounts","documentId","modified","localCounts","serverCounts","hasUnsavedDraftRelations","getDraftRelationsPublishState","hasUnpublishedRelations","hasDraftM2mLinks","hasDraftRelations","isM2mOnlyDraftRelations","dialogVariant","bodyIcon","confirmLabel","countLocalDraftRelations","schema","components","contentTypeUid","attributes","Object","keys","reduce","attributeName","value","target","formValue","draftConnectCount","connect","filter","status","length","draftDisconnectCount","disconnect","componentItems","Array","isArray","componentSchema","component","componentCounts","componentValue","zoneCounts","componentUid","__component"],"mappings":"MASaA,2BAAAA,GAAmD;IAC9DC,oBAAAA,EAAsB,CAAA;IACtBC,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,iBAAAA,GAAoBK;AACtD,yBAAA;AACF,oBAAA;oBAEA,OAAOrC,MAAAA;AACT,gBAAA;YACA,KAAK,WAAA;AAAa,gBAAA;AAChB,oBAAA,MAAMuC,cAAAA,GAAiBC,KAAAA,CAAMC,OAAO,CAACZ,SAASA,KAAAA,GAAQ;AAACA,wBAAAA;AAAM,qBAAA;AAC7D,oBAAA,MAAMa,eAAAA,GAAkBpB,UAAU,CAACjC,SAAAA,CAAUsD,SAAS,CAAC;AAEvD,oBAAA,OAAOJ,cAAAA,CAAeZ,MAAM,CAC1B,CAACiB,eAAAA,EAAiBC,cAAAA,GAChBjD,wBAAAA,CACEgD,eAAAA,EACAxB,wBAAAA,CACEyB,cAAAA,EACAH,eAAAA,EACApB,UAAAA,EACAC,cAAAA,CAAAA,CAAAA,EAGNvB,MAAAA,CAAAA;AAEJ,gBAAA;YACA,KAAK,aAAA;AAAe,gBAAA;AAClB,oBAAA,OAAO,KAAC6B,CAAyCF,MAAM,CAAC,CAACmB,UAAAA,EAAYD,cAAAA,GAAAA;wBACnE,MAAME,YAAAA,GAAeF,eAAeG,WAAW;wBAE/C,OAAOpD,wBAAAA,CACLkD,YACA1B,wBAAAA,CACEyB,cAAAA,EACAvB,UAAU,CAACyB,YAAAA,CAAa,EACxBzB,UAAAA,EACAC,cAAAA,CAAAA,CAAAA;oBAGN,CAAA,EAAGvB,MAAAA,CAAAA;AACL,gBAAA;AACA,YAAA;gBACE,OAAOA,MAAAA;AACX;IACF,CAAA,EAAGf,2BAAAA,CAAAA;AACL;;;;"}
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
- require('react');
4
+ var React = require('react');
5
5
  var strapiAdmin = require('@strapi/admin/strapi-admin');
6
6
  var designSystem = require('@strapi/design-system');
7
7
  var qs = require('qs');
@@ -9,14 +9,37 @@ var reactIntl = require('react-intl');
9
9
  var reactRouterDom = require('react-router-dom');
10
10
  var preview = require('../services/preview.js');
11
11
 
12
- const ConditionalTooltip = ({ isShown, label, children })=>{
13
- if (isShown) {
14
- return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
15
- label: label,
16
- children: children
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
17
22
  });
18
- }
19
- return children;
23
+ }
24
+ });
25
+ }
26
+ n.default = e;
27
+ return Object.freeze(n);
28
+ }
29
+
30
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
31
+
32
+ /**
33
+ * Always keeps the Tooltip (and therefore the children subtree) mounted: conditionally wrapping
34
+ * would remount the child button whenever `isShown` flips, and a click landing during that swap
35
+ * is silently lost. When the tooltip must not show, it is force-closed via the controlled `open`
36
+ * prop instead of being removed from the tree.
37
+ */ const ConditionalTooltip = ({ isShown, label, children })=>{
38
+ return /*#__PURE__*/ jsxRuntime.jsx(designSystem.Tooltip, {
39
+ label: label,
40
+ open: isShown ? undefined : false,
41
+ children: children
42
+ });
20
43
  };
21
44
  const PreviewSidePanel = ({ model, documentId, document })=>{
22
45
  const { formatMessage } = reactIntl.useIntl();
@@ -46,6 +69,20 @@ const PreviewSidePanel = ({ model, documentId, document })=>{
46
69
  {
47
70
  skip: isUnsaved
48
71
  });
72
+ /**
73
+ * The query args above change while the document settles (locale/status resolve after load and
74
+ * on save/publish), and each change is a new cache entry with transiently empty data. Latch
75
+ * enablement once a URL has been seen so the "Open preview" button doesn't unmount and remount
76
+ * mid-interaction — a click landing during such a swap is silently lost.
77
+ */ const [isPreviewEnabled, setIsPreviewEnabled] = React__namespace.useState(false);
78
+ const previewUrl = data?.data?.url;
79
+ React__namespace.useEffect(()=>{
80
+ if (previewUrl) {
81
+ setIsPreviewEnabled(true);
82
+ }
83
+ }, [
84
+ previewUrl
85
+ ]);
49
86
  if (isUnsaved) {
50
87
  return null;
51
88
  }
@@ -68,7 +105,7 @@ const PreviewSidePanel = ({ model, documentId, document })=>{
68
105
  })
69
106
  };
70
107
  }
71
- if (!data?.data?.url || error) {
108
+ if (!isPreviewEnabled && (!data?.data?.url || error)) {
72
109
  return null;
73
110
  }
74
111
  const trackNavigation = ()=>{
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewSidePanel.js","sources":["../../../../admin/src/preview/components/PreviewSidePanel.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams, useTracking, useForm } from '@strapi/admin/strapi-admin';\nimport { Box, Button, Tooltip, type TooltipProps } from '@strapi/design-system';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { Link, useLocation } from 'react-router-dom';\n\nimport { useGetPreviewUrlQuery } from '../services/preview';\n\nimport type { PanelComponent } from '@strapi/content-manager/strapi-admin';\nimport type { UID } from '@strapi/types';\n\ninterface ConditionalTooltipProps {\n isShown: boolean;\n label: TooltipProps['label'];\n children: React.ReactNode;\n}\n\nconst ConditionalTooltip = ({ isShown, label, children }: ConditionalTooltipProps) => {\n if (isShown) {\n return <Tooltip label={label}>{children}</Tooltip>;\n }\n\n return children;\n};\n\nconst PreviewSidePanel: PanelComponent = ({ model, documentId, document }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const { pathname } = useLocation();\n const [{ query }] = useQueryParams();\n const isModified = useForm('PreviewSidePanel', (state) => state.modified);\n const isUnsaved = Boolean(!document || !document.id);\n\n const title = formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n });\n\n /**\n * The preview URL isn't used in this component, we just fetch it to know if preview is enabled\n * for the content type. If it's not, the panel is not displayed. If it is, we display a link to\n * /preview, and the URL will already be loaded in the RTK query cache.\n */\n const { data, error } = useGetPreviewUrlQuery(\n {\n params: {\n contentType: model as UID.ContentType,\n },\n query: {\n documentId,\n locale: document?.locale,\n status: document?.status,\n },\n },\n // Don't bother making the request since we won't show any UI\n { skip: isUnsaved }\n );\n\n if (isUnsaved) {\n return null;\n }\n\n // Preview was not configured but not disabled either (otherwise it would be a success 204).\n // So we encourage the user to set it up.\n if (error && error.name === 'NotFoundError') {\n return {\n title,\n content: (\n <Button\n variant=\"tertiary\"\n tag={Link}\n to=\"https://docs.strapi.io/cms/features/preview\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n width=\"100%\"\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button-configuration',\n defaultMessage: 'Set up preview',\n })}\n </Button>\n ),\n };\n }\n\n if (!data?.data?.url || error) {\n return null;\n }\n\n const trackNavigation = () => {\n // Append /preview to the current URL\n const destinationPathname = pathname.replace(/\\/$/, '') + '/preview';\n trackUsage('willNavigate', { from: pathname, to: destinationPathname });\n };\n\n return {\n title,\n content: (\n <ConditionalTooltip\n label={formatMessage({\n id: 'content-manager.preview.panel.button-disabled-tooltip',\n defaultMessage: 'Please save to open the preview',\n })}\n isShown={isModified}\n >\n <Box cursor=\"not-allowed\" width=\"100%\">\n <Button\n variant=\"tertiary\"\n tag={Link}\n to={{ pathname: 'preview', search: stringify(query, { encode: false }) }}\n onClick={trackNavigation}\n width=\"100%\"\n disabled={isModified}\n pointerEvents={isModified ? 'none' : undefined}\n tabIndex={isModified ? -1 : undefined}\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button',\n defaultMessage: 'Open preview',\n })}\n </Button>\n </Box>\n </ConditionalTooltip>\n ),\n };\n};\n\nexport { PreviewSidePanel };\n"],"names":["ConditionalTooltip","isShown","label","children","_jsx","Tooltip","PreviewSidePanel","model","documentId","document","formatMessage","useIntl","trackUsage","useTracking","pathname","useLocation","query","useQueryParams","isModified","useForm","state","modified","isUnsaved","Boolean","id","title","defaultMessage","data","error","useGetPreviewUrlQuery","params","contentType","locale","status","skip","name","content","Button","variant","tag","Link","to","target","rel","width","url","trackNavigation","destinationPathname","replace","from","Box","cursor","search","stringify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IC,MAAAA,EAAO,aAAA;gBAAcP,KAAAA,EAAM,MAAA;AAC9B,gBAAA,QAAA,gBAAAxC,cAAA,CAACiC,mBAAAA,EAAAA;oBACCC,OAAAA,EAAQ,UAAA;oBACRC,GAAAA,EAAKC,mBAAAA;oBACLC,EAAAA,EAAI;wBAAE3B,QAAAA,EAAU,SAAA;AAAWsC,wBAAAA,MAAAA,EAAQC,aAAUrC,KAAAA,EAAO;4BAAEsC,MAAAA,EAAQ;AAAM,yBAAA;AAAG,qBAAA;oBACvEC,OAAAA,EAAST,eAAAA;oBACTF,KAAAA,EAAM,MAAA;oBACNY,QAAAA,EAAUtC,UAAAA;AACVuC,oBAAAA,aAAAA,EAAevC,aAAa,MAAA,GAASwC,SAAAA;oBACrCC,QAAAA,EAAUzC,UAAAA,GAAa,EAAC,GAAIwC,SAAAA;8BAE3BhD,aAAAA,CAAc;wBACbc,EAAAA,EAAI,sCAAA;wBACJE,cAAAA,EAAgB;AAClB,qBAAA;;;;AAKV,KAAA;AACF;;;;"}
1
+ {"version":3,"file":"PreviewSidePanel.js","sources":["../../../../admin/src/preview/components/PreviewSidePanel.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams, useTracking, useForm } from '@strapi/admin/strapi-admin';\nimport { Box, Button, Tooltip, type TooltipProps } from '@strapi/design-system';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { Link, useLocation } from 'react-router-dom';\n\nimport { useGetPreviewUrlQuery } from '../services/preview';\n\nimport type { PanelComponent } from '@strapi/content-manager/strapi-admin';\nimport type { UID } from '@strapi/types';\n\ninterface ConditionalTooltipProps {\n isShown: boolean;\n label: TooltipProps['label'];\n children: React.ReactNode;\n}\n\n/**\n * Always keeps the Tooltip (and therefore the children subtree) mounted: conditionally wrapping\n * would remount the child button whenever `isShown` flips, and a click landing during that swap\n * is silently lost. When the tooltip must not show, it is force-closed via the controlled `open`\n * prop instead of being removed from the tree.\n */\nconst ConditionalTooltip = ({ isShown, label, children }: ConditionalTooltipProps) => {\n return (\n <Tooltip label={label} open={isShown ? undefined : false}>\n {children}\n </Tooltip>\n );\n};\n\nconst PreviewSidePanel: PanelComponent = ({ model, documentId, document }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const { pathname } = useLocation();\n const [{ query }] = useQueryParams();\n const isModified = useForm('PreviewSidePanel', (state) => state.modified);\n const isUnsaved = Boolean(!document || !document.id);\n\n const title = formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n });\n\n /**\n * The preview URL isn't used in this component, we just fetch it to know if preview is enabled\n * for the content type. If it's not, the panel is not displayed. If it is, we display a link to\n * /preview, and the URL will already be loaded in the RTK query cache.\n */\n const { data, error } = useGetPreviewUrlQuery(\n {\n params: {\n contentType: model as UID.ContentType,\n },\n query: {\n documentId,\n locale: document?.locale,\n status: document?.status,\n },\n },\n // Don't bother making the request since we won't show any UI\n { skip: isUnsaved }\n );\n\n /**\n * The query args above change while the document settles (locale/status resolve after load and\n * on save/publish), and each change is a new cache entry with transiently empty data. Latch\n * enablement once a URL has been seen so the \"Open preview\" button doesn't unmount and remount\n * mid-interaction — a click landing during such a swap is silently lost.\n */\n const [isPreviewEnabled, setIsPreviewEnabled] = React.useState(false);\n const previewUrl = data?.data?.url;\n React.useEffect(() => {\n if (previewUrl) {\n setIsPreviewEnabled(true);\n }\n }, [previewUrl]);\n\n if (isUnsaved) {\n return null;\n }\n\n // Preview was not configured but not disabled either (otherwise it would be a success 204).\n // So we encourage the user to set it up.\n if (error && error.name === 'NotFoundError') {\n return {\n title,\n content: (\n <Button\n variant=\"tertiary\"\n tag={Link}\n to=\"https://docs.strapi.io/cms/features/preview\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n width=\"100%\"\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button-configuration',\n defaultMessage: 'Set up preview',\n })}\n </Button>\n ),\n };\n }\n\n if (!isPreviewEnabled && (!data?.data?.url || error)) {\n return null;\n }\n\n const trackNavigation = () => {\n // Append /preview to the current URL\n const destinationPathname = pathname.replace(/\\/$/, '') + '/preview';\n trackUsage('willNavigate', { from: pathname, to: destinationPathname });\n };\n\n return {\n title,\n content: (\n <ConditionalTooltip\n label={formatMessage({\n id: 'content-manager.preview.panel.button-disabled-tooltip',\n defaultMessage: 'Please save to open the preview',\n })}\n isShown={isModified}\n >\n <Box cursor=\"not-allowed\" width=\"100%\">\n <Button\n variant=\"tertiary\"\n tag={Link}\n to={{ pathname: 'preview', search: stringify(query, { encode: false }) }}\n onClick={trackNavigation}\n width=\"100%\"\n disabled={isModified}\n pointerEvents={isModified ? 'none' : undefined}\n tabIndex={isModified ? -1 : undefined}\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button',\n defaultMessage: 'Open preview',\n })}\n </Button>\n </Box>\n </ConditionalTooltip>\n ),\n };\n};\n\nexport { PreviewSidePanel };\n"],"names":["ConditionalTooltip","isShown","label","children","_jsx","Tooltip","open","undefined","PreviewSidePanel","model","documentId","document","formatMessage","useIntl","trackUsage","useTracking","pathname","useLocation","query","useQueryParams","isModified","useForm","state","modified","isUnsaved","Boolean","id","title","defaultMessage","data","error","useGetPreviewUrlQuery","params","contentType","locale","status","skip","isPreviewEnabled","setIsPreviewEnabled","React","useState","previewUrl","url","useEffect","name","content","Button","variant","tag","Link","to","target","rel","width","trackNavigation","destinationPathname","replace","from","Box","cursor","search","stringify","encode","onClick","disabled","pointerEvents","tabIndex"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBA;;;;;IAMA,MAAMA,qBAAqB,CAAC,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAA2B,GAAA;AAC/E,IAAA,qBACEC,cAAA,CAACC,oBAAAA,EAAAA;QAAQH,KAAAA,EAAOA,KAAAA;AAAOI,QAAAA,IAAAA,EAAML,UAAUM,SAAAA,GAAY,KAAA;AAChDJ,QAAAA,QAAAA,EAAAA;;AAGP,CAAA;AAEA,MAAMK,gBAAAA,GAA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AAAA,EAAO,aAAA;gBAAcN,KAAAA,EAAM,MAAA;AAC9B,gBAAA,QAAA,gBAAAjD,cAAA,CAAC0C,mBAAAA,EAAAA;oBACCC,OAAAA,EAAQ,UAAA;oBACRC,GAAAA,EAAKC,mBAAAA;oBACLC,EAAAA,EAAI;wBAAElC,QAAAA,EAAU,SAAA;AAAW4C,wBAAAA,MAAAA,EAAQC,aAAU3C,KAAAA,EAAO;4BAAE4C,MAAAA,EAAQ;AAAM,yBAAA;AAAG,qBAAA;oBACvEC,OAAAA,EAAST,eAAAA;oBACTD,KAAAA,EAAM,MAAA;oBACNW,QAAAA,EAAU5C,UAAAA;AACV6C,oBAAAA,aAAAA,EAAe7C,aAAa,MAAA,GAASb,SAAAA;oBACrC2D,QAAAA,EAAU9C,UAAAA,GAAa,EAAC,GAAIb,SAAAA;8BAE3BK,aAAAA,CAAc;wBACbc,EAAAA,EAAI,sCAAA;wBACJE,cAAAA,EAAgB;AAClB,qBAAA;;;;AAKV,KAAA;AACF;;;;"}
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import 'react';
2
+ import * as React from 'react';
3
3
  import { useTracking, useQueryParams, useForm } from '@strapi/admin/strapi-admin';
4
4
  import { Button, Box, Tooltip } from '@strapi/design-system';
5
5
  import { stringify } from 'qs';
@@ -7,14 +7,17 @@ import { useIntl } from 'react-intl';
7
7
  import { useLocation, Link } from 'react-router-dom';
8
8
  import { useGetPreviewUrlQuery } from '../services/preview.mjs';
9
9
 
10
- const ConditionalTooltip = ({ isShown, label, children })=>{
11
- if (isShown) {
12
- return /*#__PURE__*/ jsx(Tooltip, {
13
- label: label,
14
- children: children
15
- });
16
- }
17
- return children;
10
+ /**
11
+ * Always keeps the Tooltip (and therefore the children subtree) mounted: conditionally wrapping
12
+ * would remount the child button whenever `isShown` flips, and a click landing during that swap
13
+ * is silently lost. When the tooltip must not show, it is force-closed via the controlled `open`
14
+ * prop instead of being removed from the tree.
15
+ */ const ConditionalTooltip = ({ isShown, label, children })=>{
16
+ return /*#__PURE__*/ jsx(Tooltip, {
17
+ label: label,
18
+ open: isShown ? undefined : false,
19
+ children: children
20
+ });
18
21
  };
19
22
  const PreviewSidePanel = ({ model, documentId, document })=>{
20
23
  const { formatMessage } = useIntl();
@@ -44,6 +47,20 @@ const PreviewSidePanel = ({ model, documentId, document })=>{
44
47
  {
45
48
  skip: isUnsaved
46
49
  });
50
+ /**
51
+ * The query args above change while the document settles (locale/status resolve after load and
52
+ * on save/publish), and each change is a new cache entry with transiently empty data. Latch
53
+ * enablement once a URL has been seen so the "Open preview" button doesn't unmount and remount
54
+ * mid-interaction — a click landing during such a swap is silently lost.
55
+ */ const [isPreviewEnabled, setIsPreviewEnabled] = React.useState(false);
56
+ const previewUrl = data?.data?.url;
57
+ React.useEffect(()=>{
58
+ if (previewUrl) {
59
+ setIsPreviewEnabled(true);
60
+ }
61
+ }, [
62
+ previewUrl
63
+ ]);
47
64
  if (isUnsaved) {
48
65
  return null;
49
66
  }
@@ -66,7 +83,7 @@ const PreviewSidePanel = ({ model, documentId, document })=>{
66
83
  })
67
84
  };
68
85
  }
69
- if (!data?.data?.url || error) {
86
+ if (!isPreviewEnabled && (!data?.data?.url || error)) {
70
87
  return null;
71
88
  }
72
89
  const trackNavigation = ()=>{
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewSidePanel.mjs","sources":["../../../../admin/src/preview/components/PreviewSidePanel.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams, useTracking, useForm } from '@strapi/admin/strapi-admin';\nimport { Box, Button, Tooltip, type TooltipProps } from '@strapi/design-system';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { Link, useLocation } from 'react-router-dom';\n\nimport { useGetPreviewUrlQuery } from '../services/preview';\n\nimport type { PanelComponent } from '@strapi/content-manager/strapi-admin';\nimport type { UID } from '@strapi/types';\n\ninterface ConditionalTooltipProps {\n isShown: boolean;\n label: TooltipProps['label'];\n children: React.ReactNode;\n}\n\nconst ConditionalTooltip = ({ isShown, label, children }: ConditionalTooltipProps) => {\n if (isShown) {\n return <Tooltip label={label}>{children}</Tooltip>;\n }\n\n return children;\n};\n\nconst PreviewSidePanel: PanelComponent = ({ model, documentId, document }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const { pathname } = useLocation();\n const [{ query }] = useQueryParams();\n const isModified = useForm('PreviewSidePanel', (state) => state.modified);\n const isUnsaved = Boolean(!document || !document.id);\n\n const title = formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n });\n\n /**\n * The preview URL isn't used in this component, we just fetch it to know if preview is enabled\n * for the content type. If it's not, the panel is not displayed. If it is, we display a link to\n * /preview, and the URL will already be loaded in the RTK query cache.\n */\n const { data, error } = useGetPreviewUrlQuery(\n {\n params: {\n contentType: model as UID.ContentType,\n },\n query: {\n documentId,\n locale: document?.locale,\n status: document?.status,\n },\n },\n // Don't bother making the request since we won't show any UI\n { skip: isUnsaved }\n );\n\n if (isUnsaved) {\n return null;\n }\n\n // Preview was not configured but not disabled either (otherwise it would be a success 204).\n // So we encourage the user to set it up.\n if (error && error.name === 'NotFoundError') {\n return {\n title,\n content: (\n <Button\n variant=\"tertiary\"\n tag={Link}\n to=\"https://docs.strapi.io/cms/features/preview\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n width=\"100%\"\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button-configuration',\n defaultMessage: 'Set up preview',\n })}\n </Button>\n ),\n };\n }\n\n if (!data?.data?.url || error) {\n return null;\n }\n\n const trackNavigation = () => {\n // Append /preview to the current URL\n const destinationPathname = pathname.replace(/\\/$/, '') + '/preview';\n trackUsage('willNavigate', { from: pathname, to: destinationPathname });\n };\n\n return {\n title,\n content: (\n <ConditionalTooltip\n label={formatMessage({\n id: 'content-manager.preview.panel.button-disabled-tooltip',\n defaultMessage: 'Please save to open the preview',\n })}\n isShown={isModified}\n >\n <Box cursor=\"not-allowed\" width=\"100%\">\n <Button\n variant=\"tertiary\"\n tag={Link}\n to={{ pathname: 'preview', search: stringify(query, { encode: false }) }}\n onClick={trackNavigation}\n width=\"100%\"\n disabled={isModified}\n pointerEvents={isModified ? 'none' : undefined}\n tabIndex={isModified ? -1 : undefined}\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button',\n defaultMessage: 'Open preview',\n })}\n </Button>\n </Box>\n </ConditionalTooltip>\n ),\n };\n};\n\nexport { PreviewSidePanel };\n"],"names":["ConditionalTooltip","isShown","label","children","_jsx","Tooltip","PreviewSidePanel","model","documentId","document","formatMessage","useIntl","trackUsage","useTracking","pathname","useLocation","query","useQueryParams","isModified","useForm","state","modified","isUnsaved","Boolean","id","title","defaultMessage","data","error","useGetPreviewUrlQuery","params","contentType","locale","status","skip","name","content","Button","variant","tag","Link","to","target","rel","width","url","trackNavigation","destinationPathname","replace","from","Box","cursor","search","stringify","encode","onClick","disabled","pointerEvents","undefined","tabIndex"],"mappings":";;;;;;;;;AAmBA,MAAMA,kBAAAA,GAAqB,CAAC,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAA2B,GAAA;AAC/E,IAAA,IAAIF,OAAAA,EAAS;AACX,QAAA,qBAAOG,GAAA,CAACC,OAAAA,EAAAA;YAAQH,KAAAA,EAAOA,KAAAA;AAAQC,YAAAA,QAAAA,EAAAA;;AACjC,IAAA;IAEA,OAAOA,QAAAA;AACT,CAAA;AAEA,MAAMG,gBAAAA,GAAmC,CAAC,EAAEC,KAAK,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAA;IACvE,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAAA,EAAAA;IACvB,MAAM,EAAEC,QAAQ,EAAE,GAAGC,WAAAA,EAAAA;AACrB,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,CAAC,GAAGC,cAAAA,EAAAA;AACpB,IAAA,MAAMC,aAAaC,OAAAA,CA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idePanel.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams, useTracking, useForm } from '@strapi/admin/strapi-admin';\nimport { Box, Button, Tooltip, type TooltipProps } from '@strapi/design-system';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { Link, useLocation } from 'react-router-dom';\n\nimport { useGetPreviewUrlQuery } from '../services/preview';\n\nimport type { PanelComponent } from '@strapi/content-manager/strapi-admin';\nimport type { UID } from '@strapi/types';\n\ninterface ConditionalTooltipProps {\n isShown: boolean;\n label: TooltipProps['label'];\n children: React.ReactNode;\n}\n\n/**\n * Always keeps the Tooltip (and therefore the children subtree) mounted: conditionally wrapping\n * would remount the child button whenever `isShown` flips, and a click landing during that swap\n * is silently lost. When the tooltip must not show, it is force-closed via the controlled `open`\n * prop instead of being removed from the tree.\n */\nconst ConditionalTooltip = ({ isShown, label, children }: ConditionalTooltipProps) => {\n return (\n <Tooltip label={label} open={isShown ? undefined : false}>\n {children}\n </Tooltip>\n );\n};\n\nconst PreviewSidePanel: PanelComponent = ({ model, documentId, document }) => {\n const { formatMessage } = useIntl();\n const { trackUsage } = useTracking();\n const { pathname } = useLocation();\n const [{ query }] = useQueryParams();\n const isModified = useForm('PreviewSidePanel', (state) => state.modified);\n const isUnsaved = Boolean(!document || !document.id);\n\n const title = formatMessage({\n id: 'content-manager.preview.panel.title',\n defaultMessage: 'Preview',\n });\n\n /**\n * The preview URL isn't used in this component, we just fetch it to know if preview is enabled\n * for the content type. If it's not, the panel is not displayed. If it is, we display a link to\n * /preview, and the URL will already be loaded in the RTK query cache.\n */\n const { data, error } = useGetPreviewUrlQuery(\n {\n params: {\n contentType: model as UID.ContentType,\n },\n query: {\n documentId,\n locale: document?.locale,\n status: document?.status,\n },\n },\n // Don't bother making the request since we won't show any UI\n { skip: isUnsaved }\n );\n\n /**\n * The query args above change while the document settles (locale/status resolve after load and\n * on save/publish), and each change is a new cache entry with transiently empty data. Latch\n * enablement once a URL has been seen so the \"Open preview\" button doesn't unmount and remount\n * mid-interaction — a click landing during such a swap is silently lost.\n */\n const [isPreviewEnabled, setIsPreviewEnabled] = React.useState(false);\n const previewUrl = data?.data?.url;\n React.useEffect(() => {\n if (previewUrl) {\n setIsPreviewEnabled(true);\n }\n }, [previewUrl]);\n\n if (isUnsaved) {\n return null;\n }\n\n // Preview was not configured but not disabled either (otherwise it would be a success 204).\n // So we encourage the user to set it up.\n if (error && error.name === 'NotFoundError') {\n return {\n title,\n content: (\n <Button\n variant=\"tertiary\"\n tag={Link}\n to=\"https://docs.strapi.io/cms/features/preview\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n width=\"100%\"\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button-configuration',\n defaultMessage: 'Set up preview',\n })}\n </Button>\n ),\n };\n }\n\n if (!isPreviewEnabled && (!data?.data?.url || error)) {\n return null;\n }\n\n const trackNavigation = () => {\n // Append /preview to the current URL\n const destinationPathname = pathname.replace(/\\/$/, '') + '/preview';\n trackUsage('willNavigate', { from: pathname, to: destinationPathname });\n };\n\n return {\n title,\n content: (\n <ConditionalTooltip\n label={formatMessage({\n id: 'content-manager.preview.panel.button-disabled-tooltip',\n defaultMessage: 'Please save to open the preview',\n })}\n isShown={isModified}\n >\n <Box cursor=\"not-allowed\" width=\"100%\">\n <Button\n variant=\"tertiary\"\n tag={Link}\n to={{ pathname: 'preview', search: stringify(query, { encode: false }) }}\n onClick={trackNavigation}\n width=\"100%\"\n disabled={isModified}\n pointerEvents={isModified ? 'none' : undefined}\n tabIndex={isModified ? -1 : undefined}\n >\n {formatMessage({\n id: 'content-manager.preview.panel.button',\n defaultMessage: 'Open preview',\n })}\n </Button>\n </Box>\n </ConditionalTooltip>\n ),\n };\n};\n\nexport { PreviewSidePanel };\n"],"names":["ConditionalTooltip","isShown","label","children","_jsx","Tooltip","open","undefined","PreviewSidePanel","model","documentId","document","formatMessage","useIntl","trackUsage","useTracking","pathname","useLocation","query","useQueryParams","isModified","useForm","state","modified","isUnsaved","Boolean","id","title","defaultMessage","data","error","useGetPreviewUrlQuery","params","contentType","locale","status","skip","isPreviewEnabled","setIsPreviewEnabled","React","useState","previewUrl","url","useEffect","name","content","Button","variant","tag","Link","to","target","rel","width","trackNavigation","destinationPathname","replace","from","Box","cursor","search","stringify","encode","onClick","disabled","pointerEvents","tabIndex"],"mappings":";;;;;;;;;AAmBA;;;;;IAMA,MAAMA,qBAAqB,CAAC,EAAEC,OAAO,EAAEC,KAAK,EAAEC,QAAQ,EAA2B,GAAA;AAC/E,IAAA,qBACEC,GAAA,CAACC,OAAAA,EAAAA;QAAQH,KAAAA,EAAOA,KAAAA;AAAOI,QAAAA,IAAAA,EAAML,UAAUM,SAAAA,GAAY,KAAA;AAChDJ,QAAAA,QAAAA,EAAAA;;AAGP,CAAA;AAEA,MAAMK,gBAAAA,GAAmC,CAAC,EAAEC,KAAK,EAAEC,UAAU,EAAEC,QAAQ,EAAE,GAAA;IACvE,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;IAC1B,MAAM,EAAEC,UAAU,EAAE,GAAGC,WAAAA,EAAAA;IACvB,MAAM,EAAEC,QAAQ,EAAE,GAAGC,WAAAA,EAAAA;AACrB,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,CAAC,GAAGC,cAAAA,EAAAA;AACpB,IAAA,MAAMC,aAAaC,OAAAA,CAAQ,kBAAA,EAAoB,CAACC,KAAAA,GAAUA,MAAMC,QAAQ,CAAA;AACxE,IAAA,MAAMC,YAAYC,OAAAA,CAAQ,CAACd,QAAAA,IAAY,CAACA,SAASe,EAAE,CAAA;AAEnD,IAAA,MAAMC,QAAQf,aAAAA,CAAc;QAC1Bc,EAAAA,EAAI,qCAAA;QACJE,cAAAA,EAAgB;AAClB,KAAA,CAAA;AAEA;;;;AAIC,MACD,MAAM,EAAEC,IAAI,EAAEC,KAAK,EAAE,GAAGC,qBAAAA,CACtB;QACEC,MAAAA,EAAQ;YACNC,WAAAA,EAAaxB;AACf,SAAA;QACA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admin';
3
3
  declare const _default: {
4
4
  register(app: StrapiApp): void;
5
5
  bootstrap(app: StrapiApp): void;
@@ -5,10 +5,18 @@ import { type EditFieldLayout } from '../../../../../hooks/useDocumentLayout';
5
5
  import { RelationResult } from '../../../../../services/relations';
6
6
  type RelationPosition = (Pick<RelationResult, 'status' | 'locale'> & {
7
7
  before: string;
8
+ start?: never;
8
9
  end?: never;
9
10
  }) | {
11
+ start: boolean;
12
+ before?: never;
13
+ end?: never;
14
+ status?: never;
15
+ locale?: never;
16
+ } | {
10
17
  end: boolean;
11
18
  before?: never;
19
+ start?: never;
12
20
  status?: never;
13
21
  locale?: never;
14
22
  };
@@ -31,7 +39,7 @@ interface RelationsFieldProps extends Omit<Extract<EditFieldLayout, {
31
39
  }
32
40
  export interface RelationsFormValue {
33
41
  connect?: Relation[];
34
- disconnect?: Pick<Relation, 'id'>[];
42
+ disconnect?: Pick<Relation, 'id' | 'status'>[];
35
43
  }
36
44
  declare const FlexWrapper: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<Omit<Omit<import("@strapi/design-system").FlexProps<"div">, "ref"> & React.RefAttributes<unknown>, "ref"> & {
37
45
  ref?: ((instance: unknown) => void | React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof React.DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | React.RefObject<unknown> | null | undefined;
@@ -7,6 +7,7 @@ export interface DraftRelationCounts {
7
7
  export declare const EMPTY_DRAFT_RELATION_COUNTS: DraftRelationCounts;
8
8
  export declare const isBidirectionalManyToMany: (attribute: Schema["attributes"][string]) => boolean;
9
9
  export declare const mergeDraftRelationCounts: (left: DraftRelationCounts, right: DraftRelationCounts) => DraftRelationCounts;
10
+ export declare const clampDraftRelationCounts: (counts: DraftRelationCounts) => DraftRelationCounts;
10
11
  export declare const normalizeDraftRelationCounts: (payload: unknown) => DraftRelationCounts;
11
12
  export declare const resolveDraftRelationCounts: (documentId: string | undefined, modified: boolean, localCounts: DraftRelationCounts, serverCounts: DraftRelationCounts) => DraftRelationCounts;
12
13
  export interface DraftRelationsPublishState {
@@ -3,6 +3,8 @@
3
3
  * so we need to avoid conficts in the router name, and to prefix the path for each route.
4
4
  */
5
5
  export declare const routes: {
6
- 'history-version': import("@strapi/types/dist/core/router.js").Router;
6
+ 'history-version': import("@strapi/types/dist/core/router.js").Router | ((params: {
7
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
8
+ }) => import("@strapi/types/dist/core/router.js").Router);
7
9
  };
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/history/routes/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,MAAM;;CAEsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/history/routes/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;CAEsB,CAAC"}
@@ -1,8 +1,12 @@
1
1
  declare const _default: {
2
2
  routes: {
3
- homepage: import("@strapi/types/dist/core/router.js").Router;
3
+ homepage: import("@strapi/types/dist/core/router.js").Router | ((params: {
4
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
5
+ }) => import("@strapi/types/dist/core/router.js").Router);
4
6
  };
5
- controllers: Record<string, import("@strapi/types/dist/core/controller.js").Controller>;
7
+ controllers: Record<string, import("@strapi/types/dist/core/controller.js").Controller | ((params: {
8
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
9
+ }) => import("@strapi/types/dist/core/controller.js").Controller)>;
6
10
  services: {
7
11
  homepage: ({ strapi }: {
8
12
  strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/homepage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAIA,wBAIE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/homepage/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAIA,wBAIE"}
@@ -3,6 +3,8 @@
3
3
  * so we need to avoid conficts in the router name, and to prefix the path for each route.
4
4
  */
5
5
  export declare const routes: {
6
- homepage: import("@strapi/types/dist/core/router.js").Router;
6
+ homepage: import("@strapi/types/dist/core/router.js").Router | ((params: {
7
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
8
+ }) => import("@strapi/types/dist/core/router.js").Router);
7
9
  };
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/homepage/routes/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,MAAM;;CAEsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/homepage/routes/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;CAEsB,CAAC"}
@@ -59,7 +59,9 @@ declare const _default: () => {
59
59
  };
60
60
  };
61
61
  routes: {
62
- homepage: import("@strapi/types/dist/core/router.js").Router;
62
+ homepage: import("@strapi/types/dist/core/router.js").Router | ((params: {
63
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
64
+ }) => import("@strapi/types/dist/core/router.js").Router);
63
65
  admin: {
64
66
  type: string;
65
67
  routes: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAM2B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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7C,CAAC;;;;;AAXv1E,wBAUE"}
@@ -3,6 +3,8 @@
3
3
  * so we need to avoid conficts in the router name, and to prefix the path for each route.
4
4
  */
5
5
  export declare const routes: {
6
- preview: import("@strapi/types/dist/core/router.js").Router;
6
+ preview: import("@strapi/types/dist/core/router.js").Router | ((params: {
7
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
8
+ }) => import("@strapi/types/dist/core/router.js").Router);
7
9
  };
8
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/preview/routes/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,MAAM;;CAEsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../server/src/preview/routes/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,MAAM;;;;CAEsB,CAAC"}
@@ -1,5 +1,7 @@
1
1
  declare const _default: {
2
- homepage: import("@strapi/types/dist/core/router.js").Router;
2
+ homepage: import("@strapi/types/dist/core/router.js").Router | ((params: {
3
+ strapi: import("@strapi/types/dist/core/strapi.js").Strapi;
4
+ }) => import("@strapi/types/dist/core/router.js").Router);
3
5
  admin: {
4
6
  type: string;
5
7
  routes: ({
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAKE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/routes/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wBAKE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@strapi/content-manager",
3
- "version": "5.50.2",
3
+ "version": "5.51.0",
4
4
  "description": "A powerful UI to easily manage your data.",
5
5
  "homepage": "https://strapi.io",
6
6
  "bugs": {
@@ -75,8 +75,8 @@
75
75
  "@sindresorhus/slugify": "1.1.0",
76
76
  "@strapi/design-system": "2.2.3",
77
77
  "@strapi/icons": "2.2.3",
78
- "@strapi/types": "5.50.2",
79
- "@strapi/utils": "5.50.2",
78
+ "@strapi/types": "5.51.0",
79
+ "@strapi/utils": "5.51.0",
80
80
  "codemirror5": "npm:codemirror@^5.65.11",
81
81
  "date-fns": "2.30.0",
82
82
  "dompurify": "3.4.11",
@@ -108,11 +108,11 @@
108
108
  "slate-history": "0.93.0",
109
109
  "slate-react": "0.98.4",
110
110
  "yup": "0.32.9",
111
- "zod": "3.25.67"
111
+ "zod": "3.25.76"
112
112
  },
113
113
  "devDependencies": {
114
- "@strapi/admin": "5.50.2",
115
- "@strapi/database": "5.50.2",
114
+ "@strapi/admin": "5.51.0",
115
+ "@strapi/database": "5.51.0",
116
116
  "@testing-library/dom": "10.4.1",
117
117
  "@testing-library/jest-dom": "6.9.1",
118
118
  "@testing-library/react": "16.3.2",