1 line
3.1 KiB
Plaintext
1 line
3.1 KiB
Plaintext
{"version":3,"file":"app.mjs","sources":["../../../admin/src/modules/app.ts"],"sourcesContent":["import { createSlice, type PayloadAction } from '@reduxjs/toolkit';\n\nimport { GetInitData } from '../../../shared/contracts/init';\n\nimport type { ContentManagerLink } from '../hooks/useContentManagerInitData';\n\ninterface AppState {\n collectionTypeLinks: ContentManagerLink[];\n components: GetInitData.Response['data']['components'];\n fieldSizes: GetInitData.Response['data']['fieldSizes'];\n models: GetInitData.Response['data']['contentTypes'];\n singleTypeLinks: ContentManagerLink[];\n isLoading: boolean;\n}\n\nconst initialState: AppState = {\n collectionTypeLinks: [],\n components: [],\n fieldSizes: {},\n models: [],\n singleTypeLinks: [],\n isLoading: true,\n};\n\nconst appSlice = createSlice({\n name: 'app',\n initialState,\n reducers: {\n setInitialData(\n state,\n action: PayloadAction<{\n authorizedCollectionTypeLinks: AppState['collectionTypeLinks'];\n authorizedSingleTypeLinks: AppState['singleTypeLinks'];\n components: AppState['components'];\n contentTypeSchemas: AppState['models'];\n fieldSizes: AppState['fieldSizes'];\n }>\n ) {\n const {\n authorizedCollectionTypeLinks,\n authorizedSingleTypeLinks,\n components,\n contentTypeSchemas,\n fieldSizes,\n } = action.payload;\n state.collectionTypeLinks = authorizedCollectionTypeLinks.filter(\n ({ isDisplayed }) => isDisplayed\n );\n state.singleTypeLinks = authorizedSingleTypeLinks.filter(({ isDisplayed }) => isDisplayed);\n state.components = components;\n state.models = contentTypeSchemas;\n state.fieldSizes = fieldSizes;\n state.isLoading = false;\n },\n },\n});\n\nconst { actions, reducer } = appSlice;\nconst { setInitialData } = actions;\n\nexport { reducer, setInitialData };\nexport type { AppState };\n"],"names":["initialState","collectionTypeLinks","components","fieldSizes","models","singleTypeLinks","isLoading","appSlice","createSlice","name","reducers","setInitialData","state","action","authorizedCollectionTypeLinks","authorizedSingleTypeLinks","contentTypeSchemas","payload","filter","isDisplayed","actions","reducer"],"mappings":";;AAeA,MAAMA,YAAyB,GAAA;AAC7BC,IAAAA,mBAAAA,EAAqB,EAAE;AACvBC,IAAAA,UAAAA,EAAY,EAAE;AACdC,IAAAA,UAAAA,EAAY,EAAC;AACbC,IAAAA,MAAAA,EAAQ,EAAE;AACVC,IAAAA,eAAAA,EAAiB,EAAE;IACnBC,SAAW,EAAA;AACb,CAAA;AAEA,MAAMC,WAAWC,WAAY,CAAA;IAC3BC,IAAM,EAAA,KAAA;AACNT,IAAAA,YAAAA;IACAU,QAAU,EAAA;QACRC,cACEC,CAAAA,CAAAA,KAAK,EACLC,MAME,EAAA;AAEF,YAAA,MAAM,EACJC,6BAA6B,EAC7BC,yBAAyB,EACzBb,UAAU,EACVc,kBAAkB,EAClBb,UAAU,EACX,GAAGU,OAAOI,OAAO;YAClBL,KAAMX,CAAAA,mBAAmB,GAAGa,6BAA8BI,CAAAA,MAAM,CAC9D,CAAC,EAAEC,WAAW,EAAE,GAAKA,WAAAA,CAAAA;YAEvBP,KAAMP,CAAAA,eAAe,GAAGU,yBAA0BG,CAAAA,MAAM,CAAC,CAAC,EAAEC,WAAW,EAAE,GAAKA,WAAAA,CAAAA;AAC9EP,YAAAA,KAAAA,CAAMV,UAAU,GAAGA,UAAAA;AACnBU,YAAAA,KAAAA,CAAMR,MAAM,GAAGY,kBAAAA;AACfJ,YAAAA,KAAAA,CAAMT,UAAU,GAAGA,UAAAA;AACnBS,YAAAA,KAAAA,CAAMN,SAAS,GAAG,KAAA;AACpB;AACF;AACF,CAAA,CAAA;AAEA,MAAM,EAAEc,OAAO,EAAEC,OAAO,EAAE,GAAGd;AACvB,MAAA,EAAEI,cAAc,EAAE,GAAGS;;;;"} |