@wordpress/core-data 7.30.1-next.836ecdcae.0 → 7.31.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/CHANGELOG.md +2 -0
- package/README.md +23 -1
- package/build/actions.js +32 -2
- package/build/actions.js.map +1 -1
- package/build/entities.js +1 -1
- package/build/entities.js.map +1 -1
- package/build/entity-types/user.js.map +1 -1
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use-entity-records.js.map +1 -1
- package/build/private-actions.js +8 -0
- package/build/private-actions.js.map +1 -1
- package/build/private-selectors.js +8 -1
- package/build/private-selectors.js.map +1 -1
- package/build/reducer.js +9 -1
- package/build/reducer.js.map +1 -1
- package/build/resolvers.js +80 -64
- package/build/resolvers.js.map +1 -1
- package/build/selectors.js +99 -41
- package/build/selectors.js.map +1 -1
- package/build-module/actions.js +32 -2
- package/build-module/actions.js.map +1 -1
- package/build-module/entities.js +1 -1
- package/build-module/entities.js.map +1 -1
- package/build-module/entity-types/user.js.map +1 -1
- package/build-module/hooks/index.js +8 -0
- package/build-module/hooks/index.js.map +1 -1
- package/build-module/hooks/use-entity-records.js.map +1 -1
- package/build-module/private-actions.js +7 -0
- package/build-module/private-actions.js.map +1 -1
- package/build-module/private-selectors.js +7 -1
- package/build-module/private-selectors.js.map +1 -1
- package/build-module/reducer.js +8 -1
- package/build-module/reducer.js.map +1 -1
- package/build-module/resolvers.js +76 -61
- package/build-module/resolvers.js.map +1 -1
- package/build-module/selectors.js +98 -41
- package/build-module/selectors.js.map +1 -1
- package/build-types/actions.d.ts.map +1 -1
- package/build-types/entity-types/user.d.ts +2 -2
- package/build-types/entity-types/user.d.ts.map +1 -1
- package/build-types/hooks/index.d.ts +8 -0
- package/build-types/hooks/index.d.ts.map +1 -1
- package/build-types/hooks/use-entity-records.d.ts +12 -2
- package/build-types/hooks/use-entity-records.d.ts.map +1 -1
- package/build-types/index.d.ts +2 -1
- package/build-types/index.d.ts.map +1 -1
- package/build-types/private-actions.d.ts +5 -0
- package/build-types/private-actions.d.ts.map +1 -1
- package/build-types/private-selectors.d.ts +1 -0
- package/build-types/private-selectors.d.ts.map +1 -1
- package/build-types/reducer.d.ts +3 -0
- package/build-types/reducer.d.ts.map +1 -1
- package/build-types/resolvers.d.ts +7 -0
- package/build-types/resolvers.d.ts.map +1 -1
- package/build-types/selectors.d.ts +18 -2
- package/build-types/selectors.d.ts.map +1 -1
- package/package.json +18 -18
- package/src/actions.js +43 -1
- package/src/entities.js +1 -1
- package/src/entity-types/user.ts +2 -2
- package/src/hooks/index.ts +9 -0
- package/src/hooks/use-entity-records.ts +12 -2
- package/src/private-actions.js +4 -0
- package/src/private-selectors.ts +10 -0
- package/src/reducer.js +7 -0
- package/src/resolvers.js +127 -81
- package/src/selectors.ts +110 -40
- package/src/test/actions.js +2 -2
- package/src/test/entities.js +32 -0
- package/src/test/resolvers.js +103 -12
- package/src/test/selectors.js +220 -13
- package/src/test/store.js +114 -0
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_url","require","_deprecated","_interopRequireDefault","_data","_element","_useQuerySelect","_","_lockUnlock","_utils","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","addQueryArgs","data","records","rest","useQuerySelect","query","coreStore","getEntityRecords","totalItems","totalPages","useSelect","select","getEntityRecordsTotalItems","getEntityRecordsTotalPages","__experimentalUseEntityRecords","deprecated","alternative","since","useEntityRecordsWithPermissions","entityConfig","getEntityConfig","ret","_fields","Set","getNormalizedCommaSeparable","join","ids","useMemo","_data$map","map","record","_entityConfig$key","key","permissions","getEntityRecordsPermissions","unlock","dataWithPermissions","_data$map2","index"],"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\nimport { unlock } from '../lock-unlock';\nimport { getNormalizedCommaSeparable } from '../utils';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity record */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n\n\t/**\n\t * The total number of available items (if not paginated).\n\t */\n\ttotalItems: number | null;\n\n\t/**\n\t * The total number of pages.\n\t */\n\ttotalPages: number | null;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecords } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\tconst { totalItems, totalPages } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\ttotalItems: null,\n\t\t\t\t\ttotalPages: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttotalItems: select( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\ttotalPages: select( coreStore ).getEntityRecordsTotalPages(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\ttotalItems,\n\t\ttotalPages,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n\nexport function useEntityRecordsWithPermissions< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\tconst entityConfig = useSelect(\n\t\t( select ) => select( coreStore ).getEntityConfig( kind, name ),\n\t\t[ kind, name ]\n\t);\n\tconst { records: data, ...ret } = useEntityRecords(\n\t\tkind,\n\t\tname,\n\t\t{\n\t\t\t...queryArgs,\n\t\t\t// If _fields is provided, we need to include _links in the request for permission caching to work.\n\t\t\t...( queryArgs._fields\n\t\t\t\t? {\n\t\t\t\t\t\t_fields: [\n\t\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t\t...( getNormalizedCommaSeparable(\n\t\t\t\t\t\t\t\t\tqueryArgs._fields\n\t\t\t\t\t\t\t\t) || [] ),\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t] ),\n\t\t\t\t\t\t].join(),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t},\n\t\toptions\n\t);\n\tconst ids = useMemo(\n\t\t() =>\n\t\t\tdata?.map(\n\t\t\t\t// @ts-ignore\n\t\t\t\t( record: RecordType ) => record[ entityConfig?.key ?? 'id' ]\n\t\t\t) ?? [],\n\t\t[ data, entityConfig?.key ]\n\t);\n\n\tconst permissions = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecordsPermissions } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\t\t\treturn getEntityRecordsPermissions( kind, name, ids );\n\t\t},\n\t\t[ ids, kind, name ]\n\t);\n\n\tconst dataWithPermissions = useMemo(\n\t\t() =>\n\t\t\tdata?.map( ( record, index ) => ( {\n\t\t\t\t// @ts-ignore\n\t\t\t\t...record,\n\t\t\t\tpermissions: permissions[ index ],\n\t\t\t} ) ) ?? [],\n\t\t[ data, permissions ]\n\t);\n\n\treturn { records: dataWithPermissions, ...ret };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,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EAAI,CAAC;AAChD","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_url","require","_deprecated","_interopRequireDefault","_data","_element","_useQuerySelect","_","_lockUnlock","_utils","EMPTY_ARRAY","useEntityRecords","kind","name","queryArgs","options","enabled","queryAsString","addQueryArgs","data","records","rest","useQuerySelect","query","coreStore","getEntityRecords","totalItems","totalPages","useSelect","select","getEntityRecordsTotalItems","getEntityRecordsTotalPages","__experimentalUseEntityRecords","deprecated","alternative","since","useEntityRecordsWithPermissions","entityConfig","getEntityConfig","ret","_fields","Set","getNormalizedCommaSeparable","join","ids","useMemo","_data$map","map","record","_entityConfig$key","key","permissions","getEntityRecordsPermissions","unlock","dataWithPermissions","_data$map2","index"],"sources":["@wordpress/core-data/src/hooks/use-entity-records.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { addQueryArgs } from '@wordpress/url';\nimport deprecated from '@wordpress/deprecated';\nimport { useSelect } from '@wordpress/data';\nimport { useMemo } from '@wordpress/element';\n\n/**\n * Internal dependencies\n */\nimport useQuerySelect from './use-query-select';\nimport { store as coreStore } from '../';\nimport type { Options } from './use-entity-record';\nimport type { Status } from './constants';\nimport { unlock } from '../lock-unlock';\nimport { getNormalizedCommaSeparable } from '../utils';\n\ninterface EntityRecordsResolution< RecordType > {\n\t/** The requested entity records */\n\trecords: RecordType[] | null;\n\n\t/**\n\t * Is the record still being resolved?\n\t */\n\tisResolving: boolean;\n\n\t/**\n\t * Is the record resolved by now?\n\t */\n\thasResolved: boolean;\n\n\t/** Resolution status */\n\tstatus: Status;\n\n\t/**\n\t * The total number of available items (if not paginated).\n\t */\n\ttotalItems: number | null;\n\n\t/**\n\t * The total number of pages.\n\t */\n\ttotalPages: number | null;\n}\n\nexport type WithPermissions< RecordType > = RecordType & {\n\tpermissions: { delete: boolean; update: boolean };\n};\n\ninterface EntityRecordsWithPermissionsResolution< RecordType >\n\textends Omit< EntityRecordsResolution< RecordType >, 'records' > {\n\t/** The requested entity records with permissions */\n\trecords: WithPermissions< RecordType >[] | null;\n}\n\nconst EMPTY_ARRAY = [];\n\n/**\n * Resolves the specified entity records.\n *\n * @since 6.1.0 Introduced in WordPress core.\n *\n * @param kind Kind of the entity, e.g. `root` or a `postType`. See rootEntitiesConfig in ../entities.ts for a list of available kinds.\n * @param name Name of the entity, e.g. `plugin` or a `post`. See rootEntitiesConfig in ../entities.ts for a list of available names.\n * @param queryArgs Optional HTTP query description for how to fetch the data, passed to the requested API endpoint.\n * @param options Optional hook options.\n * @example\n * ```js\n * import { useEntityRecords } from '@wordpress/core-data';\n *\n * function PageTitlesList() {\n * const { records, isResolving } = useEntityRecords( 'postType', 'page' );\n *\n * if ( isResolving ) {\n * return 'Loading...';\n * }\n *\n * return (\n * <ul>\n * {records.map(( page ) => (\n * <li>{ page.title }</li>\n * ))}\n * </ul>\n * );\n * }\n *\n * // Rendered in the application:\n * // <PageTitlesList />\n * ```\n *\n * In the above example, when `PageTitlesList` is rendered into an\n * application, the list of records and the resolution details will be retrieved from\n * the store state using `getEntityRecords()`, or resolved if missing.\n *\n * @return Entity records data.\n * @template RecordType\n */\nexport default function useEntityRecords< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsResolution< RecordType > {\n\t// Serialize queryArgs to a string that can be safely used as a React dep.\n\t// We can't just pass queryArgs as one of the deps, because if it is passed\n\t// as an object literal, then it will be a different object on each call even\n\t// if the values remain the same.\n\tconst queryAsString = addQueryArgs( '', queryArgs );\n\n\tconst { data: records, ...rest } = useQuerySelect(\n\t\t( query ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\t// Avoiding returning a new reference on every execution.\n\t\t\t\t\tdata: EMPTY_ARRAY,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn query( coreStore ).getEntityRecords( kind, name, queryArgs );\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\tconst { totalItems, totalPages } = useSelect(\n\t\t( select ) => {\n\t\t\tif ( ! options.enabled ) {\n\t\t\t\treturn {\n\t\t\t\t\ttotalItems: null,\n\t\t\t\t\ttotalPages: null,\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttotalItems: select( coreStore ).getEntityRecordsTotalItems(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t\ttotalPages: select( coreStore ).getEntityRecordsTotalPages(\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tqueryArgs\n\t\t\t\t),\n\t\t\t};\n\t\t},\n\t\t[ kind, name, queryAsString, options.enabled ]\n\t);\n\n\treturn {\n\t\trecords,\n\t\ttotalItems,\n\t\ttotalPages,\n\t\t...rest,\n\t};\n}\n\nexport function __experimentalUseEntityRecords(\n\tkind: string,\n\tname: string,\n\tqueryArgs: any,\n\toptions: any\n) {\n\tdeprecated( `wp.data.__experimentalUseEntityRecords`, {\n\t\talternative: 'wp.data.useEntityRecords',\n\t\tsince: '6.1',\n\t} );\n\treturn useEntityRecords( kind, name, queryArgs, options );\n}\n\nexport function useEntityRecordsWithPermissions< RecordType >(\n\tkind: string,\n\tname: string,\n\tqueryArgs: Record< string, unknown > = {},\n\toptions: Options = { enabled: true }\n): EntityRecordsWithPermissionsResolution< RecordType > {\n\tconst entityConfig = useSelect(\n\t\t( select ) => select( coreStore ).getEntityConfig( kind, name ),\n\t\t[ kind, name ]\n\t);\n\tconst { records: data, ...ret } = useEntityRecords(\n\t\tkind,\n\t\tname,\n\t\t{\n\t\t\t...queryArgs,\n\t\t\t// If _fields is provided, we need to include _links in the request for permission caching to work.\n\t\t\t...( queryArgs._fields\n\t\t\t\t? {\n\t\t\t\t\t\t_fields: [\n\t\t\t\t\t\t\t...new Set( [\n\t\t\t\t\t\t\t\t...( getNormalizedCommaSeparable(\n\t\t\t\t\t\t\t\t\tqueryArgs._fields\n\t\t\t\t\t\t\t\t) || [] ),\n\t\t\t\t\t\t\t\t'_links',\n\t\t\t\t\t\t\t] ),\n\t\t\t\t\t\t].join(),\n\t\t\t\t }\n\t\t\t\t: {} ),\n\t\t},\n\t\toptions\n\t);\n\tconst ids = useMemo(\n\t\t() =>\n\t\t\tdata?.map(\n\t\t\t\t// @ts-ignore\n\t\t\t\t( record: RecordType ) => record[ entityConfig?.key ?? 'id' ]\n\t\t\t) ?? [],\n\t\t[ data, entityConfig?.key ]\n\t);\n\n\tconst permissions = useSelect(\n\t\t( select ) => {\n\t\t\tconst { getEntityRecordsPermissions } = unlock(\n\t\t\t\tselect( coreStore )\n\t\t\t);\n\t\t\treturn getEntityRecordsPermissions( kind, name, ids );\n\t\t},\n\t\t[ ids, kind, name ]\n\t);\n\n\tconst dataWithPermissions = useMemo(\n\t\t() =>\n\t\t\tdata?.map( ( record, index ) => ( {\n\t\t\t\t// @ts-ignore\n\t\t\t\t...record,\n\t\t\t\tpermissions: permissions[ index ],\n\t\t\t} ) ) ?? [],\n\t\t[ data, permissions ]\n\t);\n\n\treturn { records: dataWithPermissions, ...ret };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,IAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA;AACA,IAAAI,QAAA,GAAAJ,OAAA;AAKA,IAAAK,eAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,CAAA,GAAAN,OAAA;AAGA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAhBA;AACA;AACA;;AAMA;AACA;AACA;;AA8CA,MAAMS,WAAW,GAAG,EAAE;;AAEtB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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AAE;IAAA,CAC9D,CAAC,cAAAH,SAAA,cAAAA,SAAA,GAAI,EAAE;EAAA,GACR,CAAE3B,IAAI,EAAEkB,YAAY,EAAEa,GAAG,CAC1B,CAAC;EAED,MAAMC,WAAW,GAAG,IAAAvB,eAAS,EAC1BC,MAAM,IAAM;IACb,MAAM;MAAEuB;IAA4B,CAAC,GAAG,IAAAC,kBAAM,EAC7CxB,MAAM,CAAEL,OAAU,CACnB,CAAC;IACD,OAAO4B,2BAA2B,CAAExC,IAAI,EAAEC,IAAI,EAAE+B,GAAI,CAAC;EACtD,CAAC,EACD,CAAEA,GAAG,EAAEhC,IAAI,EAAEC,IAAI,CAClB,CAAC;EAED,MAAMyC,mBAAmB,GAAG,IAAAT,gBAAO,EAClC;IAAA,IAAAU,UAAA;IAAA,QAAAA,UAAA,GACCpC,IAAI,EAAE4B,GAAG,CAAE,CAAEC,MAAM,EAAEQ,KAAK,MAAQ;MACjC;MACA,GAAGR,MAAM;MACTG,WAAW,EAAEA,WAAW,CAAEK,KAAK;IAChC,CAAC,CAAG,CAAC,cAAAD,UAAA,cAAAA,UAAA,GAAI,EAAE;EAAA,GACZ,CAAEpC,IAAI,EAAEgC,WAAW,CACpB,CAAC;EAED,OAAO;IAAE/B,OAAO,EAAEkC,mBAAmB;IAAE,GAAGf;EAAI,CAAC;AAChD","ignoreList":[]}
|
package/build/private-actions.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.editMediaEntity = void 0;
|
|
8
8
|
exports.receiveRegisteredPostMeta = receiveRegisteredPostMeta;
|
|
9
|
+
exports.receiveTemplateAutoDraftId = receiveTemplateAutoDraftId;
|
|
9
10
|
var _apiFetch = _interopRequireDefault(require("@wordpress/api-fetch"));
|
|
10
11
|
var _name = require("./name");
|
|
11
12
|
/**
|
|
@@ -119,4 +120,11 @@ const editMediaEntity = (recordId, edits = {}, {
|
|
|
119
120
|
}
|
|
120
121
|
};
|
|
121
122
|
exports.editMediaEntity = editMediaEntity;
|
|
123
|
+
function receiveTemplateAutoDraftId(target, id) {
|
|
124
|
+
return {
|
|
125
|
+
type: 'RECEIVE_TEMPLATE_AUTO_DRAFT_ID',
|
|
126
|
+
target,
|
|
127
|
+
id
|
|
128
|
+
};
|
|
129
|
+
}
|
|
122
130
|
//# sourceMappingURL=private-actions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_name","receiveRegisteredPostMeta","postType","registeredPostMeta","type","editMediaEntity","recordId","edits","__unstableFetch","apiFetch","throwOnError","dispatch","resolveSelect","kind","name","configs","getEntitiesConfig","entityConfig","find","config","lock","__unstableAcquireStoreLock","STORE_NAME","exclusive","updatedRecord","error","hasError","path","baseURL","newRecord","method","data","receiveEntityRecords","undefined","e","__unstableReleaseStoreLock","exports"],"sources":["@wordpress/core-data/src/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\n\n/**\n * Returns an action object used in signalling that the registered post meta\n * fields for a post type have been received.\n *\n * @param {string} postType Post type slug.\n * @param {Object} registeredPostMeta Registered post meta.\n *\n * @return {Object} Action object.\n */\nexport function receiveRegisteredPostMeta( postType, registeredPostMeta ) {\n\treturn {\n\t\ttype: 'RECEIVE_REGISTERED_POST_META',\n\t\tpostType,\n\t\tregisteredPostMeta,\n\t};\n}\n\n/**\n * @typedef {Object} Modifier\n * @property {string} [type] - The type of modifier.\n * @property {Object} [args] - The arguments of the modifier.\n */\n\n/**\n * @typedef {Object} Edits\n * @property {string} [src] - The URL of the media item.\n * @property {Modifier[]} [modifiers] - The modifiers to apply to the media item.\n */\n\n/**\n * Duplicates a media (attachment) entity record and, optionally, modifies it.\n *\n * @param {string} recordId Entity record ID.\n * @param {Edits} edits Edits to apply to the record.\n * @param {Object} options Options object.\n * @param {Function} options.__unstableFetch Custom fetch function.\n * @param {boolean} options.throwOnError Whether to throw an error if the request fails.\n *\n * @return {Promise} Promise resolving to the updated record.\n */\nexport const editMediaEntity =\n\t(\n\t\trecordId,\n\t\tedits = {},\n\t\t{ __unstableFetch = apiFetch, throwOnError = false } = {}\n\t) =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tif ( ! recordId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst kind = 'postType';\n\t\tconst name = 'attachment';\n\n\t\tconst configs = await resolveSelect.getEntitiesConfig( kind );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, recordId ],\n\t\t\t{ exclusive: true }\n\t\t);\n\n\t\tlet updatedRecord;\n\t\tlet error;\n\t\tlet hasError = false;\n\n\t\ttry {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_START',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t} );\n\n\t\t\ttry {\n\t\t\t\tconst path = `${ entityConfig.baseURL }/${ recordId }/edit`;\n\t\t\t\tconst newRecord = await __unstableFetch( {\n\t\t\t\t\tpath,\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t...edits,\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tif ( newRecord ) {\n\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t[ newRecord ],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t);\n\t\t\t\t\tupdatedRecord = newRecord;\n\t\t\t\t}\n\t\t\t} catch ( e ) {\n\t\t\t\terror = e;\n\t\t\t\thasError = true;\n\t\t\t}\n\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_FINISH',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\terror,\n\t\t\t} );\n\n\t\t\tif ( hasError && throwOnError ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn updatedRecord;\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_apiFetch","_interopRequireDefault","require","_name","receiveRegisteredPostMeta","postType","registeredPostMeta","type","editMediaEntity","recordId","edits","__unstableFetch","apiFetch","throwOnError","dispatch","resolveSelect","kind","name","configs","getEntitiesConfig","entityConfig","find","config","lock","__unstableAcquireStoreLock","STORE_NAME","exclusive","updatedRecord","error","hasError","path","baseURL","newRecord","method","data","receiveEntityRecords","undefined","e","__unstableReleaseStoreLock","exports","receiveTemplateAutoDraftId","target","id"],"sources":["@wordpress/core-data/src/private-actions.js"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport apiFetch from '@wordpress/api-fetch';\n\n/**\n * Internal dependencies\n */\nimport { STORE_NAME } from './name';\n\n/**\n * Returns an action object used in signalling that the registered post meta\n * fields for a post type have been received.\n *\n * @param {string} postType Post type slug.\n * @param {Object} registeredPostMeta Registered post meta.\n *\n * @return {Object} Action object.\n */\nexport function receiveRegisteredPostMeta( postType, registeredPostMeta ) {\n\treturn {\n\t\ttype: 'RECEIVE_REGISTERED_POST_META',\n\t\tpostType,\n\t\tregisteredPostMeta,\n\t};\n}\n\n/**\n * @typedef {Object} Modifier\n * @property {string} [type] - The type of modifier.\n * @property {Object} [args] - The arguments of the modifier.\n */\n\n/**\n * @typedef {Object} Edits\n * @property {string} [src] - The URL of the media item.\n * @property {Modifier[]} [modifiers] - The modifiers to apply to the media item.\n */\n\n/**\n * Duplicates a media (attachment) entity record and, optionally, modifies it.\n *\n * @param {string} recordId Entity record ID.\n * @param {Edits} edits Edits to apply to the record.\n * @param {Object} options Options object.\n * @param {Function} options.__unstableFetch Custom fetch function.\n * @param {boolean} options.throwOnError Whether to throw an error if the request fails.\n *\n * @return {Promise} Promise resolving to the updated record.\n */\nexport const editMediaEntity =\n\t(\n\t\trecordId,\n\t\tedits = {},\n\t\t{ __unstableFetch = apiFetch, throwOnError = false } = {}\n\t) =>\n\tasync ( { dispatch, resolveSelect } ) => {\n\t\tif ( ! recordId ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst kind = 'postType';\n\t\tconst name = 'attachment';\n\n\t\tconst configs = await resolveSelect.getEntitiesConfig( kind );\n\t\tconst entityConfig = configs.find(\n\t\t\t( config ) => config.kind === kind && config.name === name\n\t\t);\n\n\t\tif ( ! entityConfig ) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lock = await dispatch.__unstableAcquireStoreLock(\n\t\t\tSTORE_NAME,\n\t\t\t[ 'entities', 'records', kind, name, recordId ],\n\t\t\t{ exclusive: true }\n\t\t);\n\n\t\tlet updatedRecord;\n\t\tlet error;\n\t\tlet hasError = false;\n\n\t\ttry {\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_START',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t} );\n\n\t\t\ttry {\n\t\t\t\tconst path = `${ entityConfig.baseURL }/${ recordId }/edit`;\n\t\t\t\tconst newRecord = await __unstableFetch( {\n\t\t\t\t\tpath,\n\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\tdata: {\n\t\t\t\t\t\t...edits,\n\t\t\t\t\t},\n\t\t\t\t} );\n\n\t\t\t\tif ( newRecord ) {\n\t\t\t\t\tdispatch.receiveEntityRecords(\n\t\t\t\t\t\tkind,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\t[ newRecord ],\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tundefined\n\t\t\t\t\t);\n\t\t\t\t\tupdatedRecord = newRecord;\n\t\t\t\t}\n\t\t\t} catch ( e ) {\n\t\t\t\terror = e;\n\t\t\t\thasError = true;\n\t\t\t}\n\n\t\t\tdispatch( {\n\t\t\t\ttype: 'SAVE_ENTITY_RECORD_FINISH',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\terror,\n\t\t\t} );\n\n\t\t\tif ( hasError && throwOnError ) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\treturn updatedRecord;\n\t\t} finally {\n\t\t\tdispatch.__unstableReleaseStoreLock( lock );\n\t\t}\n\t};\n\nexport function receiveTemplateAutoDraftId( target, id ) {\n\treturn { type: 'RECEIVE_TEMPLATE_AUTO_DRAFT_ID', target, id };\n}\n"],"mappings":";;;;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,KAAA,GAAAD,OAAA;AARA;AACA;AACA;;AAGA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,yBAAyBA,CAAEC,QAAQ,EAAEC,kBAAkB,EAAG;EACzE,OAAO;IACNC,IAAI,EAAE,8BAA8B;IACpCF,QAAQ;IACRC;EACD,CAAC;AACF;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAME,eAAe,GAC3BA,CACCC,QAAQ,EACRC,KAAK,GAAG,CAAC,CAAC,EACV;EAAEC,eAAe,GAAGC,iBAAQ;EAAEC,YAAY,GAAG;AAAM,CAAC,GAAG,CAAC,CAAC,KAE1D,OAAQ;EAAEC,QAAQ;EAAEC;AAAc,CAAC,KAAM;EACxC,IAAK,CAAEN,QAAQ,EAAG;IACjB;EACD;EAEA,MAAMO,IAAI,GAAG,UAAU;EACvB,M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ACJR,QAAQ;MACRmB;IACD,CAAE,CAAC;IAEH,IAAKC,QAAQ,IAAIhB,YAAY,EAAG;MAC/B,MAAMe,KAAK;IACZ;IACA,OAAOD,aAAa;EACrB,CAAC,SAAS;IACTb,QAAQ,CAACwB,0BAA0B,CAAEf,IAAK,CAAC;EAC5C;AACD,CAAC;AAACgB,OAAA,CAAA/B,eAAA,GAAAA,eAAA;AAEI,SAASgC,0BAA0BA,CAAEC,MAAM,EAAEC,EAAE,EAAG;EACxD,OAAO;IAAEnC,IAAI,EAAE,gCAAgC;IAAEkC,MAAM;IAAEC;EAAG,CAAC;AAC9D","ignoreList":[]}
|
|
@@ -10,6 +10,7 @@ exports.getHomePage = exports.getEntityRecordsPermissions = void 0;
|
|
|
10
10
|
exports.getNavigationFallbackId = getNavigationFallbackId;
|
|
11
11
|
exports.getPostsPageId = void 0;
|
|
12
12
|
exports.getRegisteredPostMeta = getRegisteredPostMeta;
|
|
13
|
+
exports.getTemplateAutoDraftId = getTemplateAutoDraftId;
|
|
13
14
|
exports.getTemplateId = void 0;
|
|
14
15
|
exports.getUndoManager = getUndoManager;
|
|
15
16
|
var _data = require("@wordpress/data");
|
|
@@ -131,7 +132,10 @@ const getHomePage = exports.getHomePage = (0, _data.createRegistrySelector)(sele
|
|
|
131
132
|
postType: 'wp_template',
|
|
132
133
|
postId: frontPageTemplateId
|
|
133
134
|
};
|
|
134
|
-
}, state => [
|
|
135
|
+
}, state => [
|
|
136
|
+
// Even though getDefaultTemplateId.shouldInvalidate returns true when root/site changes,
|
|
137
|
+
// it doesn't seem to invalidate this cache, I'm not sure why.
|
|
138
|
+
(0, _selectors.getEntityRecord)(state, 'root', 'site'), (0, _selectors.getEntityRecord)(state, 'root', '__unstableBase'), (0, _selectors.getDefaultTemplateId)(state, {
|
|
135
139
|
slug: 'front-page'
|
|
136
140
|
})]));
|
|
137
141
|
const getPostsPageId = exports.getPostsPageId = (0, _data.createRegistrySelector)(select => () => {
|
|
@@ -204,4 +208,7 @@ const getTemplateId = exports.getTemplateId = (0, _data.createRegistrySelector)(
|
|
|
204
208
|
slug: slugToCheck
|
|
205
209
|
});
|
|
206
210
|
});
|
|
211
|
+
function getTemplateAutoDraftId(state, staticTemplateId) {
|
|
212
|
+
return state.templateAutoDraftId[staticTemplateId];
|
|
213
|
+
}
|
|
207
214
|
//# sourceMappingURL=private-selectors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_data","require","_selectors","_name","_lockUnlock","_logEntityDeprecation","_interopRequireDefault","getUndoManager","state","undoManager","getNavigationFallbackId","navigationFallbackId","getBlockPatternsForPostType","exports","createRegistrySelector","select","createSelector","postType","STORE_NAME","getBlockPatterns","filter","postTypes","Array","isArray","includes","getEntityRecordsPermissions","kind","name","ids","normalizedIds","map","id","delete","canUser","update","userPermissions","getEntityRecordPermissions","logEntityDeprecation","getRegisteredPostMeta","_state$registeredPost","registeredPostMeta","normalizePageId","value","Number","toString","getHomePage","siteData","getEntityRecord","homepageId","show_on_front","page_on_front","postId","frontPageTemplateId","getDefaultTemplateId","slug","getPostsPageId","page_for_posts","getTemplateId","homepage","unlock","templates","getEntityRecords","per_page","find","editedEntity","getEditedEntityRecord","postsPageId","currentTemplateSlug","template","currentTemplate","slugToCheck"],"sources":["@wordpress/core-data/src/private-selectors.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getDefaultTemplateId, getEntityRecord, type State } from './selectors';\nimport { STORE_NAME } from './name';\nimport { unlock } from './lock-unlock';\nimport logEntityDeprecation from './utils/log-entity-deprecation';\n\ntype EntityRecordKey = string | number;\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param state State tree.\n *\n * @return The undo manager.\n */\nexport function getUndoManager( state: State ) {\n\treturn state.undoManager;\n}\n\n/**\n * Retrieve the fallback Navigation.\n *\n * @param state Data state.\n * @return The ID for the fallback Navigation post.\n */\nexport function getNavigationFallbackId(\n\tstate: State\n): EntityRecordKey | undefined {\n\treturn state.navigationFallbackId;\n}\n\nexport const getBlockPatternsForPostType = createRegistrySelector(\n\t( select: any ) =>\n\t\tcreateSelector(\n\t\t\t( state, postType ) =>\n\t\t\t\tselect( STORE_NAME )\n\t\t\t\t\t.getBlockPatterns()\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { postTypes } ) =>\n\t\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t),\n\t\t\t() => [ select( STORE_NAME ).getBlockPatterns() ]\n\t\t)\n);\n\n/**\n * Returns the entity records permissions for the given entity record ids.\n */\nexport const getEntityRecordsPermissions = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t(\n\t\t\tstate: State,\n\t\t\tkind: string,\n\t\t\tname: string,\n\t\t\tids: string | string[]\n\t\t) => {\n\t\t\tconst normalizedIds = Array.isArray( ids ) ? ids : [ ids ];\n\t\t\treturn normalizedIds.map( ( id ) => ( {\n\t\t\t\tdelete: select( STORE_NAME ).canUser( 'delete', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t\tupdate: select( STORE_NAME ).canUser( 'update', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t\t},\n\t\t( state ) => [ state.userPermissions ]\n\t)\n);\n\n/**\n * Returns the entity record permissions for the given entity record id.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param id Entity record id.\n *\n * @return The entity record permissions.\n */\nexport function getEntityRecordPermissions(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tid: string\n) {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordPermissions' );\n\treturn getEntityRecordsPermissions( state, kind, name, id )[ 0 ];\n}\n\n/**\n * Returns the registered post meta fields for a given post type.\n *\n * @param state Data state.\n * @param postType Post type.\n *\n * @return Registered post meta fields.\n */\nexport function getRegisteredPostMeta( state: State, postType: string ) {\n\treturn state.registeredPostMeta?.[ postType ] ?? {};\n}\n\nfunction normalizePageId( value: number | string | undefined ): string | null {\n\tif ( ! value || ! [ 'number', 'string' ].includes( typeof value ) ) {\n\t\treturn null;\n\t}\n\n\t// We also need to check if it's not zero (`'0'`).\n\tif ( Number( value ) === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn value.toString();\n}\n\ninterface SiteData {\n\tshow_on_front?: string;\n\tpage_on_front?: string | number;\n\tpage_for_posts?: string | number;\n}\n\nexport const getHomePage = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t() => {\n\t\t\tconst siteData = select( STORE_NAME ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase'\n\t\t\t) as SiteData | undefined;\n\t\t\t// Still resolving getEntityRecord.\n\t\t\tif ( ! siteData ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst homepageId =\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? normalizePageId( siteData.page_on_front )\n\t\t\t\t\t: null;\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t\t}\n\t\t\tconst frontPageTemplateId = select(\n\t\t\t\tSTORE_NAME\n\t\t\t).getDefaultTemplateId( {\n\t\t\t\tslug: 'front-page',\n\t\t\t} );\n\t\t\t// Still resolving getDefaultTemplateId.\n\t\t\tif ( ! frontPageTemplateId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn { postType: 'wp_template', postId: frontPageTemplateId };\n\t\t},\n\t\t( state ) => [\n\t\t\tgetEntityRecord( state, 'root', '__unstableBase' ),\n\t\t\tgetDefaultTemplateId( state, {\n\t\t\t\tslug: 'front-page',\n\t\t\t} ),\n\t\t]\n\t)\n);\n\nexport const getPostsPageId = createRegistrySelector( ( select ) => () => {\n\tconst siteData = select( STORE_NAME ).getEntityRecord(\n\t\t'root',\n\t\t'__unstableBase'\n\t) as SiteData | undefined;\n\treturn siteData?.show_on_front === 'page'\n\t\t? normalizePageId( siteData.page_for_posts )\n\t\t: null;\n} );\n\nexport const getTemplateId = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst homepage = unlock( select( STORE_NAME ) ).getHomePage();\n\n\t\tif ( ! homepage ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For the front page, we always use the front page template if existing.\n\t\tif (\n\t\t\tpostType === 'page' &&\n\t\t\tpostType === homepage?.postType &&\n\t\t\tpostId.toString() === homepage?.postId\n\t\t) {\n\t\t\t// The /lookup endpoint cannot currently handle a lookup\n\t\t\t// when a page is set as the front page, so specifically in\n\t\t\t// that case, we want to check if there is a front page\n\t\t\t// template, and instead of falling back to the home\n\t\t\t// template, we want to fall back to the page template.\n\t\t\tconst templates = select( STORE_NAME ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tif ( ! templates ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst id = templates.find( ( { slug } ) => slug === 'front-page' )\n\t\t\t\t?.id;\n\t\t\tif ( id ) {\n\t\t\t\treturn id;\n\t\t\t}\n\t\t\t// If no front page template is found, continue with the\n\t\t\t// logic below (fetching the page template).\n\t\t}\n\n\t\tconst editedEntity = select( STORE_NAME ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\t\tif ( ! editedEntity ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postsPageId = unlock( select( STORE_NAME ) ).getPostsPageId();\n\t\t// Check if the current page is the posts page.\n\t\tif ( postType === 'page' && postsPageId === postId.toString() ) {\n\t\t\treturn select( STORE_NAME ).getDefaultTemplateId( {\n\t\t\t\tslug: 'home',\n\t\t\t} );\n\t\t}\n\t\t// First see if the post/page has an assigned template and fetch it.\n\t\tconst currentTemplateSlug = editedEntity.template;\n\t\tif ( currentTemplateSlug ) {\n\t\t\tconst currentTemplate = select( STORE_NAME )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} )\n\t\t\t\t?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\tif ( currentTemplate ) {\n\t\t\t\treturn currentTemplate.id;\n\t\t\t}\n\t\t}\n\t\t// If no template is assigned, use the default template.\n\t\tlet slugToCheck;\n\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t// through template hierarchy.\n\t\tif ( editedEntity.slug ) {\n\t\t\tslugToCheck =\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? `${ postType }-${ editedEntity.slug }`\n\t\t\t\t\t: `single-${ postType }-${ editedEntity.slug }`;\n\t\t} else {\n\t\t\tslugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;\n\t\t}\n\t\treturn select( STORE_NAME ).getDefaultTemplateId( {\n\t\t\tslug: slugToCheck,\n\t\t} );\n\t}\n);\n"],"mappings":";;;;;;;;;;;;;;AAGA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,qBAAA,GAAAC,sBAAA,CAAAL,OAAA;AAXA;AACA;AACA;;AAGA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,cAAcA,CAAEC,KAAY,EAAG;EAC9C,OAAOA,KAAK,CAACC,WAAW;AACzB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CACtCF,KAAY,EACkB;EAC9B,OAAOA,KAAK,CAACG,oBA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;IAC1B;EACD;EACA;EACA,IAAIuC,WAAW;EACf;EACA;EACA;EACA;EACA,IAAKN,YAAY,CAACV,IAAI,EAAG;IACxBgB,WAAW,GACVrD,QAAQ,KAAK,MAAM,GAChB,GAAIA,QAAQ,IAAM+C,YAAY,CAACV,IAAI,EAAG,GACtC,UAAWrC,QAAQ,IAAM+C,YAAY,CAACV,IAAI,EAAG;EAClD,CAAC,MAAM;IACNgB,WAAW,GAAGrD,QAAQ,KAAK,MAAM,GAAG,MAAM,GAAG,UAAWA,QAAQ,EAAG;EACpE;EACA,OAAOF,MAAM,CAAEG,gBAAW,CAAC,CAACmC,oBAAoB,CAAE;IACjDC,IAAI,EAAEgB;EACP,CAAE,CAAC;AACJ,CACD,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_data","require","_selectors","_name","_lockUnlock","_logEntityDeprecation","_interopRequireDefault","getUndoManager","state","undoManager","getNavigationFallbackId","navigationFallbackId","getBlockPatternsForPostType","exports","createRegistrySelector","select","createSelector","postType","STORE_NAME","getBlockPatterns","filter","postTypes","Array","isArray","includes","getEntityRecordsPermissions","kind","name","ids","normalizedIds","map","id","delete","canUser","update","userPermissions","getEntityRecordPermissions","logEntityDeprecation","getRegisteredPostMeta","_state$registeredPost","registeredPostMeta","normalizePageId","value","Number","toString","getHomePage","siteData","getEntityRecord","homepageId","show_on_front","page_on_front","postId","frontPageTemplateId","getDefaultTemplateId","slug","getPostsPageId","page_for_posts","getTemplateId","homepage","unlock","templates","getEntityRecords","per_page","find","editedEntity","getEditedEntityRecord","postsPageId","currentTemplateSlug","template","currentTemplate","slugToCheck","getTemplateAutoDraftId","staticTemplateId","templateAutoDraftId"],"sources":["@wordpress/core-data/src/private-selectors.ts"],"sourcesContent":["/**\n * WordPress dependencies\n */\nimport { createSelector, createRegistrySelector } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { getDefaultTemplateId, getEntityRecord, type State } from './selectors';\nimport { STORE_NAME } from './name';\nimport { unlock } from './lock-unlock';\nimport logEntityDeprecation from './utils/log-entity-deprecation';\n\ntype EntityRecordKey = string | number;\n\n/**\n * Returns the previous edit from the current undo offset\n * for the entity records edits history, if any.\n *\n * @param state State tree.\n *\n * @return The undo manager.\n */\nexport function getUndoManager( state: State ) {\n\treturn state.undoManager;\n}\n\n/**\n * Retrieve the fallback Navigation.\n *\n * @param state Data state.\n * @return The ID for the fallback Navigation post.\n */\nexport function getNavigationFallbackId(\n\tstate: State\n): EntityRecordKey | undefined {\n\treturn state.navigationFallbackId;\n}\n\nexport const getBlockPatternsForPostType = createRegistrySelector(\n\t( select: any ) =>\n\t\tcreateSelector(\n\t\t\t( state, postType ) =>\n\t\t\t\tselect( STORE_NAME )\n\t\t\t\t\t.getBlockPatterns()\n\t\t\t\t\t.filter(\n\t\t\t\t\t\t( { postTypes } ) =>\n\t\t\t\t\t\t\t! postTypes ||\n\t\t\t\t\t\t\t( Array.isArray( postTypes ) &&\n\t\t\t\t\t\t\t\tpostTypes.includes( postType ) )\n\t\t\t\t\t),\n\t\t\t() => [ select( STORE_NAME ).getBlockPatterns() ]\n\t\t)\n);\n\n/**\n * Returns the entity records permissions for the given entity record ids.\n */\nexport const getEntityRecordsPermissions = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t(\n\t\t\tstate: State,\n\t\t\tkind: string,\n\t\t\tname: string,\n\t\t\tids: string | string[]\n\t\t) => {\n\t\t\tconst normalizedIds = Array.isArray( ids ) ? ids : [ ids ];\n\t\t\treturn normalizedIds.map( ( id ) => ( {\n\t\t\t\tdelete: select( STORE_NAME ).canUser( 'delete', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t\tupdate: select( STORE_NAME ).canUser( 'update', {\n\t\t\t\t\tkind,\n\t\t\t\t\tname,\n\t\t\t\t\tid,\n\t\t\t\t} ),\n\t\t\t} ) );\n\t\t},\n\t\t( state ) => [ state.userPermissions ]\n\t)\n);\n\n/**\n * Returns the entity record permissions for the given entity record id.\n *\n * @param state Data state.\n * @param kind Entity kind.\n * @param name Entity name.\n * @param id Entity record id.\n *\n * @return The entity record permissions.\n */\nexport function getEntityRecordPermissions(\n\tstate: State,\n\tkind: string,\n\tname: string,\n\tid: string\n) {\n\tlogEntityDeprecation( kind, name, 'getEntityRecordPermissions' );\n\treturn getEntityRecordsPermissions( state, kind, name, id )[ 0 ];\n}\n\n/**\n * Returns the registered post meta fields for a given post type.\n *\n * @param state Data state.\n * @param postType Post type.\n *\n * @return Registered post meta fields.\n */\nexport function getRegisteredPostMeta( state: State, postType: string ) {\n\treturn state.registeredPostMeta?.[ postType ] ?? {};\n}\n\nfunction normalizePageId( value: number | string | undefined ): string | null {\n\tif ( ! value || ! [ 'number', 'string' ].includes( typeof value ) ) {\n\t\treturn null;\n\t}\n\n\t// We also need to check if it's not zero (`'0'`).\n\tif ( Number( value ) === 0 ) {\n\t\treturn null;\n\t}\n\n\treturn value.toString();\n}\n\ninterface SiteData {\n\tshow_on_front?: string;\n\tpage_on_front?: string | number;\n\tpage_for_posts?: string | number;\n}\n\nexport const getHomePage = createRegistrySelector( ( select ) =>\n\tcreateSelector(\n\t\t() => {\n\t\t\tconst siteData = select( STORE_NAME ).getEntityRecord(\n\t\t\t\t'root',\n\t\t\t\t'__unstableBase'\n\t\t\t) as SiteData | undefined;\n\t\t\t// Still resolving getEntityRecord.\n\t\t\tif ( ! siteData ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst homepageId =\n\t\t\t\tsiteData?.show_on_front === 'page'\n\t\t\t\t\t? normalizePageId( siteData.page_on_front )\n\t\t\t\t\t: null;\n\t\t\tif ( homepageId ) {\n\t\t\t\treturn { postType: 'page', postId: homepageId };\n\t\t\t}\n\t\t\tconst frontPageTemplateId = select(\n\t\t\t\tSTORE_NAME\n\t\t\t).getDefaultTemplateId( {\n\t\t\t\tslug: 'front-page',\n\t\t\t} );\n\t\t\t// Still resolving getDefaultTemplateId.\n\t\t\tif ( ! frontPageTemplateId ) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\treturn { postType: 'wp_template', postId: frontPageTemplateId };\n\t\t},\n\t\t( state ) => [\n\t\t\t// Even though getDefaultTemplateId.shouldInvalidate returns true when root/site changes,\n\t\t\t// it doesn't seem to invalidate this cache, I'm not sure why.\n\t\t\tgetEntityRecord( state, 'root', 'site' ),\n\t\t\tgetEntityRecord( state, 'root', '__unstableBase' ),\n\t\t\tgetDefaultTemplateId( state, {\n\t\t\t\tslug: 'front-page',\n\t\t\t} ),\n\t\t]\n\t)\n);\n\nexport const getPostsPageId = createRegistrySelector( ( select ) => () => {\n\tconst siteData = select( STORE_NAME ).getEntityRecord(\n\t\t'root',\n\t\t'__unstableBase'\n\t) as SiteData | undefined;\n\treturn siteData?.show_on_front === 'page'\n\t\t? normalizePageId( siteData.page_for_posts )\n\t\t: null;\n} );\n\nexport const getTemplateId = createRegistrySelector(\n\t( select ) => ( state, postType, postId ) => {\n\t\tconst homepage = unlock( select( STORE_NAME ) ).getHomePage();\n\n\t\tif ( ! homepage ) {\n\t\t\treturn;\n\t\t}\n\n\t\t// For the front page, we always use the front page template if existing.\n\t\tif (\n\t\t\tpostType === 'page' &&\n\t\t\tpostType === homepage?.postType &&\n\t\t\tpostId.toString() === homepage?.postId\n\t\t) {\n\t\t\t// The /lookup endpoint cannot currently handle a lookup\n\t\t\t// when a page is set as the front page, so specifically in\n\t\t\t// that case, we want to check if there is a front page\n\t\t\t// template, and instead of falling back to the home\n\t\t\t// template, we want to fall back to the page template.\n\t\t\tconst templates = select( STORE_NAME ).getEntityRecords(\n\t\t\t\t'postType',\n\t\t\t\t'wp_template',\n\t\t\t\t{\n\t\t\t\t\tper_page: -1,\n\t\t\t\t}\n\t\t\t);\n\t\t\tif ( ! templates ) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst id = templates.find( ( { slug } ) => slug === 'front-page' )\n\t\t\t\t?.id;\n\t\t\tif ( id ) {\n\t\t\t\treturn id;\n\t\t\t}\n\t\t\t// If no front page template is found, continue with the\n\t\t\t// logic below (fetching the page template).\n\t\t}\n\n\t\tconst editedEntity = select( STORE_NAME ).getEditedEntityRecord(\n\t\t\t'postType',\n\t\t\tpostType,\n\t\t\tpostId\n\t\t);\n\t\tif ( ! editedEntity ) {\n\t\t\treturn;\n\t\t}\n\t\tconst postsPageId = unlock( select( STORE_NAME ) ).getPostsPageId();\n\t\t// Check if the current page is the posts page.\n\t\tif ( postType === 'page' && postsPageId === postId.toString() ) {\n\t\t\treturn select( STORE_NAME ).getDefaultTemplateId( {\n\t\t\t\tslug: 'home',\n\t\t\t} );\n\t\t}\n\t\t// First see if the post/page has an assigned template and fetch it.\n\t\tconst currentTemplateSlug = editedEntity.template;\n\t\tif ( currentTemplateSlug ) {\n\t\t\tconst currentTemplate = select( STORE_NAME )\n\t\t\t\t.getEntityRecords( 'postType', 'wp_template', {\n\t\t\t\t\tper_page: -1,\n\t\t\t\t} )\n\t\t\t\t?.find( ( { slug } ) => slug === currentTemplateSlug );\n\t\t\tif ( currentTemplate ) {\n\t\t\t\treturn currentTemplate.id;\n\t\t\t}\n\t\t}\n\t\t// If no template is assigned, use the default template.\n\t\tlet slugToCheck;\n\t\t// In `draft` status we might not have a slug available, so we use the `single`\n\t\t// post type templates slug(ex page, single-post, single-product etc..).\n\t\t// Pages do not need the `single` prefix in the slug to be prioritized\n\t\t// through template hierarchy.\n\t\tif ( editedEntity.slug ) {\n\t\t\tslugToCheck =\n\t\t\t\tpostType === 'page'\n\t\t\t\t\t? `${ postType }-${ editedEntity.slug }`\n\t\t\t\t\t: `single-${ postType }-${ editedEntity.slug }`;\n\t\t} else {\n\t\t\tslugToCheck = postType === 'page' ? 'page' : `single-${ postType }`;\n\t\t}\n\t\treturn select( STORE_NAME ).getDefaultTemplateId( {\n\t\t\tslug: slugToCheck,\n\t\t} );\n\t}\n);\n\nexport function getTemplateAutoDraftId(\n\tstate: State,\n\tstaticTemplateId: string\n) {\n\treturn state.templateAuto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fig;
|
|
19
19
|
exports.navigationFallbackId = navigationFallbackId;
|
|
20
20
|
exports.registeredPostMeta = registeredPostMeta;
|
|
21
|
+
exports.templateAutoDraftId = templateAutoDraftId;
|
|
21
22
|
exports.themeBaseGlobalStyles = themeBaseGlobalStyles;
|
|
22
23
|
exports.themeGlobalStyleRevisions = themeGlobalStyleRevisions;
|
|
23
24
|
exports.themeGlobalStyleVariations = themeGlobalStyleVariations;
|
|
@@ -582,6 +583,12 @@ function registeredPostMeta(state = {}, action) {
|
|
|
582
583
|
}
|
|
583
584
|
return state;
|
|
584
585
|
}
|
|
586
|
+
function templateAutoDraftId(state = {}, action) {
|
|
587
|
+
return action.type === 'RECEIVE_TEMPLATE_AUTO_DRAFT_ID' ? {
|
|
588
|
+
...state,
|
|
589
|
+
[action.target]: action.id
|
|
590
|
+
} : state;
|
|
591
|
+
}
|
|
585
592
|
var _default = exports.default = (0, _data.combineReducers)({
|
|
586
593
|
users,
|
|
587
594
|
currentTheme,
|
|
@@ -601,6 +608,7 @@ var _default = exports.default = (0, _data.combineReducers)({
|
|
|
601
608
|
userPatternCategories,
|
|
602
609
|
navigationFallbackId,
|
|
603
610
|
defaultTemplates,
|
|
604
|
-
registeredPostMeta
|
|
611
|
+
registeredPostMeta,
|
|
612
|
+
templateAutoDraftId
|
|
605
613
|
});
|
|
606
614
|
//# sourceMappingURL=reducer.js.map
|
package/build/reducer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_es","_interopRequireDefault","require","_compose","_data","_undoManager","_utils","_queriedData","_entities","users","state","byId","queries","action","type","reduce","newUsers","user","id","queryID","map","currentUser","currentTheme","undefined","stylesheet","currentGlobalStylesId","themeBaseGlobalStyles","globalStyles","themeGlobalStyleVariations","variations","withMultiEntityRecordEdits","reducer","record","newState","forEach","kind","name","recordId","changes","edits","Object","entries","acc","key","value","from","to","entity","entityConfig","compose","ifMatchingAction","replaceAction","DEFAULT_ENTITY_KEY","combineReducers","queriedData","queriedDataReducer","_action$query$context","context","query","nextState","items","nextEdits","keys","_record$key$raw","fastDeepEqual","raw","persistedEdits","length","saving","pending","error","isAutosave","deleting","revisions","recordKey","fromEntries","filter","itemIds","some","itemId","Number","isInteger","entitiesConfig","rootEntitiesConfig","entities","newConfig","config","entitiesDataReducer","entitiesByKind","push","subEntities","kindReducer","newData","records","exports","undoManager","createUndoManager","editsReference","embedPreviews","url","preview","userPermissions","isAllowed","permissions","autosaves","postId","autosavesData","blockPatterns","patterns","blockPatternCategories","categories","userPatternCategories","patternCategories","navigationFallbackId","fallbackId","themeGlobalStyleRevisions","currentId","defaultTemplates","JSON","stringify","templateId","registeredPostMeta","postType","_default","default"],"sources":["@wordpress/core-data/src/reducer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { combineReducers } from '@wordpress/data';\nimport { createUndoManager } from '@wordpress/undo-manager';\n\n/**\n * Internal dependencies\n */\nimport { ifMatchingAction, replaceAction } from './utils';\nimport { reducer as queriedDataReducer } from './queried-data';\nimport { rootEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\n\n/** @typedef {import('./types').AnyFunction} AnyFunction */\n\n/**\n * Reducer managing authors state. Keyed by id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function users( state = { byId: {}, queries: {} }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_QUERY':\n\t\t\treturn {\n\t\t\t\tbyId: {\n\t\t\t\t\t...state.byId,\n\t\t\t\t\t// Key users by their ID.\n\t\t\t\t\t...action.users.reduce(\n\t\t\t\t\t\t( newUsers, user ) => ( {\n\t\t\t\t\t\t\t...newUsers,\n\t\t\t\t\t\t\t[ user.id ]: user,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t{}\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\tqueries: {\n\t\t\t\t\t...state.queries,\n\t\t\t\t\t[ action.queryID ]: action.users.map( ( user ) => user.id ),\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing current user state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function currentUser( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_USER':\n\t\t\treturn action.currentUser;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current theme.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentTheme( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_THEME':\n\t\t\treturn action.currentTheme.stylesheet;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current global styles id.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentGlobalStylesId( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_GLOBAL_STYLES_ID':\n\t\t\treturn action.id;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme base global styles.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeBaseGlobalStyles( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLES':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.globalStyles,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles variations.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleVariations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.variations,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nconst withMultiEntityRecordEdits = ( reducer ) => ( state, action ) => {\n\tif ( action.type === 'UNDO' || action.type === 'REDO' ) {\n\t\tconst { record } = action;\n\n\t\tlet newState = state;\n\t\trecord.forEach( ( { id: { kind, name, recordId }, changes } ) => {\n\t\t\tnewState = reducer( newState, {\n\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\tedits: Object.entries( changes ).reduce(\n\t\t\t\t\t( acc, [ key, value ] ) => {\n\t\t\t\t\t\tacc[ key ] =\n\t\t\t\t\t\t\taction.type === 'UNDO' ? value.from : value.to;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t),\n\t\t\t} );\n\t\t} );\n\t\treturn newState;\n\t}\n\n\treturn reducer( state, action );\n};\n\n/**\n * Higher Order Reducer for a given entity config. It supports:\n *\n * - Fetching\n * - Editing\n * - Saving\n *\n * @param {Object} entityConfig Entity config.\n *\n * @return {AnyFunction} Reducer.\n */\nfunction entity( entityConfig ) {\n\treturn compose( [\n\t\twithMultiEntityRecordEdits,\n\n\t\t// Limit to matching action type so we don't attempt to replace action on\n\t\t// an unhandled action.\n\t\tifMatchingAction(\n\t\t\t( action ) =>\n\t\t\t\taction.name &&\n\t\t\t\taction.kind &&\n\t\t\t\taction.name === entityConfig.name &&\n\t\t\t\taction.kind === entityConfig.kind\n\t\t),\n\n\t\t// Inject the entity config into the action.\n\t\treplaceAction( ( action ) => {\n\t\t\treturn {\n\t\t\t\tkey: entityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t...action,\n\t\t\t};\n\t\t} ),\n\t] )(\n\t\tcombineReducers( {\n\t\t\tqueriedData: queriedDataReducer,\n\t\t\tedits: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'RECEIVE_ITEMS':\n\t\t\t\t\t\tconst context = action?.query?.context ?? 'default';\n\t\t\t\t\t\tif ( context !== 'default' ) {\n\t\t\t\t\t\t\treturn state;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst nextState = { ...state };\n\n\t\t\t\t\t\tfor ( const record of action.items ) {\n\t\t\t\t\t\t\tconst recordId = record?.[ action.key ];\n\t\t\t\t\t\t\tconst edits = nextState[ recordId ];\n\t\t\t\t\t\t\tif ( ! edits ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst nextEdits = Object.keys( edits ).reduce(\n\t\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t\t// If the edited value is still different to the persisted value,\n\t\t\t\t\t\t\t\t\t// keep the edited value in edits.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t// Edits are the \"raw\" attribute values, but records may have\n\t\t\t\t\t\t\t\t\t\t// objects with more properties, so we use `get` here for the\n\t\t\t\t\t\t\t\t\t\t// comparison.\n\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\trecord[ key ]?.raw ?? record[ key ]\n\t\t\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\t\t\t// Sometimes the server alters the sent value which means\n\t\t\t\t\t\t\t\t\t\t// we need to also remove the edits before the api request.\n\t\t\t\t\t\t\t\t\t\t( ! action.persistedEdits ||\n\t\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\t\taction.persistedEdits[ key ]\n\t\t\t\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.keys( nextEdits ).length ) {\n\t\t\t\t\t\t\t\tnextState[ recordId ] = nextEdits;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete nextState[ recordId ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn nextState;\n\n\t\t\t\t\tcase 'EDIT_ENTITY_RECORD':\n\t\t\t\t\t\tconst nextEdits = {\n\t\t\t\t\t\t\t...state[ action.recordId ],\n\t\t\t\t\t\t\t...action.edits,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tObject.keys( nextEdits ).forEach( ( key ) => {\n\t\t\t\t\t\t\t// Delete cleared edits so that the properties\n\t\t\t\t\t\t\t// are not considered dirty.\n\t\t\t\t\t\t\tif ( nextEdits[ key ] === undefined ) {\n\t\t\t\t\t\t\t\tdelete nextEdits[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: nextEdits,\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tsaving: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type === 'SAVE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t\tisAutosave: action.isAutosave,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tdeleting: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type ===\n\t\t\t\t\t\t\t\t\t'DELETE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\trevisions: ( state = {}, action ) => {\n\t\t\t\t// Use the same queriedDataReducer shape for revisions.\n\t\t\t\tif ( action.type === 'RECEIVE_ITEM_REVISIONS' ) {\n\t\t\t\t\tconst recordKey = action.recordKey;\n\t\t\t\t\tdelete action.recordKey;\n\t\t\t\t\tconst newState = queriedDataReducer( state[ recordKey ], {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\ttype: 'RECEIVE_ITEMS',\n\t\t\t\t\t} );\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t[ recordKey ]: newState,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif ( action.type === 'REMOVE_ITEMS' ) {\n\t\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t\tObject.entries( state ).filter(\n\t\t\t\t\t\t\t( [ id ] ) =>\n\t\t\t\t\t\t\t\t! action.itemIds.some( ( itemId ) => {\n\t\t\t\t\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn itemId === id;\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\t\t} )\n\t);\n}\n\n/**\n * Reducer keeping track of the registered entities.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function entitiesConfig( state = rootEntitiesConfig, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_ENTITIES':\n\t\t\treturn [ ...state, ...action.entities ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the registered entities config and data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const entities = ( state = {}, action ) => {\n\tconst newConfig = entitiesConfig( state.config, action );\n\n\t// Generates a reducer for the entities nested by `kind` and `name`.\n\t// A config array with shape:\n\t// ```\n\t// [\n\t// { kind: 'taxonomy', name: 'category' },\n\t// { kind: 'taxonomy', name: 'post_tag' },\n\t// { kind: 'postType', name: 'post' },\n\t// { kind: 'postType', name: 'page' },\n\t// ]\n\t// ```\n\t// generates a reducer for state tree with shape:\n\t// ```\n\t// {\n\t// taxonomy: {\n\t// category,\n\t// post_tag,\n\t// },\n\t// postType: {\n\t// post,\n\t// page,\n\t// },\n\t// }\n\t// ```\n\tlet entitiesDataReducer = state.reducer;\n\tif ( ! entitiesDataReducer || newConfig !== state.config ) {\n\t\tconst entitiesByKind = newConfig.reduce( ( acc, record ) => {\n\t\t\tconst { kind } = record;\n\t\t\tif ( ! acc[ kind ] ) {\n\t\t\t\tacc[ kind ] = [];\n\t\t\t}\n\t\t\tacc[ kind ].push( record );\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\tentitiesDataReducer = combineReducers(\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries( entitiesByKind ).map(\n\t\t\t\t\t( [ kind, subEntities ] ) => {\n\t\t\t\t\t\tconst kindReducer = combineReducers(\n\t\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\t\tsubEntities.map( ( entityConfig ) => [\n\t\t\t\t\t\t\t\t\tentityConfig.name,\n\t\t\t\t\t\t\t\t\tentity( entityConfig ),\n\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn [ kind, kindReducer ];\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t}\n\n\tconst newData = entitiesDataReducer( state.records, action );\n\n\tif (\n\t\tnewData === state.records &&\n\t\tnewConfig === state.config &&\n\t\tentitiesDataReducer === state.reducer\n\t) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\treducer: entitiesDataReducer,\n\t\trecords: newData,\n\t\tconfig: newConfig,\n\t};\n};\n\n/**\n * @type {UndoManager}\n */\nexport function undoManager( state = createUndoManager() ) {\n\treturn state;\n}\n\nexport function editsReference( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'EDIT_ENTITY_RECORD':\n\t\tcase 'UNDO':\n\t\tcase 'REDO':\n\t\t\treturn {};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer managing embed preview data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function embedPreviews( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_EMBED_PREVIEW':\n\t\t\tconst { url, preview } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ url ]: preview,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * State which tracks whether the user can perform an action on a REST\n * resource.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function userPermissions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PERMISSION':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.key ]: action.isAllowed,\n\t\t\t};\n\t\tcase 'RECEIVE_USER_PERMISSIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.permissions,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning autosaves keyed by their parent's post id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function autosaves( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_AUTOSAVES':\n\t\t\tconst { postId, autosaves: autosavesData } = action;\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ postId ]: autosavesData,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport function blockPatterns( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERNS':\n\t\t\treturn action.patterns;\n\t}\n\n\treturn state;\n}\n\nexport function blockPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERN_CATEGORIES':\n\t\t\treturn action.categories;\n\t}\n\n\treturn state;\n}\n\nexport function userPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PATTERN_CATEGORIES':\n\t\t\treturn action.patternCategories;\n\t}\n\treturn state;\n}\n\nexport function navigationFallbackId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_NAVIGATION_FALLBACK_ID':\n\t\t\treturn action.fallbackId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles revisions.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleRevisions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.currentId ]: action.revisions,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the template lookup per query.\n *\n * @param {Record<string, string>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, string>} Updated state.\n */\nexport function defaultTemplates( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_DEFAULT_TEMPLATE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ JSON.stringify( action.query ) ]: action.templateId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning an object of registered post meta.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function registeredPostMeta( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_REGISTERED_POST_META':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.postType ]: action.registeredPostMeta,\n\t\t\t};\n\t}\n\treturn state;\n}\n\nexport default combineReducers( {\n\tusers,\n\tcurrentTheme,\n\tcurrentGlobalStylesId,\n\tcurrentUser,\n\tthemeGlobalStyleVariations,\n\tthemeBaseGlobalStyles,\n\tthemeGlobalStyleRevisions,\n\tentities,\n\teditsReference,\n\tundoManager,\n\tembedPreviews,\n\tuserPermissions,\n\tautosaves,\n\tblockPatterns,\n\tblockPatternCategories,\n\tuserPatternCategories,\n\tnavigationFallbackId,\n\tdefaultTemplates,\n\tregisteredPostMeta,\n} );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;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AAM,EAAG;EAC/D,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,sCAAsC;MAC1C,OAAO;QACN,GAAGJ,KAAK;QACR,CAAEG,MAAM,CAACuG,SAAS,GAAIvG,MAAM,CAAC4D;MAC9B,CAAC;EACH;EAEA,OAAO/D,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS2G,gBAAgBA,CAAE3G,KAAK,GAAG,CAAC,CAAC,EAAEG,MAAM,EAAG;EACtD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,0BAA0B;MAC9B,OAAO;QACN,GAAGJ,KAAK;QACR,CAAE4G,IAAI,CAACC,SAAS,CAAE1G,MAAM,CAAC6C,KAAM,CAAC,GAAI7C,MAAM,CAAC2G;MAC5C,CAAC;EACH;EAEA,OAAO9G,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS+G,kBAAkBA,CAAE/G,KAAK,GAAG,CAAC,CAAC,EAAEG,MAAM,EAAG;EACxD,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,8BAA8B;MAClC,OAAO;QACN,GAAGJ,KAAK;QACR,CAAEG,MAAM,CAAC6G,QAAQ,GAAI7G,MAAM,CAAC4G;MAC7B,CAAC;EACH;EACA,OAAO/G,KAAK;AACb;AAAC,IAAAiH,QAAA,GAAA7B,OAAA,CAAA8B,OAAA,GAEc,IAAAvE,qBAAe,EAAE;EAC/B5C,KAAK;EACLa,YAAY;EACZG,qBAAqB;EACrBJ,WAAW;EACXO,0BAA0B;EAC1BF,qBAAqB;EACrByF,yBAAyB;EACzB/B,QAAQ;EACRa,cAAc;EACdF,WAAW;EACXG,aAAa;EACbG,eAAe;EACfG,SAAS;EACTG,aAAa;EACbE,sBAAsB;EACtBE,qBAAqB;EACrBE,oBAAoB;EACpBI,gBAAgB;EAChBI;AACD,CAAE,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_es","_interopRequireDefault","require","_compose","_data","_undoManager","_utils","_queriedData","_entities","users","state","byId","queries","action","type","reduce","newUsers","user","id","queryID","map","currentUser","currentTheme","undefined","stylesheet","currentGlobalStylesId","themeBaseGlobalStyles","globalStyles","themeGlobalStyleVariations","variations","withMultiEntityRecordEdits","reducer","record","newState","forEach","kind","name","recordId","changes","edits","Object","entries","acc","key","value","from","to","entity","entityConfig","compose","ifMatchingAction","replaceAction","DEFAULT_ENTITY_KEY","combineReducers","queriedData","queriedDataReducer","_action$query$context","context","query","nextState","items","nextEdits","keys","_record$key$raw","fastDeepEqual","raw","persistedEdits","length","saving","pending","error","isAutosave","deleting","revisions","recordKey","fromEntries","filter","itemIds","some","itemId","Number","isInteger","entitiesConfig","rootEntitiesConfig","entities","newConfig","config","entitiesDataReducer","entitiesByKind","push","subEntities","kindReducer","newData","records","exports","undoManager","createUndoManager","editsReference","embedPreviews","url","preview","userPermissions","isAllowed","permissions","autosaves","postId","autosavesData","blockPatterns","patterns","blockPatternCategories","categories","userPatternCategories","patternCategories","navigationFallbackId","fallbackId","themeGlobalStyleRevisions","currentId","defaultTemplates","JSON","stringify","templateId","registeredPostMeta","postType","templateAutoDraftId","target","_default","default"],"sources":["@wordpress/core-data/src/reducer.js"],"sourcesContent":["/**\n * External dependencies\n */\nimport fastDeepEqual from 'fast-deep-equal/es6';\n\n/**\n * WordPress dependencies\n */\nimport { compose } from '@wordpress/compose';\nimport { combineReducers } from '@wordpress/data';\nimport { createUndoManager } from '@wordpress/undo-manager';\n\n/**\n * Internal dependencies\n */\nimport { ifMatchingAction, replaceAction } from './utils';\nimport { reducer as queriedDataReducer } from './queried-data';\nimport { rootEntitiesConfig, DEFAULT_ENTITY_KEY } from './entities';\n\n/** @typedef {import('./types').AnyFunction} AnyFunction */\n\n/**\n * Reducer managing authors state. Keyed by id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function users( state = { byId: {}, queries: {} }, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_QUERY':\n\t\t\treturn {\n\t\t\t\tbyId: {\n\t\t\t\t\t...state.byId,\n\t\t\t\t\t// Key users by their ID.\n\t\t\t\t\t...action.users.reduce(\n\t\t\t\t\t\t( newUsers, user ) => ( {\n\t\t\t\t\t\t\t...newUsers,\n\t\t\t\t\t\t\t[ user.id ]: user,\n\t\t\t\t\t\t} ),\n\t\t\t\t\t\t{}\n\t\t\t\t\t),\n\t\t\t\t},\n\t\t\t\tqueries: {\n\t\t\t\t\t...state.queries,\n\t\t\t\t\t[ action.queryID ]: action.users.map( ( user ) => user.id ),\n\t\t\t\t},\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing current user state.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function currentUser( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_USER':\n\t\t\treturn action.currentUser;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current theme.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentTheme( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_THEME':\n\t\t\treturn action.currentTheme.stylesheet;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the current global styles id.\n *\n * @param {string|undefined} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {string|undefined} Updated state.\n */\nexport function currentGlobalStylesId( state = undefined, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_CURRENT_GLOBAL_STYLES_ID':\n\t\t\treturn action.id;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme base global styles.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeBaseGlobalStyles( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLES':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.globalStyles,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles variations.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleVariations( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_VARIATIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.stylesheet ]: action.variations,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nconst withMultiEntityRecordEdits = ( reducer ) => ( state, action ) => {\n\tif ( action.type === 'UNDO' || action.type === 'REDO' ) {\n\t\tconst { record } = action;\n\n\t\tlet newState = state;\n\t\trecord.forEach( ( { id: { kind, name, recordId }, changes } ) => {\n\t\t\tnewState = reducer( newState, {\n\t\t\t\ttype: 'EDIT_ENTITY_RECORD',\n\t\t\t\tkind,\n\t\t\t\tname,\n\t\t\t\trecordId,\n\t\t\t\tedits: Object.entries( changes ).reduce(\n\t\t\t\t\t( acc, [ key, value ] ) => {\n\t\t\t\t\t\tacc[ key ] =\n\t\t\t\t\t\t\taction.type === 'UNDO' ? value.from : value.to;\n\t\t\t\t\t\treturn acc;\n\t\t\t\t\t},\n\t\t\t\t\t{}\n\t\t\t\t),\n\t\t\t} );\n\t\t} );\n\t\treturn newState;\n\t}\n\n\treturn reducer( state, action );\n};\n\n/**\n * Higher Order Reducer for a given entity config. It supports:\n *\n * - Fetching\n * - Editing\n * - Saving\n *\n * @param {Object} entityConfig Entity config.\n *\n * @return {AnyFunction} Reducer.\n */\nfunction entity( entityConfig ) {\n\treturn compose( [\n\t\twithMultiEntityRecordEdits,\n\n\t\t// Limit to matching action type so we don't attempt to replace action on\n\t\t// an unhandled action.\n\t\tifMatchingAction(\n\t\t\t( action ) =>\n\t\t\t\taction.name &&\n\t\t\t\taction.kind &&\n\t\t\t\taction.name === entityConfig.name &&\n\t\t\t\taction.kind === entityConfig.kind\n\t\t),\n\n\t\t// Inject the entity config into the action.\n\t\treplaceAction( ( action ) => {\n\t\t\treturn {\n\t\t\t\tkey: entityConfig.key || DEFAULT_ENTITY_KEY,\n\t\t\t\t...action,\n\t\t\t};\n\t\t} ),\n\t] )(\n\t\tcombineReducers( {\n\t\t\tqueriedData: queriedDataReducer,\n\t\t\tedits: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'RECEIVE_ITEMS':\n\t\t\t\t\t\tconst context = action?.query?.context ?? 'default';\n\t\t\t\t\t\tif ( context !== 'default' ) {\n\t\t\t\t\t\t\treturn state;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst nextState = { ...state };\n\n\t\t\t\t\t\tfor ( const record of action.items ) {\n\t\t\t\t\t\t\tconst recordId = record?.[ action.key ];\n\t\t\t\t\t\t\tconst edits = nextState[ recordId ];\n\t\t\t\t\t\t\tif ( ! edits ) {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst nextEdits = Object.keys( edits ).reduce(\n\t\t\t\t\t\t\t\t( acc, key ) => {\n\t\t\t\t\t\t\t\t\t// If the edited value is still different to the persisted value,\n\t\t\t\t\t\t\t\t\t// keep the edited value in edits.\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\t// Edits are the \"raw\" attribute values, but records may have\n\t\t\t\t\t\t\t\t\t\t// objects with more properties, so we use `get` here for the\n\t\t\t\t\t\t\t\t\t\t// comparison.\n\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\trecord[ key ]?.raw ?? record[ key ]\n\t\t\t\t\t\t\t\t\t\t) &&\n\t\t\t\t\t\t\t\t\t\t// Sometimes the server alters the sent value which means\n\t\t\t\t\t\t\t\t\t\t// we need to also remove the edits before the api request.\n\t\t\t\t\t\t\t\t\t\t( ! action.persistedEdits ||\n\t\t\t\t\t\t\t\t\t\t\t! fastDeepEqual(\n\t\t\t\t\t\t\t\t\t\t\t\tedits[ key ],\n\t\t\t\t\t\t\t\t\t\t\t\taction.persistedEdits[ key ]\n\t\t\t\t\t\t\t\t\t\t\t) )\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tacc[ key ] = edits[ key ];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn acc;\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t{}\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\tif ( Object.keys( nextEdits ).length ) {\n\t\t\t\t\t\t\t\tnextState[ recordId ] = nextEdits;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdelete nextState[ recordId ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn nextState;\n\n\t\t\t\t\tcase 'EDIT_ENTITY_RECORD':\n\t\t\t\t\t\tconst nextEdits = {\n\t\t\t\t\t\t\t...state[ action.recordId ],\n\t\t\t\t\t\t\t...action.edits,\n\t\t\t\t\t\t};\n\t\t\t\t\t\tObject.keys( nextEdits ).forEach( ( key ) => {\n\t\t\t\t\t\t\t// Delete cleared edits so that the properties\n\t\t\t\t\t\t\t// are not considered dirty.\n\t\t\t\t\t\t\tif ( nextEdits[ key ] === undefined ) {\n\t\t\t\t\t\t\t\tdelete nextEdits[ key ];\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} );\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: nextEdits,\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tsaving: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'SAVE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type === 'SAVE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t\tisAutosave: action.isAutosave,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\tdeleting: ( state = {}, action ) => {\n\t\t\t\tswitch ( action.type ) {\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_START':\n\t\t\t\t\tcase 'DELETE_ENTITY_RECORD_FINISH':\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t...state,\n\t\t\t\t\t\t\t[ action.recordId ]: {\n\t\t\t\t\t\t\t\tpending:\n\t\t\t\t\t\t\t\t\taction.type ===\n\t\t\t\t\t\t\t\t\t'DELETE_ENTITY_RECORD_START',\n\t\t\t\t\t\t\t\terror: action.error,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\n\t\t\trevisions: ( state = {}, action ) => {\n\t\t\t\t// Use the same queriedDataReducer shape for revisions.\n\t\t\t\tif ( action.type === 'RECEIVE_ITEM_REVISIONS' ) {\n\t\t\t\t\tconst recordKey = action.recordKey;\n\t\t\t\t\tdelete action.recordKey;\n\t\t\t\t\tconst newState = queriedDataReducer( state[ recordKey ], {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\ttype: 'RECEIVE_ITEMS',\n\t\t\t\t\t} );\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...state,\n\t\t\t\t\t\t[ recordKey ]: newState,\n\t\t\t\t\t};\n\t\t\t\t}\n\n\t\t\t\tif ( action.type === 'REMOVE_ITEMS' ) {\n\t\t\t\t\treturn Object.fromEntries(\n\t\t\t\t\t\tObject.entries( state ).filter(\n\t\t\t\t\t\t\t( [ id ] ) =>\n\t\t\t\t\t\t\t\t! action.itemIds.some( ( itemId ) => {\n\t\t\t\t\t\t\t\t\tif ( Number.isInteger( itemId ) ) {\n\t\t\t\t\t\t\t\t\t\treturn itemId === +id;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\treturn itemId === id;\n\t\t\t\t\t\t\t\t} )\n\t\t\t\t\t\t)\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\treturn state;\n\t\t\t},\n\t\t} )\n\t);\n}\n\n/**\n * Reducer keeping track of the registered entities.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function entitiesConfig( state = rootEntitiesConfig, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'ADD_ENTITIES':\n\t\t\treturn [ ...state, ...action.entities ];\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer keeping track of the registered entities config and data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport const entities = ( state = {}, action ) => {\n\tconst newConfig = entitiesConfig( state.config, action );\n\n\t// Generates a reducer for the entities nested by `kind` and `name`.\n\t// A config array with shape:\n\t// ```\n\t// [\n\t// { kind: 'taxonomy', name: 'category' },\n\t// { kind: 'taxonomy', name: 'post_tag' },\n\t// { kind: 'postType', name: 'post' },\n\t// { kind: 'postType', name: 'page' },\n\t// ]\n\t// ```\n\t// generates a reducer for state tree with shape:\n\t// ```\n\t// {\n\t// taxonomy: {\n\t// category,\n\t// post_tag,\n\t// },\n\t// postType: {\n\t// post,\n\t// page,\n\t// },\n\t// }\n\t// ```\n\tlet entitiesDataReducer = state.reducer;\n\tif ( ! entitiesDataReducer || newConfig !== state.config ) {\n\t\tconst entitiesByKind = newConfig.reduce( ( acc, record ) => {\n\t\t\tconst { kind } = record;\n\t\t\tif ( ! acc[ kind ] ) {\n\t\t\t\tacc[ kind ] = [];\n\t\t\t}\n\t\t\tacc[ kind ].push( record );\n\t\t\treturn acc;\n\t\t}, {} );\n\n\t\tentitiesDataReducer = combineReducers(\n\t\t\tObject.fromEntries(\n\t\t\t\tObject.entries( entitiesByKind ).map(\n\t\t\t\t\t( [ kind, subEntities ] ) => {\n\t\t\t\t\t\tconst kindReducer = combineReducers(\n\t\t\t\t\t\t\tObject.fromEntries(\n\t\t\t\t\t\t\t\tsubEntities.map( ( entityConfig ) => [\n\t\t\t\t\t\t\t\t\tentityConfig.name,\n\t\t\t\t\t\t\t\t\tentity( entityConfig ),\n\t\t\t\t\t\t\t\t] )\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\treturn [ kind, kindReducer ];\n\t\t\t\t\t}\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t}\n\n\tconst newData = entitiesDataReducer( state.records, action );\n\n\tif (\n\t\tnewData === state.records &&\n\t\tnewConfig === state.config &&\n\t\tentitiesDataReducer === state.reducer\n\t) {\n\t\treturn state;\n\t}\n\n\treturn {\n\t\treducer: entitiesDataReducer,\n\t\trecords: newData,\n\t\tconfig: newConfig,\n\t};\n};\n\n/**\n * @type {UndoManager}\n */\nexport function undoManager( state = createUndoManager() ) {\n\treturn state;\n}\n\nexport function editsReference( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'EDIT_ENTITY_RECORD':\n\t\tcase 'UNDO':\n\t\tcase 'REDO':\n\t\t\treturn {};\n\t}\n\treturn state;\n}\n\n/**\n * Reducer managing embed preview data.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function embedPreviews( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_EMBED_PREVIEW':\n\t\t\tconst { url, preview } = action;\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ url ]: preview,\n\t\t\t};\n\t}\n\treturn state;\n}\n\n/**\n * State which tracks whether the user can perform an action on a REST\n * resource.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function userPermissions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PERMISSION':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.key ]: action.isAllowed,\n\t\t\t};\n\t\tcase 'RECEIVE_USER_PERMISSIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t...action.permissions,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning autosaves keyed by their parent's post id.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function autosaves( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_AUTOSAVES':\n\t\t\tconst { postId, autosaves: autosavesData } = action;\n\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ postId ]: autosavesData,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\nexport function blockPatterns( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERNS':\n\t\t\treturn action.patterns;\n\t}\n\n\treturn state;\n}\n\nexport function blockPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_BLOCK_PATTERN_CATEGORIES':\n\t\t\treturn action.categories;\n\t}\n\n\treturn state;\n}\n\nexport function userPatternCategories( state = [], action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_USER_PATTERN_CATEGORIES':\n\t\t\treturn action.patternCategories;\n\t}\n\treturn state;\n}\n\nexport function navigationFallbackId( state = null, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_NAVIGATION_FALLBACK_ID':\n\t\t\treturn action.fallbackId;\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the theme global styles revisions.\n *\n * @param {Record<string, object>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, object>} Updated state.\n */\nexport function themeGlobalStyleRevisions( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_THEME_GLOBAL_STYLE_REVISIONS':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.currentId ]: action.revisions,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer managing the template lookup per query.\n *\n * @param {Record<string, string>} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Record<string, string>} Updated state.\n */\nexport function defaultTemplates( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_DEFAULT_TEMPLATE':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ JSON.stringify( action.query ) ]: action.templateId,\n\t\t\t};\n\t}\n\n\treturn state;\n}\n\n/**\n * Reducer returning an object of registered post meta.\n *\n * @param {Object} state Current state.\n * @param {Object} action Dispatched action.\n *\n * @return {Object} Updated state.\n */\nexport function registeredPostMeta( state = {}, action ) {\n\tswitch ( action.type ) {\n\t\tcase 'RECEIVE_REGISTERED_POST_META':\n\t\t\treturn {\n\t\t\t\t...state,\n\t\t\t\t[ action.postType ]: action.registeredPostMeta,\n\t\t\t};\n\t}\n\treturn state;\n}\n\nexport function templateAutoDraftId( state = {}, action ) {\n\treturn action.type === 'RECEIVE_TEMPLATE_AUTO_DRAFT_ID'\n\t\t? { ...state, [ action.target ]: action.id }\n\t\t: state;\n}\n\nexport default combineReducers( {\n\tusers,\n\tcurrentTheme,\n\tcurrentGlobalStylesId,\n\tcurrentUser,\n\tthemeGlobalStyleVariations,\n\tthemeBaseGlobalStyles,\n\tthemeGlobalStyleRevisions,\n\tentities,\n\teditsReference,\n\tundoManager,\n\tembedPreviews,\n\tuserPermissions,\n\tautosaves,\n\tblockPatterns,\n\tblockPatternCategories,\n\tuserPatternCategories,\n\tnavigationFallbackId,\n\tdefaultTemplates,\n\tregisteredPostMeta,\n\ttemplateAutoDraftId,\n} );\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,IAAAA,GAAA,GAAAC,sBAAA,CAAAC,OAAA;AAKA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AAKA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,YAAA,GAAAL,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAjBA;AACA;AACA;;AAGA;AACA;AACA;;AAKA;AACA;AACA;;AAKA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASO,KAAKA,CAAEC,KAAK,GAAG;EAAEC,IAAI,EAAE,CAAC,CAAC;EAAEC,OAAO,EAAE,CAAC;AAAE,CAAC,EAAEC,MAAM,EAAG;EAClE,QAASA,MAAM,CAACC,IAAI;IACnB,KAAK,oBAAoB;MACxB,OAAO;QACNH,IAAI,EAAE;UACL,GAAGD,KAAK,CAACC,IAAI;UACb;UACA,GAAGE,MAAM,CAACJ,KAAK,CAACM,MAAM,CACrB,CAAEC,QAAQ,EAAEC,IAAI,MAAQ;YACvB,GAAGD,QAAQ;YACX,CAAEC,IAAI,CAACC,EAAE,GAAID;UACd,CAAC,CAAE,EACH,CAAC,CACF;QACD,CAAC;QACDL,OAAO,EAAE;UACR,GAAGF,KAAK,CAACE,OAAO;UAChB,CAAEC,MAAM,CAACM,OAAO,GAAIN,MAAM,CAACJ,KAAK,CAACW,GAAG,CAAIH,IAAI,IAAMA,IAAI,CAACC,EAAG;QAC3D;MACD,CAAC;EACH;EAEA,OAAOR,KAAK;AACb;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASW,WAAWA,CAAEX,KAAK,GAAG,CAAC,CAAC,EAAEG,MAAM,EAAG;EACjD,QAASA,MAAM,CAACC,IAAI;IACnB,KA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