@beinformed/ui 1.18.3 → 1.18.6
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 +17 -0
- package/esm/constants/Constants.js +1 -0
- package/esm/constants/Constants.js.map +1 -1
- package/esm/constants/Settings.js +10 -3
- package/esm/constants/Settings.js.map +1 -1
- package/esm/hooks/useAuthentication.js +7 -50
- package/esm/hooks/useAuthentication.js.map +1 -1
- package/esm/i18n/Locales.js.map +1 -1
- package/esm/models/concepts/ConceptDetailModel.js.map +1 -1
- package/esm/models/form/FormModel.js +3 -1
- package/esm/models/form/FormModel.js.map +1 -1
- package/esm/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/esm/models/tab/TabModel.js.map +1 -1
- package/esm/modularui/Authenticate.js +100 -21
- package/esm/modularui/Authenticate.js.map +1 -1
- package/esm/redux/actions/Preferences.js +2 -2
- package/esm/redux/actions/Preferences.js.map +1 -1
- package/esm/redux/actions/SignOut.js +6 -2
- package/esm/redux/actions/SignOut.js.map +1 -1
- package/esm/redux/connectors/SignIn.js +3 -2
- package/esm/redux/connectors/SignIn.js.map +1 -1
- package/esm/redux/connectors/SignOut.js +4 -1
- package/esm/redux/connectors/SignOut.js.map +1 -1
- package/esm/redux/reducers/AuthReducer.js +0 -10
- package/esm/redux/reducers/AuthReducer.js.map +1 -1
- package/esm/redux/types.js.map +1 -1
- package/esm/utils/helpers/checkResource.js +2 -0
- package/esm/utils/helpers/checkResource.js.map +1 -1
- package/lib/constants/Constants.js +3 -1
- package/lib/constants/Constants.js.flow +1 -0
- package/lib/constants/Constants.js.map +1 -1
- package/lib/constants/LayoutHints.js.map +1 -1
- package/lib/constants/Settings.js +13 -3
- package/lib/constants/Settings.js.flow +8 -3
- package/lib/constants/Settings.js.map +1 -1
- package/lib/exceptions/FetchException.js.map +1 -1
- package/lib/hooks/__tests__/useAuthentication.spec.js.flow +15 -1
- package/lib/hooks/useAllFormsOnModel.js.map +1 -1
- package/lib/hooks/useAuthentication.js +7 -55
- package/lib/hooks/useAuthentication.js.flow +4 -37
- package/lib/hooks/useAuthentication.js.map +1 -1
- package/lib/hooks/useContent.js.map +1 -1
- package/lib/hooks/useDeepCompareEffect.js.map +1 -1
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/hooks/useI18n.js.map +1 -1
- package/lib/hooks/useModal.js.map +1 -1
- package/lib/hooks/useModelCatalog.js.map +1 -1
- package/lib/hooks/useModels.js.map +1 -1
- package/lib/hooks/useModularUI.js.map +1 -1
- package/lib/hooks/useModularUIBasic.js.map +1 -1
- package/lib/hooks/useModularUIModel.js.map +1 -1
- package/lib/hooks/useModularUIRequest.js.map +1 -1
- package/lib/hooks/useNotification.js.map +1 -1
- package/lib/hooks/usePreference.js.map +1 -1
- package/lib/hooks/useProgressIndicator.js.map +1 -1
- package/lib/hooks/useRouter.js.map +1 -1
- package/lib/i18n/Locale.js.map +1 -1
- package/lib/i18n/Locales.js.map +1 -1
- package/lib/i18n/Message.js.map +1 -1
- package/lib/i18n/withMessage.js.map +1 -1
- package/lib/models/actions/ActionModel.js.map +1 -1
- package/lib/models/application/ApplicationModel.js.map +1 -1
- package/lib/models/attributes/AttributeCollection.js.map +1 -1
- package/lib/models/attributes/AttributeContent.js.map +1 -1
- package/lib/models/attributes/AttributeDataHelper.js.map +1 -1
- package/lib/models/attributes/AttributeModel.js.map +1 -1
- package/lib/models/attributes/AttributeSetModel.js.map +1 -1
- package/lib/models/attributes/BooleanAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeModel.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionCollection.js.map +1 -1
- package/lib/models/attributes/ChoiceAttributeOptionModel.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeChildCollection.js.map +1 -1
- package/lib/models/attributes/CompositeAttributeModel.js.map +1 -1
- package/lib/models/attributes/DatetimeAttributeModel.js.map +1 -1
- package/lib/models/attributes/HelptextAttributeModel.js.map +1 -1
- package/lib/models/attributes/MemoAttributeModel.js.map +1 -1
- package/lib/models/attributes/MoneyAttributeModel.js.map +1 -1
- package/lib/models/attributes/NumberAttributeModel.js.map +1 -1
- package/lib/models/attributes/StringAttributeModel.js.map +1 -1
- package/lib/models/attributes/XMLAttributeModel.js.map +1 -1
- package/lib/models/attributes/_createAttribute.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintCollection.js.map +1 -1
- package/lib/models/attributes/input-constraints/ConstraintModel.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeDateFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/DateTimeTimeFormatConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/FileSizeConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/IBANConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberBoundaryConstraint.js.map +1 -1
- package/lib/models/attributes/input-constraints/NumberFormatConstraint.js.map +1 -1
- package/lib/models/base/BaseCollection.js.map +1 -1
- package/lib/models/base/BaseModel.js.map +1 -1
- package/lib/models/caseview/CaseViewModel.js.map +1 -1
- package/lib/models/concepts/BusinessScenarioModel.js.map +1 -1
- package/lib/models/concepts/ConceptDetailModel.js.map +1 -1
- package/lib/models/concepts/ConceptLinkModel.js.map +1 -1
- package/lib/models/concepts/SourceReferenceModel.js.map +1 -1
- package/lib/models/content/ContentLinkModel.js.map +1 -1
- package/lib/models/content/ContentTOCModel.js.map +1 -1
- package/lib/models/content/SectionModel.js.map +1 -1
- package/lib/models/content/SubSectionModel.js.map +1 -1
- package/lib/models/contentconfiguration/ContentConfigurationResults.js.map +1 -1
- package/lib/models/detail/DetailModel.js.map +1 -1
- package/lib/models/filters/BaseFilterModel.js.map +1 -1
- package/lib/models/form/FormModel.js +3 -1
- package/lib/models/form/FormModel.js.flow +1 -1
- package/lib/models/form/FormModel.js.map +1 -1
- package/lib/models/form/FormObjectModel.js.map +1 -1
- package/lib/models/href/Href.js.map +1 -1
- package/lib/models/layouthint/LayoutHintCollection.js.map +1 -1
- package/lib/models/links/LinkCollection.js.map +1 -1
- package/lib/models/links/LinkModel.js.map +1 -1
- package/lib/models/list/ListDetailModel.js.map +1 -1
- package/lib/models/list/ListHeaderModel.js.map +1 -1
- package/lib/models/list/ListItemCollection.js.map +1 -1
- package/lib/models/list/ListModel.js.map +1 -1
- package/lib/models/lookup/LookupOptionsModel.js.map +1 -1
- package/lib/models/paging/PagingModel.js.map +1 -1
- package/lib/models/panels/GroupingPanelModel.js.map +1 -1
- package/lib/models/parameter/Parameter.js.map +1 -1
- package/lib/models/process/ProcessStatusSettingsModel.js.map +1 -1
- package/lib/models/resolveModel.js.map +1 -1
- package/lib/models/sorting/SortingModel.js.map +1 -1
- package/lib/models/tab/TabModel.js.map +1 -1
- package/lib/models/user/UserProfileModel.js.map +1 -1
- package/lib/models/user/UserServicesModel.js.map +1 -1
- package/lib/modularui/Authenticate.js +102 -21
- package/lib/modularui/Authenticate.js.flow +75 -20
- package/lib/modularui/Authenticate.js.map +1 -1
- package/lib/modularui/ModularUIRequest.js.map +1 -1
- package/lib/modularui/ModularUIResponse.js.map +1 -1
- package/lib/react/ErrorBoundaryFallback.js.map +1 -1
- package/lib/react-client/client.js.map +1 -1
- package/lib/react-client/rehydrate.js.map +1 -1
- package/lib/react-server/__tests__/serverUtil.spec.js.flow +6 -4
- package/lib/react-server/createSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRComplete.js.map +1 -1
- package/lib/react-server/renderSSRMinimal.js.map +1 -1
- package/lib/react-server/serverNoSSR.js.map +1 -1
- package/lib/react-server/serverSSR.js.map +1 -1
- package/lib/react-server/serverUtil.js.map +1 -1
- package/lib/react-theme/ThemeProvider.js.map +1 -1
- package/lib/react-theme/createTheme.js.map +1 -1
- package/lib/react-theme/useTheme.js.map +1 -1
- package/lib/react-theme/utils/background.js.map +1 -1
- package/lib/react-theme/utils/colors.js.map +1 -1
- package/lib/react-theme/utils/contrast.js.map +1 -1
- package/lib/react-theme/utils/corners.js.map +1 -1
- package/lib/react-theme/utils/spacers.js.map +1 -1
- package/lib/react-theme/utils/themeProps.js.map +1 -1
- package/lib/redux/_i18n/actions.js.map +1 -1
- package/lib/redux/_i18n/reducer.js.map +1 -1
- package/lib/redux/_modularui/actions.js.map +1 -1
- package/lib/redux/_modularui/connector.js.map +1 -1
- package/lib/redux/_modularui/middleware.js.map +1 -1
- package/lib/redux/_modularui/modularuiUtils.js.map +1 -1
- package/lib/redux/_modularui/reducer.js.map +1 -1
- package/lib/redux/_modularui/selectors.js.map +1 -1
- package/lib/redux/_modularui/withModularUI.js.map +1 -1
- package/lib/redux/_router/connectors.js.map +1 -1
- package/lib/redux/actions/Application.js.map +1 -1
- package/lib/redux/actions/Authorization.js.map +1 -1
- package/lib/redux/actions/Error.js.map +1 -1
- package/lib/redux/actions/Form.js.map +1 -1
- package/lib/redux/actions/FormAttributeSet.js.map +1 -1
- package/lib/redux/actions/FormAttributeSetRepeatable.js.map +1 -1
- package/lib/redux/actions/FormAutosave.js.map +1 -1
- package/lib/redux/actions/FormAutosubmit.js.map +1 -1
- package/lib/redux/actions/FormValidations.js.map +1 -1
- package/lib/redux/actions/Notification.js.map +1 -1
- package/lib/redux/actions/Preferences.js +1 -1
- package/lib/redux/actions/Preferences.js.flow +7 -3
- package/lib/redux/actions/Preferences.js.map +1 -1
- package/lib/redux/actions/SignIn.js.map +1 -1
- package/lib/redux/actions/SignOut.js +6 -1
- package/lib/redux/actions/SignOut.js.flow +9 -5
- package/lib/redux/actions/SignOut.js.map +1 -1
- package/lib/redux/connectors/Application.js.map +1 -1
- package/lib/redux/connectors/Breadcrumb.js.map +1 -1
- package/lib/redux/connectors/CaseView.js.map +1 -1
- package/lib/redux/connectors/ConceptDetail.js.map +1 -1
- package/lib/redux/connectors/ContentBrowser.js.map +1 -1
- package/lib/redux/connectors/ContentDetail.js.map +1 -1
- package/lib/redux/connectors/ContentDetailSection.js.map +1 -1
- package/lib/redux/connectors/Form.js.map +1 -1
- package/lib/redux/connectors/FormAttributeSet.js.map +1 -1
- package/lib/redux/connectors/ListDetail.js.map +1 -1
- package/lib/redux/connectors/Modal.js.map +1 -1
- package/lib/redux/connectors/ModelCatalog.js.map +1 -1
- package/lib/redux/connectors/Notification.js.map +1 -1
- package/lib/redux/connectors/PanelRenderer.js.map +1 -1
- package/lib/redux/connectors/Preferences.js.map +1 -1
- package/lib/redux/connectors/Progress.js.map +1 -1
- package/lib/redux/connectors/ProgressIndicator.js.map +1 -1
- package/lib/redux/connectors/QuickSearch.js.map +1 -1
- package/lib/redux/connectors/SignIn.js +3 -5
- package/lib/redux/connectors/SignIn.js.flow +1 -6
- package/lib/redux/connectors/SignIn.js.map +1 -1
- package/lib/redux/connectors/SignOut.js +5 -1
- package/lib/redux/connectors/SignOut.js.flow +2 -1
- package/lib/redux/connectors/SignOut.js.map +1 -1
- package/lib/redux/connectors/Tab.js.map +1 -1
- package/lib/redux/reducers/AuthReducer.js +0 -11
- package/lib/redux/reducers/AuthReducer.js.flow +0 -11
- package/lib/redux/reducers/AuthReducer.js.map +1 -1
- package/lib/redux/reducers/__tests__/AuthReducer.spec.js.flow +0 -9
- package/lib/redux/store/configureStore.js.map +1 -1
- package/lib/redux/types.js.flow +0 -1
- package/lib/redux/types.js.map +1 -1
- package/lib/utils/browser/Cookies.js.map +1 -1
- package/lib/utils/datetime/DateTimeUtil.js.map +1 -1
- package/lib/utils/fetch/universalFetch.js.map +1 -1
- package/lib/utils/fetch/xhr.js.map +1 -1
- package/lib/utils/helpers/checkResource.js +2 -0
- package/lib/utils/helpers/checkResource.js.flow +3 -0
- package/lib/utils/helpers/checkResource.js.map +1 -1
- package/lib/utils/helpers/objects.js.map +1 -1
- package/lib/utils/helpers/sanitizeHtml.js.map +1 -1
- package/lib/utils/helpers/text.js.map +1 -1
- package/lib/utils/number/formatValue.js.map +1 -1
- package/lib/utils/number/parseNumbers.js.map +1 -1
- package/package.json +22 -22
- package/src/constants/Constants.js +1 -0
- package/src/constants/Settings.js +8 -3
- package/src/hooks/__tests__/useAuthentication.spec.js +15 -1
- package/src/hooks/useAuthentication.js +4 -37
- package/src/models/form/FormModel.js +1 -1
- package/src/modularui/Authenticate.js +75 -20
- package/src/react-server/__tests__/serverUtil.spec.js +6 -4
- package/src/redux/actions/Preferences.js +7 -3
- package/src/redux/actions/SignOut.js +9 -5
- package/src/redux/connectors/SignIn.js +1 -6
- package/src/redux/connectors/SignOut.js +2 -1
- package/src/redux/reducers/AuthReducer.js +0 -11
- package/src/redux/reducers/__tests__/AuthReducer.spec.js +0 -9
- package/src/redux/types.js +0 -1
- package/src/utils/helpers/checkResource.js +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rehydrate.js","names":["recreateModel","data","modelData","ModularUIResponse","rehydrate","Model","model","childModels","childModel","addChildModels","isModularUIModelData","rehydratedValue","stateKey","stateValue","Array","isArray","stateItem","locales","Locales","locale","noFurtherRehydration","state","mappedState","forEach"],"sources":["../../src/react-client/rehydrate.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\nimport Locales from \"../i18n/Locales\";\n\nimport resolveModel from \"../models/resolveModel\";\n\nimport ModularUIResponse from \"../modularui/ModularUIResponse\";\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: Object) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n model.rehydrate(data);\n\n const childModels = data.childModels.map((childModel) =>\n recreateModel(childModel)\n );\n\n model.addChildModels(childModels);\n\n return model;\n }\n\n return data;\n};\n\n/**\n */\nconst isModularUIModelData = (data: any) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\");\n\n/**\n */\nconst rehydratedValue = (stateKey, stateValue) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem)); // NOSONAR\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\"preferences\", \"router\", \"progressindicator\"];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue); // NOSONAR\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nconst rehydrate = (state: Object): { ... } => {\n const mappedState = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n\nexport default rehydrate;\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,IAAD,EAAkB;EACtC,IAAMC,SAAS,GAAGC,
|
|
1
|
+
{"version":3,"file":"rehydrate.js","names":["recreateModel","data","modelData","ModularUIResponse","rehydrate","Model","resolveModel","model","childModels","childModel","addChildModels","isModularUIModelData","has","rehydratedValue","stateKey","stateValue","Array","isArray","stateItem","locales","Locales","locale","noFurtherRehydration","state","mappedState","forEach"],"sources":["../../src/react-client/rehydrate.js"],"sourcesContent":["// @flow\nimport { has } from \"../utils/helpers/objects\";\nimport Locales from \"../i18n/Locales\";\n\nimport resolveModel from \"../models/resolveModel\";\n\nimport ModularUIResponse from \"../modularui/ModularUIResponse\";\n\n/**\n * Recreate a model from dehydrated data obtained after a server render.\n */\nconst recreateModel = (data: Object) => {\n const modelData = ModularUIResponse.rehydrate(data);\n\n const Model = resolveModel(modelData);\n\n if (Model) {\n const model = new Model(modelData);\n model.rehydrate(data);\n\n const childModels = data.childModels.map((childModel) =>\n recreateModel(childModel)\n );\n\n model.addChildModels(childModels);\n\n return model;\n }\n\n return data;\n};\n\n/**\n */\nconst isModularUIModelData = (data: any) =>\n data != null &&\n typeof data === \"object\" &&\n has(data, \"data\") &&\n has(data, \"contributions\");\n\n/**\n */\nconst rehydratedValue = (stateKey, stateValue) => {\n if (Array.isArray(stateValue)) {\n return stateValue.map((stateItem) => rehydrate(stateItem)); // NOSONAR\n }\n\n if (isModularUIModelData(stateValue)) {\n return recreateModel(stateValue);\n }\n\n if (\n stateKey === \"i18n\" &&\n has(stateValue, \"locales\") &&\n has(stateValue, \"locale\")\n ) {\n return {\n locales: Locales.rehydrate(stateValue.locales),\n locale: stateValue?.locale,\n };\n }\n\n const noFurtherRehydration = [\"preferences\", \"router\", \"progressindicator\"];\n if (noFurtherRehydration.includes(stateKey)) {\n return stateValue;\n }\n\n if (stateValue !== null && typeof stateValue === \"object\") {\n return rehydrate(stateValue); // NOSONAR\n }\n\n return stateValue;\n};\n\n/**\n * Maps dehydrated state to models that can be used to rehydrated the application.\n */\nconst rehydrate = (state: Object): { ... } => {\n const mappedState = {};\n\n Object.keys(state).forEach((stateKey) => {\n const stateValue = state[stateKey];\n mappedState[stateKey] = rehydratedValue(stateKey, stateValue);\n });\n\n return mappedState;\n};\n\nexport default rehydrate;\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;AAEA;AACA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,IAAD,EAAkB;EACtC,IAAMC,SAAS,GAAGC,0BAAA,CAAkBC,SAAlB,CAA4BH,IAA5B,CAAlB;;EAEA,IAAMI,KAAK,GAAG,IAAAC,qBAAA,EAAaJ,SAAb,CAAd;;EAEA,IAAIG,KAAJ,EAAW;IAAA;;IACT,IAAME,KAAK,GAAG,IAAIF,KAAJ,CAAUH,SAAV,CAAd;IACAK,KAAK,CAACH,SAAN,CAAgBH,IAAhB;IAEA,IAAMO,WAAW,GAAG,6BAAAP,IAAI,CAACO,WAAL,iBAAqB,UAACC,UAAD;MAAA,OAC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;IAC3C,OAAOC,UAAP;EACD;;EAED,IAAIA,UAAU,KAAK,IAAf,IAAuB,sBAAOA,UAAP,MAAsB,QAAjD,EAA2D;IACzD,OAAOX,SAAS,CAACW,UAAD,CAAhB,CADyD,CAC3B;EAC/B;;EAED,OAAOA,UAAP;AACD,CA9BD;AAgCA;AACA;AACA;;;AACA,IAAMX,SAAS,GAAG,SAAZA,SAAY,CAACmB,KAAD,EAA4B;EAC5C,IAAMC,WAAW,GAAG,EAApB;EAEA,mBAAYD,KAAZ,EAAmBE,OAAnB,CAA2B,UAACX,QAAD,EAAc;IACvC,IAAMC,UAAU,GAAGQ,KAAK,CAACT,QAAD,CAAxB;IACAU,WAAW,CAACV,QAAD,CAAX,GAAwBD,eAAe,CAACC,QAAD,EAAWC,UAAX,CAAvC;EACD,CAHD;EAKA,OAAOS,WAAP;AACD,CATD;;eAWepB,S"}
|
|
@@ -112,10 +112,11 @@ describe("serverUtil", () => {
|
|
|
112
112
|
{
|
|
113
113
|
type: "SET_PREFERENCES",
|
|
114
114
|
payload: {
|
|
115
|
-
"FormClient.login_url": "/
|
|
116
|
-
"FormClient.logout_url": "/
|
|
115
|
+
"FormClient.login_url": "/j_security_check",
|
|
116
|
+
"FormClient.logout_url": "/Logoff",
|
|
117
117
|
"FormClient.password_field_name": "j_password",
|
|
118
118
|
"FormClient.username_field_name": "j_username",
|
|
119
|
+
"security.clients": null,
|
|
119
120
|
},
|
|
120
121
|
},
|
|
121
122
|
]);
|
|
@@ -158,10 +159,11 @@ describe("serverUtil", () => {
|
|
|
158
159
|
{
|
|
159
160
|
type: "SET_PREFERENCES",
|
|
160
161
|
payload: {
|
|
161
|
-
"FormClient.login_url": "/
|
|
162
|
-
"FormClient.logout_url": "/
|
|
162
|
+
"FormClient.login_url": "/j_security_check",
|
|
163
|
+
"FormClient.logout_url": "/Logoff",
|
|
163
164
|
"FormClient.password_field_name": "j_password",
|
|
164
165
|
"FormClient.username_field_name": "j_username",
|
|
166
|
+
"security.clients": null,
|
|
165
167
|
},
|
|
166
168
|
},
|
|
167
169
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSSRComplete.js","names":["noLoading","state","modularui","key","status","MODULARUI_STATUS","LOADING","length","loadingCounter","createSSRComplete","store","render","loadingCount","getState","html","resolve","reject","unsubscribe","subscribe","previousCount","error"],"sources":["../../src/react-server/createSSRComplete.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../constants/Constants\";\n\nimport type { ReduxStore } from \"../redux/types\";\n\n/**\n */\nconst noLoading = (state) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING\n ).length === 0;\n\n/**\n */\nconst loadingCounter = (state) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING\n ).length;\n\n/**\n */\nconst createSSRComplete = (\n store: ReduxStore,\n render: Function\n): Promise<string> => {\n let loadingCount = loadingCounter(store.getState());\n let html = \"<div>Nothing to render</div>\";\n\n return new Promise((resolve, reject) => {\n const unsubscribe = store.subscribe(() => {\n const previousCount = loadingCount;\n loadingCount = loadingCounter(store.getState());\n\n if (previousCount !== loadingCount && noLoading(store.getState())) {\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n }\n });\n\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n });\n};\n\nexport default createSSRComplete;\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAIA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;EAAA;;EAAA,OAChB,mDAAYA,KAAK,CAACC,SAAlB,kBACE,UAACC,GAAD;IAAA,OAASF,KAAK,CAACC,SAAN,CAAgBC,GAAhB,EAAqBC,MAArB,KAAgCC,
|
|
1
|
+
{"version":3,"file":"createSSRComplete.js","names":["noLoading","state","modularui","key","status","MODULARUI_STATUS","LOADING","length","loadingCounter","createSSRComplete","store","render","loadingCount","getState","html","resolve","reject","unsubscribe","subscribe","previousCount","error"],"sources":["../../src/react-server/createSSRComplete.js"],"sourcesContent":["// @flow\nimport { MODULARUI_STATUS } from \"../constants/Constants\";\n\nimport type { ReduxStore } from \"../redux/types\";\n\n/**\n */\nconst noLoading = (state) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING\n ).length === 0;\n\n/**\n */\nconst loadingCounter = (state) =>\n Object.keys(state.modularui).filter(\n (key) => state.modularui[key].status === MODULARUI_STATUS.LOADING\n ).length;\n\n/**\n */\nconst createSSRComplete = (\n store: ReduxStore,\n render: Function\n): Promise<string> => {\n let loadingCount = loadingCounter(store.getState());\n let html = \"<div>Nothing to render</div>\";\n\n return new Promise((resolve, reject) => {\n const unsubscribe = store.subscribe(() => {\n const previousCount = loadingCount;\n loadingCount = loadingCounter(store.getState());\n\n if (previousCount !== loadingCount && noLoading(store.getState())) {\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n }\n });\n\n try {\n html = render();\n } catch (error) {\n reject(error);\n return;\n }\n\n if (noLoading(store.getState())) {\n unsubscribe();\n resolve(html);\n }\n });\n};\n\nexport default createSSRComplete;\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAIA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAACC,KAAD;EAAA;;EAAA,OAChB,mDAAYA,KAAK,CAACC,SAAlB,kBACE,UAACC,GAAD;IAAA,OAASF,KAAK,CAACC,SAAN,CAAgBC,GAAhB,EAAqBC,MAArB,KAAgCC,2BAAA,CAAiBC,OAA1D;EAAA,CADF,EAEEC,MAFF,KAEa,CAHG;AAAA,CAAlB;AAKA;AACA;;;AACA,IAAMC,cAAc,GAAG,SAAjBA,cAAiB,CAACP,KAAD;EAAA;;EAAA,OAC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@
|
|
|
1
|
-
{"version":3,"file":"renderSSRComplete.js","names":["renderSSRComplete","store","theme","UUID","requestHref","render","ErrorPage","template","htmlpage","helmetContext","routerContext","sheet","ServerStyleSheet","location","toLocation","instance","BASE","then","appHTML","head","contextPath","html","state","catch","error","message","fileName","lineNumber","stack","helmet"],"sources":["../../src/react-server/renderSSRComplete.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { StaticRouter as Router } from \"react-router\";\n\nimport { HelmetProvider } from \"react-helmet-async\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport createSSRComplete from \"./createSSRComplete\";\nimport htmlpage from \"./htmlpage\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport { createHead, handleErrors, dehydrate } from \"./serverUtil\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { Location } from \"react-router\";\n\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n requestHref: Href,\n render: Function,\n ErrorPage: any,\n template?: (TemplateProps) => string,\n};\n/**\n */\nconst renderSSRComplete = ({\n store,\n theme = {},\n UUID = \"\",\n requestHref,\n render,\n ErrorPage,\n template = htmlpage,\n}: Props): Promise<string> => {\n const helmetContext = {};\n const routerContext = {};\n\n const sheet = new ServerStyleSheet();\n\n // $FlowFixMe[incompatible-type]\n // $FlowFixMe[prop-missing]\n const location: Location = requestHref.toLocation();\n\n return createSSRComplete(store, () =>\n renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <HelmetProvider context={helmetContext}>\n <ErrorBoundary>\n <Router\n basename={BASE}\n location={location}\n context={routerContext}\n >\n {render()}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </StyleSheetManager>\n </Provider>\n )\n )\n .then((appHTML) => {\n handleErrors(store);\n const head = createHead(sheet, UUID, helmetContext);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n })\n .catch((error) =>\n template({\n contextPath: BASE,\n html: renderToString(\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <ErrorPage\n errorMessage={error.message}\n errorResource={error.fileName}\n errorLine={error.lineNumber}\n errorStack={error.stack}\n />\n </ThemeProvider>\n </StyleSheetManager>\n ),\n head: helmetContext.helmet,\n state: \"\",\n UUID,\n })\n );\n};\n\nexport default renderSSRComplete;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;;;AAiBA;AACA;AACA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,OAQI;EAAA,IAP5BC,KAO4B,QAP5BA,KAO4B;EAAA,sBAN5BC,KAM4B;EAAA,IAN5BA,KAM4B,2BANpB,EAMoB;EAAA,qBAL5BC,IAK4B;EAAA,IAL5BA,IAK4B,0BALrB,EAKqB;EAAA,IAJ5BC,WAI4B,QAJ5BA,WAI4B;EAAA,IAH5BC,MAG4B,QAH5BA,MAG4B;EAAA,IAF5BC,SAE4B,QAF5BA,SAE4B;EAAA,yBAD5BC,QAC4B;EAAA,IAD5BA,QAC4B,8BADjBC,iBACiB;EAC5B,IAAMC,aAAa,GAAG,EAAtB;EACA,IAAMC,aAAa,GAAG,EAAtB;EAEA,IAAMC,KAAK,GAAG,IAAIC,kCAAJ,EAAd,CAJ4B,CAM5B;EACA;;EACA,IAAMC,QAAkB,GAAGT,WAAW,CAACU,UAAZ,EAA3B;EAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"renderSSRComplete.js","names":["renderSSRComplete","store","theme","UUID","requestHref","render","ErrorPage","template","htmlpage","helmetContext","routerContext","sheet","ServerStyleSheet","location","toLocation","createSSRComplete","renderToString","instance","BASE","then","appHTML","handleErrors","head","createHead","contextPath","html","state","dehydrate","catch","error","message","fileName","lineNumber","stack","helmet"],"sources":["../../src/react-server/renderSSRComplete.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\nimport { Provider } from \"react-redux\";\nimport { StaticRouter as Router } from \"react-router\";\n\nimport { HelmetProvider } from \"react-helmet-async\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\n\nimport createSSRComplete from \"./createSSRComplete\";\nimport htmlpage from \"./htmlpage\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\nimport ErrorBoundary from \"../react/ErrorBoundary\";\n\nimport { createHead, handleErrors, dehydrate } from \"./serverUtil\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { Location } from \"react-router\";\n\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n requestHref: Href,\n render: Function,\n ErrorPage: any,\n template?: (TemplateProps) => string,\n};\n/**\n */\nconst renderSSRComplete = ({\n store,\n theme = {},\n UUID = \"\",\n requestHref,\n render,\n ErrorPage,\n template = htmlpage,\n}: Props): Promise<string> => {\n const helmetContext = {};\n const routerContext = {};\n\n const sheet = new ServerStyleSheet();\n\n // $FlowFixMe[incompatible-type]\n // $FlowFixMe[prop-missing]\n const location: Location = requestHref.toLocation();\n\n return createSSRComplete(store, () =>\n renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <HelmetProvider context={helmetContext}>\n <ErrorBoundary>\n <Router\n basename={BASE}\n location={location}\n context={routerContext}\n >\n {render()}\n </Router>\n </ErrorBoundary>\n </HelmetProvider>\n </ThemeProvider>\n </StyleSheetManager>\n </Provider>\n )\n )\n .then((appHTML) => {\n handleErrors(store);\n const head = createHead(sheet, UUID, helmetContext);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n })\n .catch((error) =>\n template({\n contextPath: BASE,\n html: renderToString(\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>\n <ErrorPage\n errorMessage={error.message}\n errorResource={error.fileName}\n errorLine={error.lineNumber}\n errorStack={error.stack}\n />\n </ThemeProvider>\n </StyleSheetManager>\n ),\n head: helmetContext.helmet,\n state: \"\",\n UUID,\n })\n );\n};\n\nexport default renderSSRComplete;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;;;AAiBA;AACA;AACA,IAAMA,iBAAiB,GAAG,SAApBA,iBAAoB,OAQI;EAAA,IAP5BC,KAO4B,QAP5BA,KAO4B;EAAA,sBAN5BC,KAM4B;EAAA,IAN5BA,KAM4B,2BANpB,EAMoB;EAAA,qBAL5BC,IAK4B;EAAA,IAL5BA,IAK4B,0BALrB,EAKqB;EAAA,IAJ5BC,WAI4B,QAJ5BA,WAI4B;EAAA,IAH5BC,MAG4B,QAH5BA,MAG4B;EAAA,IAF5BC,SAE4B,QAF5BA,SAE4B;EAAA,yBAD5BC,QAC4B;EAAA,IAD5BA,QAC4B,8BADjBC,iBACiB;EAC5B,IAAMC,aAAa,GAAG,EAAtB;EACA,IAAMC,aAAa,GAAG,EAAtB;EAEA,IAAMC,KAAK,GAAG,IAAIC,kCAAJ,EAAd,CAJ4B,CAM5B;EACA;;EACA,IAAMC,QAAkB,GAAGT,WAAW,CAACU,UAAZ,EAA3B;EAEA,OAAO,IAAAC,0BAAA,EAAkBd,KAAlB,EAAyB;IAAA,OAC9B,IAAAe,sBAAA,gBACE,qBAAC,oBAAD;MAAU,KAAK,EAAEf,KAAjB;MAAA,uBACE,qBAAC,mCAAD;QAAmB,KAAK,EAAEU,KAAK,CAACM,QAAhC;QAAA,u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,CAAP;AAoDD,CAtED;;eAwEeH,iB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderSSRMinimal.js","names":["renderSSRMinimal","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","instance","head","contextPath","BASE","html","state"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme = {},\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;;;AAaA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,OAMJ;EAAA,IALnBC,KAKmB,QALnBA,KAKmB;EAAA,sBAJnBC,KAImB;EAAA,IAJnBA,KAImB,2BAJX,EAIW;EAAA,qBAHnBC,IAGmB;EAAA,IAHnBA,IAGmB,0BAHZ,EAGY;EAAA,IAFnBC,MAEmB,QAFnBA,MAEmB;EAAA,yBADnBC,QACmB;EAAA,IADnBA,QACmB,8BADRC,iBACQ;EACnB,IAAMC,KAAK,GAAG,IAAIC,kCAAJ,EAAd;EAEA,IAAMC,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"renderSSRMinimal.js","names":["renderSSRMinimal","store","theme","UUID","render","template","htmlpage","sheet","ServerStyleSheet","appHTML","renderToString","instance","head","createHead","contextPath","BASE","html","state","dehydrate"],"sources":["../../src/react-server/renderSSRMinimal.js"],"sourcesContent":["// @flow\nimport { renderToString } from \"react-dom/server\";\n\nimport { Provider } from \"react-redux\";\n\nimport { ServerStyleSheet, StyleSheetManager } from \"styled-components\";\nimport ThemeProvider from \"../react-theme/ThemeProvider\";\n\nimport { BASE } from \"../constants/Constants\";\n\nimport { createHead, dehydrate } from \"./serverUtil\";\nimport htmlpage from \"./htmlpage\";\n\nimport type { Theme } from \"../react-theme/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type { TemplateProps } from \"./htmlpage\";\ntype Props = {\n store: ReduxStore,\n theme: Theme,\n UUID: string,\n render: Function,\n template?: (TemplateProps) => string,\n};\n\n/**\n */\nconst renderSSRMinimal = ({\n store,\n theme = {},\n UUID = \"\",\n render,\n template = htmlpage,\n}: Props): string => {\n const sheet = new ServerStyleSheet();\n\n const appHTML = renderToString(\n <Provider store={store}>\n <StyleSheetManager sheet={sheet.instance}>\n <ThemeProvider theme={theme}>{render()}</ThemeProvider>\n </StyleSheetManager>\n </Provider>\n );\n\n const head = createHead(sheet, UUID);\n return template({\n contextPath: BASE,\n html: appHTML,\n head,\n state: dehydrate(store),\n UUID,\n });\n};\n\nexport default renderSSRMinimal;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AAEA;;AACA;;;;AAaA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,OAMJ;EAAA,IALnBC,KAKmB,QALnBA,KAKmB;EAAA,sBAJnBC,KAImB;EAAA,IAJnBA,KAImB,2BAJX,EAIW;EAAA,qBAHnBC,IAGmB;EAAA,IAHnBA,IAGmB,0BAHZ,EAGY;EAAA,IAFnBC,MAEmB,QAFnBA,MAEmB;EAAA,yBADnBC,QACmB;EAAA,IADnBA,QACmB,8BADRC,iBACQ;EACnB,IAAMC,KAAK,GAAG,IAAIC,kCAAJ,EAAd;EAEA,IAAMC,OAAO,GAAG,IAAAC,sBAAA,gBACd,qBAAC,oBAAD;IAAU,KAAK,EAAET,KAAjB;IAAA,uBACE,qBAAC,mCAAD;MAAmB,KAAK,EAAEM,KAAK,CAACI,QAAhC;MAAA,uBACE,qBAAC,sBAAD;QAAe,KAAK,EAAET,KAAtB;QAAA,UAA8BE,MAAM;MAApC;IADF;EADF,EADc,CAAhB;EAQA,IAAMQ,IAAI,GAAG,IAAAC,sBAAA,EAAWN,KAAX,EAAkBJ,IAAlB,CAAb;EACA,OAAOE,QAAQ,CAAC;IACdS,WAAW,EAAEC,eADC;IAEdC,IAAI,EAAEP,OAFQ;IAGdG,IAAI,EAAJA,IAHc;IAIdK,KAAK,EAAE,IAAAC,qBAAA,EAAUjB,KAAV,CAJO;IAKdE,IAAI,EAAJA;EALc,CAAD,CAAf;AAOD,CAzBD;;eA2BeH,gB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverNoSSR.js","names":["serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","UUID","__webpack_nonce__","requestHref","store","storedTheme","getState","preferences"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n template,\n beforeRenderHooks,\n}: serverProps): string => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n // $FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAQA;;AAEA;;AAEA;;AAiBA;AACA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASO;EAAA,IARzBC,OAQyB,QARzBA,OAQyB;EAAA,IAPzBC,OAOyB,QAPzBA,OAOyB;EAAA,IANzBC,cAMyB,QANzBA,cAMyB;EAAA,iCALzBC,iBAKyB;EAAA,IALzBA,iBAKyB,sCALL,EAKK;EAAA,sBAJzBC,KAIyB;EAAA,IAJzBA,KAIyB,2BAJjB,IAIiB;EAAA,IAHzBC,MAGyB,QAHzBA,MAGyB;EAAA,IAFzBC,QAEyB,QAFzBA,QAEyB;EAAA,IADzBC,iBACyB,QADzBA,iBACyB;EACzB,IAAMC,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"serverNoSSR.js","names":["serverNoSSR","request","locales","customReducers","serverPreferences","theme","render","template","beforeRenderHooks","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","storedTheme","getState","preferences","createTheme","setI18n","handleErrors","handleBeforeRenderHooks","renderSSRMinimal"],"sources":["../../src/react-server/serverNoSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n handleErrors,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRMinimal from \"./renderSSRMinimal\";\n\nimport createTheme from \"../react-theme/createTheme\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverNoSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n template,\n beforeRenderHooks,\n}: serverProps): string => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n\n if (theme) {\n const storedTheme = store.getState()?.preferences?.theme;\n // $FlowFixMe[incompatible-call]\n createTheme(storedTheme, theme);\n }\n\n setI18n(store, locales, request);\n\n handleErrors(store);\n\n handleBeforeRenderHooks(beforeRenderHooks, { store, request });\n\n return renderSSRMinimal({ store, theme, UUID, render, template });\n};\n\nexport default serverNoSSR;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAQA;;AAEA;;AAEA;;AAiBA;AACA;AACA,IAAMA,WAAW,GAAG,SAAdA,WAAc,OASO;EAAA,IARzBC,OAQyB,QARzBA,OAQyB;EAAA,IAPzBC,OAOyB,QAPzBA,OAOyB;EAAA,IANzBC,cAMyB,QANzBA,cAMyB;EAAA,iCALzBC,iBAKyB;EAAA,IALzBA,iBAKyB,sCALL,EAKK;EAAA,sBAJzBC,KAIyB;EAAA,IAJzBA,KAIyB,2BAJjB,IAIiB;EAAA,IAHzBC,MAGyB,QAHzBA,MAGyB;EAAA,IAFzBC,QAEyB,QAFzBA,QAEyB;EAAA,IADzBC,iBACyB,QADzBA,iBACyB;EACzB,IAAMC,IAAI,GAAG,IAAAC,mBAAA,GAAb;EACAC,iBAAiB,GAAGF,IAApB,CAFyB,CAEC;;EAE1B,IAAMG,WAAW,GAAG,IAAAC,sCAAA,EAAmBZ,OAAnB,CAApB;EACA,IAAMa,KAAK,GAAG,IAAAC,4BAAA,EAAiBH,WAAjB,EAA8BT,cAA9B,CAAd;EAEA,IAAAa,gCAAA,EAAqBF,KAArB,EAA4BV,iBAA5B;EACA,IAAAa,iCAAA,EAAsBH,KAAtB;;EAEA,IAAIT,KAAJ,EAAW;IAAA;;IACT,IAAMa,WAAW,sBAAGJ,KAAK,CAACK,QAAN,EAAH,6EAAG,gBAAkBC,WAArB,0DAAG,sBAA+Bf,KAAnD,CADS,CAET;;IACA,IAAAgB,oBAAA,EAAYH,WAAZ,EAAyBb,KAAzB;EACD;;EAED,IAAAiB,mBAAA,EAAQR,KAAR,EAAeZ,OAAf,EAAwBD,OAAxB;EAEA,IAAAsB,wBAAA,EAAaT,KAAb;EAEA,IAAAU,0CAAA,EAAwBhB,iBAAxB,EAA2C;IAAEM,KAAK,EAALA,KAAF;IAASb,OAAO,EAAPA;EAAT,CAA3C;EAEA,OAAO,IAAAwB,yBAAA,EAAiB;IAAEX,KAAK,EAALA,KAAF;IAAST,KAAK,EAALA,KAAT;IAAgBI,IAAI,EAAJA,IAAhB;IAAsBH,MAAM,EAANA,MAAtB;IAA8BC,QAAQ,EAARA;EAA9B,CAAjB,CAAP;AACD,CAhCD;;eAkCeP,W"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverSSR.js","names":["serverSSR","request","locales","customReducers","serverPreferences","theme","render","ErrorPage","template","beforeRenderHooks","UUID","__webpack_nonce__","requestHref","store"],"sources":["../../src/react-server/serverSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRComplete from \"./renderSSRComplete\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n ErrorPage?: any,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n ErrorPage,\n template,\n beforeRenderHooks,\n}: serverProps): Promise<string> => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n setI18n(store, locales, request);\n\n handleBeforeRenderHooks(beforeRenderHooks, { request, store });\n\n return renderSSRComplete({\n store,\n theme,\n UUID,\n requestHref,\n render,\n ErrorPage,\n template,\n });\n};\n\nexport default serverSSR;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAOA;;AAEA;;AAkBA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAUkB;EAAA,IATlCC,OASkC,QATlCA,OASkC;EAAA,IARlCC,OAQkC,QARlCA,OAQkC;EAAA,IAPlCC,cAOkC,QAPlCA,cAOkC;EAAA,iCANlCC,iBAMkC;EAAA,IANlCA,iBAMkC,sCANd,EAMc;EAAA,sBALlCC,KAKkC;EAAA,IALlCA,KAKkC,2BAL1B,IAK0B;EAAA,IAJlCC,MAIkC,QAJlCA,MAIkC;EAAA,IAHlCC,SAGkC,QAHlCA,SAGkC;EAAA,IAFlCC,QAEkC,QAFlCA,QAEkC;EAAA,IADlCC,iBACkC,QADlCA,iBACkC;EAClC,IAAMC,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"serverSSR.js","names":["serverSSR","request","locales","customReducers","serverPreferences","theme","render","ErrorPage","template","beforeRenderHooks","UUID","createUUID","__webpack_nonce__","requestHref","getFullRequestHref","store","createReduxStore","setServerPreferences","setConfigurationTheme","setI18n","handleBeforeRenderHooks","renderSSRComplete"],"sources":["../../src/react-server/serverSSR.js"],"sourcesContent":["// @flow\nimport \"./contextPath\";\n\nimport createUUID from \"../utils/helpers/createUUID\";\nimport { getFullRequestHref } from \"./requestInformation\";\n\nimport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n} from \"./serverUtil\";\n\nimport { handleBeforeRenderHooks } from \"../redux/store/beforeRenderHooks\";\n\nimport renderSSRComplete from \"./renderSSRComplete\";\n\nimport type { TemplateProps } from \"./htmlpage\";\nimport type { BeforeRenderHook } from \"../redux/store/beforeRenderHooks\";\nimport type { PreferenceValue } from \"./serverUtil\";\nimport type { LocaleConfiguration } from \"../i18n/types\";\ntype serverProps = {\n request: HttpServletRequestJava,\n locales?: Array<LocaleConfiguration>,\n customReducers?: Object,\n theme?: Object,\n serverPreferences?: Array<string | PreferenceValue>,\n render: Function,\n ErrorPage?: any,\n template?: (TemplateProps) => string,\n beforeRenderHooks?: Array<BeforeRenderHook>,\n};\n\n/**\n */\nconst serverSSR = ({\n request,\n locales,\n customReducers,\n serverPreferences = [],\n theme = null,\n render,\n ErrorPage,\n template,\n beforeRenderHooks,\n}: serverProps): Promise<string> => {\n const UUID = createUUID();\n __webpack_nonce__ = UUID; // NOSONAR\n\n const requestHref = getFullRequestHref(request);\n const store = createReduxStore(requestHref, customReducers);\n\n setServerPreferences(store, serverPreferences);\n setConfigurationTheme(store);\n setI18n(store, locales, request);\n\n handleBeforeRenderHooks(beforeRenderHooks, { request, store });\n\n return renderSSRComplete({\n store,\n theme,\n UUID,\n requestHref,\n render,\n ErrorPage,\n template,\n });\n};\n\nexport default serverSSR;\n"],"mappings":";;;;;;;;;AACA;;AAEA;;AACA;;AAEA;;AAOA;;AAEA;;AAkBA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,OAUkB;EAAA,IATlCC,OASkC,QATlCA,OASkC;EAAA,IARlCC,OAQkC,QARlCA,OAQkC;EAAA,IAPlCC,cAOkC,QAPlCA,cAOkC;EAAA,iCANlCC,iBAMkC;EAAA,IANlCA,iBAMkC,sCANd,EAMc;EAAA,sBALlCC,KAKkC;EAAA,IALlCA,KAKkC,2BAL1B,IAK0B;EAAA,IAJlCC,MAIkC,QAJlCA,MAIkC;EAAA,IAHlCC,SAGkC,QAHlCA,SAGkC;EAAA,IAFlCC,QAEkC,QAFlCA,QAEkC;EAAA,IADlCC,iBACkC,QADlCA,iBACkC;EAClC,IAAMC,IAAI,GAAG,IAAAC,mBAAA,GAAb;EACAC,iBAAiB,GAAGF,IAApB,CAFkC,CAER;;EAE1B,IAAMG,WAAW,GAAG,IAAAC,sCAAA,EAAmBb,OAAnB,CAApB;EACA,IAAMc,KAAK,GAAG,IAAAC,4BAAA,EAAiBH,WAAjB,EAA8BV,cAA9B,CAAd;EAEA,IAAAc,gCAAA,EAAqBF,KAArB,EAA4BX,iBAA5B;EACA,IAAAc,iCAAA,EAAsBH,KAAtB;EACA,IAAAI,mBAAA,EAAQJ,KAAR,EAAeb,OAAf,EAAwBD,OAAxB;EAEA,IAAAmB,0CAAA,EAAwBX,iBAAxB,EAA2C;IAAER,OAAO,EAAPA,OAAF;IAAWc,KAAK,EAALA;EAAX,CAA3C;EAEA,OAAO,IAAAM,0BAAA,EAAkB;IACvBN,KAAK,EAALA,KADuB;IAEvBV,KAAK,EAALA,KAFuB;IAGvBK,IAAI,EAAJA,IAHuB;IAIvBG,WAAW,EAAXA,WAJuB;IAKvBP,MAAM,EAANA,MALuB;IAMvBC,SAAS,EAATA,SANuB;IAOvBC,QAAQ,EAARA;EAPuB,CAAlB,CAAP;AASD,CAhCD;;eAkCeR,S"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverUtil.js","names":["createReduxStore","requestHref","customReducers","history","initialEntries","toString","store","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","locale","code","customLocale","custLocale","forEach","some","push","enabledLocales","localesInstance","Locales","preferredLocale","dispatch","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreferences","preferencesProvider","isStudioContext","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","dataFetcher","fetch","Error","handleErrors","state","getState","error","shouldThrowOnServer","dehydrate","filteredState","modularui","reduce","obj","key","status","model","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/actions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getSetting(\"ENABLED_LOCALES\").includes(locale.code)\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`\n );\n }\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const filteredState = {\n ...state,\n modularui: Object.keys(state.modularui).reduce((obj, key) => {\n obj[key] = {\n status: state.modularui[key].status,\n model: state.modularui[key].model\n ? state.modularui[key].model.dehydrate()\n : void 0,\n };\n\n return obj;\n }, {}),\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAGA;;AACA;;AAEA;;AAQA;;AAEA;;;;;;;;;;AAaA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CACvBC,WADuB,EAEvBC,cAFuB,EAGR;EACf;EACA,IAAMC,OAAsB,GAAG,kCAAoB;IACjDC,cAAc,EAAE,CAACH,WAAW,CAACI,QAAZ,EAAD;EADiC,CAApB,CAA/B;;EAIA,sBAAkB,8BAAeF,OAAf,EAAwBD,cAAxB,CAAlB;EAAA,IAAQI,KAAR,mBAAQA,KAAR;;EAEA,OAAOA,KAAP;AACD,CAZD;AAcA;AACA;;;;;AACA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CACdD,KADc,EAIX;EAAA,IAFHE,OAEG,uEAFmC,EAEnC;EAAA,IADHC,OACG;;EACH,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcH,OAAd,CAAL,EAA6B;IAC3B,MAAM,IAAII,oCAAJ,CAA6B,qCAA7B,CAAN;EACD;;EACD,IAAI,CAACH,OAAL,EAAc;IACZ,MAAM,IAAIG,oCAAJ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BD;AAoBA;AACA;;;;;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CACjBC,KADiB,EAEjBC,IAFiB,EAGjBC,aAHiB,EAIN;EACX,IAAMC,KAAK,GAAGH,KAAK,CAACI,YAAN,EAAd;EACA,IAAMC,IAAI,GAAGH,aAAa,oCAAOA,aAAa,CAACI,MAAd,CAAqBD,IAA5B,IAAoC,EAA9D;;EAEA,IAAIH,aAAJ,EAAmB;IACjB,uCACKA,aAAa,CAACI,MADnB;MAEEH,KAAK,EAALA,KAFF;MAGEE,IAAI,EAAJA;IAHF;EAKD;;EAED,OAAO;IACLF,KAAK,EAALA,KADK;IAELE,IAAI,EAAJA;EAFK,CAAP;AAID,CApBD"}
|
|
1
|
+
{"version":3,"file":"serverUtil.js","names":["createReduxStore","requestHref","customReducers","history","createMemoryHistory","initialEntries","toString","configureStore","store","setI18n","locales","request","Array","isArray","IllegalArgumentException","mergedLocales","availableLocales","locale","code","customLocale","custLocale","deepmerge","forEach","some","push","enabledLocales","getSetting","localesInstance","Locales","preferredLocale","getPreferredLocale","dispatch","setLocales","setServerPreferencesFromArray","serverPreferences","serverPreference","name","defaultValue","type","setServerPreference","setServerPreferences","setAllContentInDataSetting","setLoginPreferences","preferencesProvider","isStudioContext","setPreference","setConfigurationTheme","configTheme","configFileLocation","getLayoutConfigFileLocation","configFilePath","dataFetcher","fetch","setThemePreference","Error","handleErrors","state","getState","error","shouldThrowOnServer","has","dehydrate","filteredState","modularui","reduce","obj","key","status","model","replace","createHead","sheet","UUID","helmetContext","style","getStyleTags","meta","helmet"],"sources":["../../src/react-server/serverUtil.js"],"sourcesContent":["// @flow\nimport { createMemoryHistory } from \"history\";\nimport { has } from \"../utils/helpers/objects\";\nimport deepmerge from \"deepmerge\";\n\nimport configureStore from \"../redux/store/configureStore\";\n\nimport { availableLocales } from \"../i18n/Locales\";\nimport Locales from \"../i18n/Locales\";\n\nimport { getPreferredLocale } from \"./requestInformation\";\nimport { setLocales } from \"../redux/_i18n/actions\";\n\nimport {\n setServerPreference,\n setThemePreference,\n setPreference,\n setAllContentInDataSetting,\n setLoginPreferences,\n} from \"../redux/actions/Preferences\";\n\nimport { getSetting } from \"../constants/Settings\";\n\nimport { IllegalArgumentException } from \"../exceptions\";\n\nimport type { LocaleConfiguration } from \"../i18n/types\";\nimport type { ReduxStore } from \"../redux/types\";\nimport type Href from \"../models/href/Href\";\nimport type { RouterHistory } from \"react-router\";\n\nexport type PreferenceValue = {\n name: string,\n defaultValue?: string | null,\n type?: string,\n};\n\n/**\n */\nconst createReduxStore = (\n requestHref: Href,\n customReducers: Object\n): ReduxStore => {\n // $FlowExpectedError\n const history: RouterHistory = createMemoryHistory({\n initialEntries: [requestHref.toString()],\n });\n\n const { store } = configureStore(history, customReducers);\n\n return store;\n};\n\n/**\n */\nconst setI18n = (\n store: ReduxStore,\n locales: Array<LocaleConfiguration> = [],\n request: HttpServletRequestJava\n) => {\n if (!Array.isArray(locales)) {\n throw new IllegalArgumentException(\"locales must be an array of objects\");\n }\n if (!request) {\n throw new IllegalArgumentException(\"missing request argument\");\n }\n\n const mergedLocales = availableLocales.map((locale) => {\n const code = locale.code;\n const customLocale = locales.find((custLocale) => custLocale.code === code);\n\n if (customLocale) {\n return deepmerge(locale, customLocale);\n }\n\n return locale;\n });\n\n locales.forEach((customLocale) => {\n if (!mergedLocales.some((locale) => locale.code === customLocale.code)) {\n mergedLocales.push(customLocale);\n }\n });\n\n const enabledLocales = mergedLocales.filter((locale: LocaleConfiguration) =>\n getSetting(\"ENABLED_LOCALES\").includes(locale.code)\n );\n\n const localesInstance = new Locales(enabledLocales);\n const preferredLocale = getPreferredLocale(request, localesInstance);\n store.dispatch(setLocales(localesInstance, preferredLocale ?? \"en\"));\n};\n\nconst setServerPreferencesFromArray = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n serverPreferences.forEach((serverPreference) => {\n if (typeof serverPreference === \"object\") {\n const { name, defaultValue, type } = serverPreference;\n store.dispatch(setServerPreference(name, defaultValue, type));\n } else {\n store.dispatch(setServerPreference(serverPreference, null));\n }\n });\n};\n\n/**\n * Server preferences can be suplied by an array of preference names,\n * or an array of objects which has the name, an optional default value and an optional type.<br>\n * When the type is set to string, a comma separated value is not converted to an array:\n *\n * @example\n * // value becomes an array [default1, default2]\n * { name: \"prefName\", defaultValue: \"default1, default2\" }\n * // value remains a string \"default1, default2\"\n * { name: \"prefName\", defaultValue: \"default1, default2\", type: \"string\" }\n *\n * @param store\n * @param serverPreferences\n */\nconst setServerPreferences = (\n store: ReduxStore,\n serverPreferences: Array<string | PreferenceValue>\n) => {\n if (Array.isArray(serverPreferences)) {\n setServerPreferencesFromArray(store, serverPreferences);\n }\n\n store.dispatch(setAllContentInDataSetting());\n store.dispatch(setLoginPreferences());\n\n if (\n preferencesProvider &&\n preferencesProvider.isStudioContext &&\n preferencesProvider.isStudioContext()\n ) {\n store.dispatch(setPreference(\"isStudioContext\", true));\n }\n};\n\n/**\n */\nconst setConfigurationTheme = (store: ReduxStore) => {\n let configTheme = null;\n\n const configFileLocation = preferencesProvider.getLayoutConfigFileLocation();\n if (typeof configFileLocation === \"string\") {\n const configFilePath = configFileLocation.startsWith(\"/\")\n ? `/resource${configFileLocation}`\n : `/resource/${configFileLocation}`;\n\n configTheme = dataFetcher.fetch(configFilePath);\n\n if (configTheme) {\n store.dispatch(setThemePreference(configTheme));\n } else {\n throw new Error(\n `Could not read theme configuration file from: ${configFilePath}`\n );\n }\n }\n};\n\n/**\n */\nconst handleErrors = (store: ReduxStore) => {\n const state = store.getState();\n\n if (\n state.error &&\n (state.error.shouldThrowOnServer ||\n !has(state.error, \"shouldThrowOnServer\"))\n ) {\n throw state.error;\n }\n};\n\n/**\n */\nconst dehydrate = (store: ReduxStore): string => {\n const state = store.getState();\n\n const filteredState = {\n ...state,\n modularui: Object.keys(state.modularui).reduce((obj, key) => {\n obj[key] = {\n status: state.modularui[key].status,\n model: state.modularui[key].model\n ? state.modularui[key].model.dehydrate()\n : void 0,\n };\n\n return obj;\n }, {}),\n };\n\n return JSON.stringify(filteredState).replace(/</g, \"\\\\u003c\");\n};\n\n/**\n */\nconst createHead = (\n sheet: any,\n UUID: string,\n helmetContext?: Object\n): Object => {\n const style = sheet.getStyleTags();\n const meta = helmetContext ? [...helmetContext.helmet.meta] : [];\n\n if (helmetContext) {\n return {\n ...helmetContext.helmet,\n style,\n meta,\n };\n }\n\n return {\n style,\n meta,\n };\n};\n\nexport {\n createReduxStore,\n setI18n,\n setServerPreferences,\n setConfigurationTheme,\n createHead,\n handleErrors,\n dehydrate,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAGA;;AACA;;AAEA;;AAQA;;AAEA;;;;;;;;;;AAaA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CACvBC,WADuB,EAEvBC,cAFuB,EAGR;EACf;EACA,IAAMC,OAAsB,GAAG,IAAAC,4BAAA,EAAoB;IACjDC,cAAc,EAAE,CAACJ,WAAW,CAACK,QAAZ,EAAD;EADiC,CAApB,CAA/B;;EAIA,sBAAkB,IAAAC,wBAAA,EAAeJ,OAAf,EAAwBD,cAAxB,CAAlB;EAAA,IAAQM,KAAR,mBAAQA,KAAR;;EAEA,OAAOA,KAAP;AACD,CAZD;AAcA;AACA;;;;;AACA,IAAMC,OAAO,GAAG,SAAVA,OAAU,CACdD,KADc,EAIX;EAAA,IAFHE,OAEG,uEAFmC,EAEnC;EAAA,IADHC,OACG;;EACH,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcH,OAAd,CAAL,EAA6B;IAC3B,MAAM,IAAII,oCAAJ,CAA6B,qCAA7B,CAAN;EACD;;EACD,IAAI,CAACH,OAAL,EAAc;IACZ,MAAM,IAAIG,oCAAJ,CAA6B,0BAA7B,CAAN;EACD;;EAED,IAAMC,aAAa,GAAG,kBAAAC,yBAAA,OAAAA,yBAAA,EAAqB,UAACC,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B;;EAcA,OAAO,wBAAeH,aAAf,EAA8BO,OAA9B,CAAsC,IAAtC,EAA4C,SAA5C,CAAP;AACD,CAlBD;AAoBA;AACA;;;;;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAa,CACjBC,KADiB,EAEjBC,IAFiB,EAGjBC,aAHiB,EAIN;EACX,IAAMC,KAAK,GAAGH,KAAK,CAACI,YAAN,EAAd;EACA,IAAMC,IAAI,GAAGH,aAAa,oCAAOA,aAAa,CAACI,MAAd,CAAqBD,IAA5B,IAAoC,EAA9D;;EAEA,IAAIH,aAAJ,EAAmB;IACjB,uCACKA,aAAa,CAACI,MADnB;MAEEH,KAAK,EAALA,KAFF;MAGEE,IAAI,EAAJA;IAHF;EAKD;;EAED,OAAO;IACLF,KAAK,EAALA,KADK;IAELE,IAAI,EAAJA;EAFK,CAAP;AAID,CApBD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeProvider.js","names":["ThemeProvider","theme","children","storedTheme","preferences","finalTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA;;;;AAUA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,OAAsC;EAAA,IAAnCC,KAAmC,QAAnCA,KAAmC;EAAA,IAA5BC,QAA4B,QAA5BA,QAA4B;EAC1D,IAAMC,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"ThemeProvider.js","names":["ThemeProvider","theme","children","storedTheme","useSelector","preferences","finalTheme","createTheme","displayName"],"sources":["../../src/react-theme/ThemeProvider.js"],"sourcesContent":["// @flow\nimport { useSelector } from \"react-redux\";\nimport { ThemeProvider as SCThemeProvider } from \"styled-components\";\n\nimport createTheme from \"./createTheme\";\n\nimport type { Node } from \"react\";\nimport type { Theme } from \"./types\";\n\nexport type Props = {\n +theme: Theme | Array<Theme>,\n +children: Node,\n};\n\n/**\n */\nconst ThemeProvider = ({ theme, children }: Props): Node => {\n const storedTheme = useSelector(({ preferences }) => preferences.theme);\n const finalTheme = createTheme(storedTheme, theme);\n\n return <SCThemeProvider theme={finalTheme}>{children}</SCThemeProvider>;\n};\nThemeProvider.displayName = \"BI.ThemeProvider\";\n\nexport default ThemeProvider;\n"],"mappings":";;;;;;;;;AACA;;AACA;;AAEA;;;;AAUA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,OAAsC;EAAA,IAAnCC,KAAmC,QAAnCA,KAAmC;EAAA,IAA5BC,QAA4B,QAA5BA,QAA4B;EAC1D,IAAMC,WAAW,GAAG,IAAAC,uBAAA,EAAY;IAAA,IAAGC,WAAH,SAAGA,WAAH;IAAA,OAAqBA,WAAW,CAACJ,KAAjC;EAAA,CAAZ,CAApB;EACA,IAAMK,UAAU,GAAG,IAAAC,oBAAA,EAAYJ,WAAZ,EAAyBF,KAAzB,CAAnB;EAEA,oBAAO,qBAAC,+BAAD;IAAiB,KAAK,EAAEK,UAAxB;IAAA,UAAqCJ;EAArC,EAAP;AACD,CALD;;AAMAF,aAAa,CAACQ,WAAd,GAA4B,kBAA5B;eAEeR,a"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTheme.js","names":["replacePlaceholders","inputTheme","possibleKeys","key","join","re","RegExp","forEach","value","replace","match","capture","generateTheme","storedTheme","generatedTheme","themeElements","element","createTheme","themeConfigs","customTheme","settings"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n (match, capture) => inputTheme[capture]\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme, ...themeElements) => {\n let generatedTheme = {};\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme>>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAEA;;;;;;AAIA,IAAMA,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,UAAD,EAAgB;EAAA;;EAC1C,IAAMC,YAAY,GAAG,gDAAYD,UAAZ,kBACd,UAACE,GAAD;IAAA,oBAAeA,GAAf;EAAA,CADc,EAElBC,IAFkB,CAEb,GAFa,CAArB;EAIA,IAAMC,EAAE,GAAG,IAAIC,MAAJ,eAAkBJ,YAAlB,QAAmC,GAAnC,CAAX;EACA,sBAAeD,UAAf,EAA2BM,OAA3B,CAAmC,gBAAkB;IAAA;IAAA,IAAhBJ,GAAgB;IAAA,IAAXK,KAAW;;IACnD,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;MAC7BP,UAAU,CAACE,GAAD,CAAV,GAAkBK,KAAK,CAACC,OAAN,CAChBJ,EADgB,EAEhB,UAACK,KAAD,EAAQC,OAAR;QAAA,OAAoBV,UAAU,CAACU,OAAD,CAA9B;MAAA,CAFgB,CAAlB;IAID;EACF,CAPD;EASA,OAAOV,UAAP;AACD,CAhBD;;AAkBA,IAAMW,aAAa,GAAG,SAAhBA,aAAgB,CAACC,WAAD,EAAmC;EACvD,IAAIC,cAAc,GAAG,EAArB;;EADuD,kCAAlBC,aAAkB;IAAlBA,aAAkB;EAAA;;EAEvD,kCAAsBA,aAAtB,oCAAqC;IAAhC,IAAMC,OAAO,qBAAb;;IACH,IAAI,OAAOA,OAAP,KAAmB,UAAvB,EAAmC;MACjCF,cAAc,GAAGE,OAAO,CAAChB,mBAAmB,CAACc,cAAD,CAApB,CAAxB;IACD,CAFD,MAEO,IAAI,
|
|
1
|
+
{"version":3,"file":"createTheme.js","names":["replacePlaceholders","inputTheme","possibleKeys","key","join","re","RegExp","forEach","value","replace","match","capture","generateTheme","storedTheme","generatedTheme","themeElements","element","isPlainObject","createTheme","themeConfigs","customTheme","flattenDeep","setSettings","settings"],"sources":["../../src/react-theme/createTheme.js"],"sourcesContent":["// @flow\nimport flattenDeep from \"lodash/flattenDeep\";\n\nimport { isPlainObject } from \"../utils/helpers/objects\";\n\nimport { setSettings } from \"../constants/Settings\";\n\nimport type { Theme } from \"./types\";\n\nconst replacePlaceholders = (inputTheme) => {\n const possibleKeys = Object.keys(inputTheme)\n .map((key) => `\\\\b${key}\\\\b`)\n .join(\"|\");\n\n const re = new RegExp(`\\\\$(${possibleKeys})`, \"g\");\n Object.entries(inputTheme).forEach(([key, value]) => {\n if (typeof value === \"string\") {\n inputTheme[key] = value.replace(\n re,\n (match, capture) => inputTheme[capture]\n );\n }\n });\n\n return inputTheme;\n};\n\nconst generateTheme = (storedTheme, ...themeElements) => {\n let generatedTheme = {};\n for (const element of themeElements) {\n if (typeof element === \"function\") {\n generatedTheme = element(replacePlaceholders(generatedTheme));\n } else if (isPlainObject(element)) {\n generatedTheme = { ...generatedTheme, ...element, ...storedTheme };\n }\n }\n\n // final - replace any assignments inside the theme\n return replacePlaceholders(generatedTheme);\n};\n\n/**\n * Create a theme from multiple theme configuration objects.\n * Properties are overwriten by iterating the configuration objects from left to right.\n *\n * The first argument represents a stored theme part, this is optional. The stored theme part will overwrite every part in the collection of theme parts.\n * Thus a stored configuration is leading as it can be configured by a modeller through the repository.\n *\n * Placeholders can be used, they are replaced before calling a function theme part or at the end of the theme creation.\n *\n * Both objects and function can be used, where a function receives the previous objects as input arguments.\n * For example using the method createTheme(ThemeObject, ThemeObject2, ThemeFunction, ThemeFunction2), will be handled as:\n *\n * ThemeFunction2(ThemeFunction1({ ...ThemeObject, ...ThemeObject2 }))\n *\n * @example\n * Example where the primary color of the default theme is overwritten with a primary color of the custom theme,\n * but the button bg still uses the yiq function of the default theme:\n *\n * const DefaultTheme = {\n * PRIMARY_COLOR: \"#0000ff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * BUTTON_COLOR: \"$PRIMARY_COLOR\"\n * }\n *\n * const createDefaultTheme = (input) => ({\n * ...input,\n * BUTTON_BG: getContrastYIQ(input.BUTTON_COLOR)\n * })\n *\n * const CustomTheme = {\n * PRIMARY_COLOR: \"#ff0000\"\n * }\n *\n * createTheme(null, DefaultTheme, CustomTheme, createDefaultTheme);\n *\n * // Result:\n * {\n * PRIMARY_COLOR: \"#ff0000\",\n * BUTTON_COLOR: \"#ff0000\",\n * BUTTON_BG: \"#fff\",\n * SECONDARY_COLOR: \"#00ff00\",\n * }\n */\nconst createTheme = (\n storedTheme: Theme,\n ...themeConfigs: Array<Theme | Array<Theme>>\n):\n | any\n | {}\n | {\n INPUT_FOCUS_BORDER_COLOR?: string,\n LINK_HOVER_COLOR?: string,\n PAGING_HOVER_COLOR?: string,\n settings?: { [settingName: string]: string },\n } => {\n const customTheme = generateTheme(storedTheme, ...flattenDeep(themeConfigs));\n\n if (customTheme) {\n setSettings(customTheme.settings);\n }\n\n return customTheme;\n};\n\nexport default createTheme;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAEA;;AAEA;;;;;;AAIA,IAAMA,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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA,IAAMI,WAAW,GAAG,SAAdA,WAAc,CAClBL,WADkB,EAWX;EAAA;;EAAA,mCATJM,YASI;IATJA,YASI;EAAA;;EACP,IAAMC,WAAW,GAAGR,aAAa,MAAb,2CAAcC,WAAd,oDAA8B,IAAAQ,oBAAA,EAAYF,YAAZ,CAA9B,GAApB;;EAEA,IAAIC,WAAJ,EAAiB;IACf,IAAAE,qBAAA,EAAYF,WAAW,CAACG,QAAxB;EACD;;EAED,OAAOH,WAAP;AACD,CAnBD;;eAqBeF,W"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTheme.js","names":["useTheme","ThemeContext"],"sources":["../../src/react-theme/useTheme.js"],"sourcesContent":["// @flow\nimport { useContext } from \"react\";\nimport { ThemeContext } from \"styled-components\";\n\nimport type { Theme } from \"./types\";\n\n/**\n */\nconst useTheme = (): Theme => {\n return useContext(ThemeContext);\n};\n\nexport { useTheme };\n"],"mappings":";;;;;;;AACA;;AACA;;AAIA;AACA;AACA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,GAAa;EAC5B,OAAO,
|
|
1
|
+
{"version":3,"file":"useTheme.js","names":["useTheme","useContext","ThemeContext"],"sources":["../../src/react-theme/useTheme.js"],"sourcesContent":["// @flow\nimport { useContext } from \"react\";\nimport { ThemeContext } from \"styled-components\";\n\nimport type { Theme } from \"./types\";\n\n/**\n */\nconst useTheme = (): Theme => {\n return useContext(ThemeContext);\n};\n\nexport { useTheme };\n"],"mappings":";;;;;;;AACA;;AACA;;AAIA;AACA;AACA,IAAMA,QAAQ,GAAG,SAAXA,QAAW,GAAa;EAC5B,OAAO,IAAAC,iBAAA,EAAWC,8BAAX,CAAP;AACD,CAFD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"background.js","names":["renderBackground","path","defaultValue","theme","value"],"sources":["../../../src/react-theme/utils/background.js"],"sourcesContent":["// @flow\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n */\nconst renderBackground =\n (path: string, defaultValue?: string): ((UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n"],"mappings":";;;;;;;AACA;;AAIA;AACA;AACA,IAAMA,gBAAgB,GACpB,SADIA,gBACJ,CAACC,IAAD,EAAeC,YAAf;EAAA,OACA,gBAA+B;IAAA,IAA5BC,KAA4B,QAA5BA,KAA4B;IAC7B,IAAMC,KAAK,GAAG,
|
|
1
|
+
{"version":3,"file":"background.js","names":["renderBackground","path","defaultValue","theme","value","getThemeProp"],"sources":["../../../src/react-theme/utils/background.js"],"sourcesContent":["// @flow\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { ThemePropValue, UtilThemeProps } from \"../types\";\n\n/**\n */\nconst renderBackground =\n (path: string, defaultValue?: string): ((UtilThemeProps) => ThemePropValue) =>\n ({ theme }: UtilThemeProps) => {\n const value = getThemeProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return `background: ${value}`;\n }\n\n return value;\n };\n\nexport { renderBackground };\n"],"mappings":";;;;;;;AACA;;AAIA;AACA;AACA,IAAMA,gBAAgB,GACpB,SADIA,gBACJ,CAACC,IAAD,EAAeC,YAAf;EAAA,OACA,gBAA+B;IAAA,IAA5BC,KAA4B,QAA5BA,KAA4B;IAC7B,IAAMC,KAAK,GAAG,IAAAC,wBAAA,EAAaF,KAAb,EAAoBF,IAApB,EAA0BC,YAA1B,CAAd;;IAEA,IAAI,OAAOE,KAAP,KAAiB,QAArB,EAA+B;MAC7B,6BAAsBA,KAAtB;IACD;;IAED,OAAOA,KAAP;EACD,CATD;AAAA,CADF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","names":["darkenColor","amount","path","defaultValue","theme","lightenColor","changeHSL","color","saturation","lightness","hueAdjustment","hue"],"sources":["../../../src/react-theme/utils/colors.js"],"sourcesContent":["// @flow\nimport { darken, hsl, lighten, parseToHsl } from \"polished\";\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\n/**\n */\nconst darkenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Themed color x amount lightened\n */\n/**\n */\nconst lightenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Make a color lighter or darker in the same color family\n */\n/**\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment: number = 0\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n"],"mappings":";;;;;;;AACA;;AACA;;AAIA;AACA;AACA;;AACA;AACA;AACA,IAAMA,WAAW,GACf,SADIA,WACJ,CACEC,MADF,EAEEC,IAFF,EAGEC,YAHF;EAAA,OAKA;IAAA,IAAGC,KAAH,QAAGA,KAAH;IAAA,OACE,
|
|
1
|
+
{"version":3,"file":"colors.js","names":["darkenColor","amount","path","defaultValue","theme","darken","getThemeProp","lightenColor","lighten","changeHSL","color","saturation","lightness","hueAdjustment","hsl","parseToHsl","hue"],"sources":["../../../src/react-theme/utils/colors.js"],"sourcesContent":["// @flow\nimport { darken, hsl, lighten, parseToHsl } from \"polished\";\nimport { getThemeProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\n/*\n * Themed color x amount darkened\n */\n/**\n */\nconst darkenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n darken(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Themed color x amount lightened\n */\n/**\n */\nconst lightenColor =\n (\n amount: number | string,\n path: string,\n defaultValue?: string\n ): ((UtilThemeProps) => string) =>\n ({ theme }: UtilThemeProps) =>\n lighten(amount, getThemeProp(theme, path, defaultValue));\n\n/*\n * Make a color lighter or darker in the same color family\n */\n/**\n */\nconst changeHSL = (\n color: string,\n saturation?: number,\n lightness?: number,\n hueAdjustment: number = 0\n): string => hsl(parseToHsl(color).hue + hueAdjustment, saturation, lightness);\n\nexport { darkenColor, lightenColor, changeHSL };\n"],"mappings":";;;;;;;AACA;;AACA;;AAIA;AACA;AACA;;AACA;AACA;AACA,IAAMA,WAAW,GACf,SADIA,WACJ,CACEC,MADF,EAEEC,IAFF,EAGEC,YAHF;EAAA,OAKA;IAAA,IAAGC,KAAH,QAAGA,KAAH;IAAA,OACE,IAAAC,gBAAA,EAAOJ,MAAP,EAAe,IAAAK,wBAAA,EAAaF,KAAb,EAAoBF,IAApB,EAA0BC,YAA1B,CAAf,CADF;EAAA,CALA;AAAA,CADF;AASA;AACA;AACA;;AACA;AACA;;;;;AACA,IAAMI,YAAY,GAChB,SADIA,YACJ,CACEN,MADF,EAEEC,IAFF,EAGEC,YAHF;EAAA,OAKA;IAAA,IAAGC,KAAH,SAAGA,KAAH;IAAA,OACE,IAAAI,iBAAA,EAAQP,MAAR,EAAgB,IAAAK,wBAAA,EAAaF,KAAb,EAAoBF,IAApB,EAA0BC,YAA1B,CAAhB,CADF;EAAA,CALA;AAAA,CADF;AASA;AACA;AACA;;AACA;AACA;;;;;AACA,IAAMM,SAAS,GAAG,SAAZA,SAAY,CAChBC,KADgB,EAEhBC,UAFgB,EAGhBC,SAHgB;EAAA,IAIhBC,aAJgB,uEAIQ,CAJR;EAAA,OAKL,IAAAC,aAAA,EAAI,IAAAC,oBAAA,EAAWL,KAAX,EAAkBM,GAAlB,GAAwBH,aAA5B,EAA2CF,UAA3C,EAAuDC,SAAvD,CALK;AAAA,CAAlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contrast.js","names":["getColorContrast","color1","color2","luminance1","luminance2","parseFloat","toFixed","getYIQ","color","rgb","red","green","blue","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","backgroundColor","ThemePropertyException","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty"],"sources":["../../../src/react-theme/utils/contrast.js"],"sourcesContent":["// @flow\nimport { getLuminance, parseToRgb } from \"polished\";\n\nimport { getThemeStringProp, getProp } from \"./themeProps\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string): number => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2)\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\n/**\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: string,\n dark: string = \"#212529\",\n light: string = \"#fff\",\n preferredColor?: string\n): string => {\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\n/**\n */\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string\n) => {\n let bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (typeof bgColor === \"object\") {\n bgColor = bgColor?.backgroundColor ?? defaultValue;\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n throw new ThemePropertyException(\n `${bgColorProperty} is not a string, but: ${typeof bgColor}`\n );\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty: string,\n preferredColorProperty?: string,\n standardDarkProperty: string = \"YIQ_DARK_COLOR\",\n standardLightProperty: string = \"YIQ_LIGHT_COLOR\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\"\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n"],"mappings":";;;;;;;;;;;;;AACA;;AAEA;;AAEA;;AAIA;AACA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,MAAD,EAAiBC,MAAjB,EAA4C;EACnE,IAAMC,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"contrast.js","names":["getColorContrast","color1","color2","luminance1","getLuminance","luminance2","parseFloat","toFixed","getYIQ","color","rgb","parseToRgb","red","green","blue","getContrastYIQ","dark","light","preferredColor","yiqColor","darkColor","lightColor","getBackgroundColor","theme","bgColorProperty","defaultValue","bgColor","getProp","backgroundColor","ThemePropertyException","renderContrastColor","preferredColorProperty","standardDarkProperty","standardLightProperty","getThemeStringProp"],"sources":["../../../src/react-theme/utils/contrast.js"],"sourcesContent":["// @flow\nimport { getLuminance, parseToRgb } from \"polished\";\n\nimport { getThemeStringProp, getProp } from \"./themeProps\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\n\n/**\n * calculate the contrast ratio of two colors\n */\nconst getColorContrast = (color1: string, color2: string): number => {\n const luminance1 = getLuminance(color1);\n const luminance2 = getLuminance(color2);\n return parseFloat(\n (luminance1 > luminance2\n ? (luminance1 + 0.05) / (luminance2 + 0.05)\n : (luminance2 + 0.05) / (luminance1 + 0.05)\n ).toFixed(2)\n );\n};\n\n/*\n * The YIQ equation converts the RGB color (0 to 255) into a YIQ color space.\n * YIQ is the standard formula for calculating the perceived brightness of a color,\n * and is recommended by the World Wide Web Consortium (W3C).\n */\n/**\n */\nconst getYIQ = (color: string): number => {\n const rgb = parseToRgb(color);\n\n return (rgb.red * 299 + rgb.green * 587 + rgb.blue * 114) / 1000;\n};\n\n/**\n * Get dark or light color, depending on the given color\n * When the contrast between the color and the light or dark color is too low,\n * the preferred color is returned\n */\nconst getContrastYIQ = (\n color: string,\n dark: string = \"#212529\",\n light: string = \"#fff\",\n preferredColor?: string\n): string => {\n const yiqColor = getYIQ(color);\n\n if (preferredColor && getColorContrast(color, preferredColor) >= 4.5) {\n return preferredColor;\n }\n\n const darkColor = getYIQ(dark) < 127.5 ? dark : \"#212529\";\n const lightColor = getYIQ(light) > 127.5 ? light : \"#fff\";\n\n if (yiqColor > 127.5) {\n if (getColorContrast(color, darkColor) < 3) {\n return \"#212529\";\n }\n\n return darkColor;\n }\n\n if (getColorContrast(color, lightColor) < 3) {\n return \"#fff\";\n }\n return lightColor;\n};\n\n/**\n */\nconst getBackgroundColor = (\n theme: Theme,\n bgColorProperty: string,\n defaultValue: string\n) => {\n let bgColor = getProp(theme, bgColorProperty, defaultValue);\n\n if (typeof bgColor === \"object\") {\n bgColor = bgColor?.backgroundColor ?? defaultValue;\n }\n\n if (typeof bgColor === \"string\") {\n return bgColor;\n }\n\n throw new ThemePropertyException(\n `${bgColorProperty} is not a string, but: ${typeof bgColor}`\n );\n};\n\n/**\n * Retrieve the contrast color for the given background property,\n * based on theme properties\n */\nconst renderContrastColor =\n (\n bgColorProperty: string,\n preferredColorProperty?: string,\n standardDarkProperty: string = \"YIQ_DARK_COLOR\",\n standardLightProperty: string = \"YIQ_LIGHT_COLOR\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) => {\n const bgColor = getBackgroundColor(theme, bgColorProperty, \"#ffffff\");\n const preferredColor = getThemeStringProp(theme, preferredColorProperty);\n const darkColor = getThemeStringProp(\n theme,\n standardDarkProperty,\n \"#212529\"\n );\n const lightColor = getThemeStringProp(theme, standardLightProperty, \"#fff\");\n\n return getContrastYIQ(bgColor, darkColor, lightColor, preferredColor);\n };\n\nexport { getColorContrast, getYIQ, getContrastYIQ, renderContrastColor };\n"],"mappings":";;;;;;;;;;;;;AACA;;AAEA;;AAEA;;AAIA;AACA;AACA;AACA,IAAMA,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,MAAD,EAAiBC,MAAjB,EAA4C;EACnE,IAAMC,UAAU,GAAG,IAAAC,sBAAA,EAAaH,MAAb,CAAnB;EACA,IAAMI,UAAU,GAAG,IAAAD,sBAAA,EAAaF,MAAb,CAAnB;EACA,OAAOI,UAAU,CACf,CAACH,UAAU,GAAGE,UAAb,GACG,CAACF,UAAU,GAAG,IAAd,KAAuBE,UAAU,GAAG,IAApC,CADH,GAEG,CAACA,UAAU,GAAG,IAAd,KAAuBF,UAAU,GAAG,IAApC,CAFJ,EAGEI,OAHF,CAGU,CAHV,CADe,CAAjB;AAMD,CATD;AAWA;AAC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EAItB;EAAA;;EACH,IAAIC,OAAO,GAAG,IAAAC,mBAAA,EAAQJ,KAAR,EAAeC,eAAf,EAAgCC,YAAhC,CAAd;;EAEA,IAAI,sBAAOC,OAAP,MAAmB,QAAvB,EAAiC;IAAA;;IAC/BA,OAAO,wCAAGA,OAAH,6CAAG,SAASE,eAAZ,yEAA+BH,YAAtC;EACD;;EAED,IAAI,OAAOC,OAAP,KAAmB,QAAvB,EAAiC;IAC/B,OAAOA,OAAP;EACD;;EAED,MAAM,IAAIG,kCAAJ,2CACDL,eADC,mEAC+CE,OAD/C,GAAN;AAGD,CAlBD;AAoBA;AACA;AACA;AACA;;;AACA,IAAMI,mBAAmB,GACvB,SADIA,mBACJ,CACEN,eADF,EAEEO,sBAFF;EAAA,IAGEC,oBAHF,uEAGiC,gBAHjC;EAAA,IAIEC,qBAJF,uEAIkC,iBAJlC;EAAA,OAMA,gBAAoC;IAAA,sBAAjCV,KAAiC;IAAA,IAAjCA,KAAiC,2BAAzB,EAAyB;IAClC,IAAMG,OAAO,GAAGJ,kBAAkB,CAACC,KAAD,EAAQC,eAAR,EAAyB,SAAzB,CAAlC;IACA,IAAMN,cAAc,GAAG,IAAAgB,8BAAA,EAAmBX,KAAnB,EAA0BQ,sBAA1B,CAAvB;IACA,IAAMX,SAAS,GAAG,IAAAc,8BAAA,EAChBX,KADgB,EAEhBS,oBAFgB,EAGhB,SAHgB,CAAlB;IAKA,IAAMX,UAAU,GAAG,IAAAa,8BAAA,EAAmBX,KAAnB,EAA0BU,qBAA1B,EAAiD,MAAjD,CAAnB;IAEA,OAAOlB,cAAc,CAACW,OAAD,EAAUN,SAAV,EAAqBC,UAArB,EAAiCH,cAAjC,CAArB;EACD,CAjBD;AAAA,CADF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"corners.js","names":["DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","ROUNDED_CORNERS","propertyName"],"sources":["../../../src/react-theme/utils/corners.js"],"sourcesContent":["// @flow\nimport { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\n/**\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path: string = \"BORDER_RADIUS\",\n defaultValue: string = \"0.25rem\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":";;;;;;;;;;;AACA;;AAIA,IAAMA,uBAAuB,GAAG,eAAhC;AAEA;AACA;AACA;AACA;;AACA;AACA;;AACA,IAAMC,cAAc,GAClB,SADIA,cACJ;EAAA,IACEC,QADF,uEACqBF,uBADrB;EAAA,IAEEG,IAFF,uEAEiB,eAFjB;EAAA,IAGEC,YAHF,uEAGyB,SAHzB;EAAA,OAKA,gBAAoC;IAAA,sBAAjCC,KAAiC;IAAA,IAAjCA,KAAiC,2BAAzB,EAAyB;;IAClC,IAAIA,KAAK,CAACC,eAAV,EAA2B;MAAA;;MACzB,IAAMC,YAAY,GAChBL,QAAQ,IAAIA,QAAQ,KAAKF,uBAAzB,oBACcE,QADd,eAEIF,uBAHN;MAKA,iDAAUO,YAAV,wBAA2B,
|
|
1
|
+
{"version":3,"file":"corners.js","names":["DEFAULT_CORNER_PROPERTY","roundedCorners","property","path","defaultValue","theme","ROUNDED_CORNERS","propertyName","getThemeStringProp"],"sources":["../../../src/react-theme/utils/corners.js"],"sourcesContent":["// @flow\nimport { getThemeStringProp } from \"./themeProps\";\n\nimport type { UtilThemeProps } from \"../types\";\n\nconst DEFAULT_CORNER_PROPERTY = \"border-radius\";\n\n/*\n * Border radius based on the theme setting for rounded corners\n * When ROUNDED_CORNERS is not true in the theme, no rounded corners are returned\n */\n/**\n */\nconst roundedCorners =\n (\n property: string = DEFAULT_CORNER_PROPERTY,\n path: string = \"BORDER_RADIUS\",\n defaultValue: string = \"0.25rem\"\n ): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) => {\n if (theme.ROUNDED_CORNERS) {\n const propertyName =\n property && property !== DEFAULT_CORNER_PROPERTY\n ? `border-${property}-radius`\n : DEFAULT_CORNER_PROPERTY;\n\n return `${propertyName}: ${getThemeStringProp(\n theme,\n path,\n defaultValue\n )}`;\n }\n\n return \"\";\n };\n\nexport { roundedCorners };\n"],"mappings":";;;;;;;;;;;AACA;;AAIA,IAAMA,uBAAuB,GAAG,eAAhC;AAEA;AACA;AACA;AACA;;AACA;AACA;;AACA,IAAMC,cAAc,GAClB,SADIA,cACJ;EAAA,IACEC,QADF,uEACqBF,uBADrB;EAAA,IAEEG,IAFF,uEAEiB,eAFjB;EAAA,IAGEC,YAHF,uEAGyB,SAHzB;EAAA,OAKA,gBAAoC;IAAA,sBAAjCC,KAAiC;IAAA,IAAjCA,KAAiC,2BAAzB,EAAyB;;IAClC,IAAIA,KAAK,CAACC,eAAV,EAA2B;MAAA;;MACzB,IAAMC,YAAY,GAChBL,QAAQ,IAAIA,QAAQ,KAAKF,uBAAzB,oBACcE,QADd,eAEIF,uBAHN;MAKA,iDAAUO,YAAV,wBAA2B,IAAAC,8BAAA,EACzBH,KADyB,EAEzBF,IAFyB,EAGzBC,YAHyB,CAA3B;IAKD;;IAED,OAAO,EAAP;EACD,CApBD;AAAA,CADF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spacers.js","names":["getSize","theme","ratio","path","unit","size","times","IllegalStateException","IllegalArgumentException","spacer","spacers","ratios","join","gutter"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\"\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) =>\n getSize(theme, ratio, \"GRID_GUTTER\", \"px\");\n\nexport { spacer, spacers, gutter };\n"],"mappings":";;;;;;;;;;;;;;;AACA;;AAGA;;AACA;;AAEA;AACA;AACA,IAAMA,OAAO,GAAG,SAAVA,OAAU,CACdC,KADc,EAKX;EAAA,IAHHC,KAGG,uEAHsB,CAGtB;EAAA,IAFHC,IAEG,uEAFY,QAEZ;EAAA,IADHC,IACG,uEADY,KACZ;;EACH,IAAI,OAAOF,KAAP,KAAiB,QAArB,EAA+B;IAC7B,OAAOA,KAAP;EACD;;EAED,IAAI,OAAOA,KAAP,KAAiB,QAArB,EAA+B;IAC7B,IAAI,OAAOD,KAAK,CAACE,IAAD,CAAZ,KAAuB,QAA3B,EAAqC;MAAA;;MACnC,IAAME,IAAI,GAAG,
|
|
1
|
+
{"version":3,"file":"spacers.js","names":["getSize","theme","ratio","path","unit","size","Big","times","IllegalStateException","IllegalArgumentException","spacer","spacers","ratios","join","gutter"],"sources":["../../../src/react-theme/utils/spacers.js"],"sourcesContent":["// @flow\nimport Big from \"big.js\";\n\nimport type { Theme, UtilThemeProps } from \"../types\";\nimport IllegalArgumentException from \"../../exceptions/IllegalArgumentException\";\nimport IllegalStateException from \"../../exceptions/IllegalStateException\";\n\n/**\n */\nconst getSize = (\n theme: Theme,\n ratio: number | string = 1,\n path: string = \"SPACER\",\n unit: string = \"rem\"\n) => {\n if (typeof ratio === \"string\") {\n return ratio;\n }\n\n if (typeof ratio === \"number\") {\n if (typeof theme[path] === \"number\") {\n const size = Big(ratio).times(theme[path]);\n return `${size}${unit}`;\n }\n throw new IllegalStateException(`Size ${path} must be a number`);\n }\n\n throw new IllegalArgumentException(\n `Ratio ${JSON.stringify(ratio)} must be a string or number`\n );\n};\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n */\n/**\n */\nconst spacer =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) =>\n getSize(theme, ratio);\n\n/*\n * Render spacers based on the given ratio * theme SPACER\n * Ratio's can be given clockwise with shorthand,\n * spacers(0.5, 1) with a spacer of 0.8 will give \"0.4rem 1rem\";\n */\n/**\n */\nconst spacers =\n (...ratios: Array<number | \"auto\">): ((UtilThemeProps) => string) =>\n ({ theme = {} }: UtilThemeProps) =>\n ratios.map((ratio) => getSize(theme, ratio)).join(\" \");\n\n/*\n * Render a gutter based on GUTTER property\n */\n/**\n */\nconst gutter =\n (ratio: number = 1): ((UtilThemeProps) => string) =>\n ({ theme = {} }: Ut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AAWF,OAAO,CAACC,KAAD,EAAQC,KAAR,CAAlB;IAAA,CAAL,CAAN,CAA6CW,IAA7C,CAAkD,GAAlD,CADF;EAAA,CADA;AAAA,CADF;AAKA;AACA;AACA;;AACA;AACA;;;;;AACA,IAAMC,MAAM,GACV,SADIA,MACJ;EAAA,IAACZ,KAAD,uEAAiB,CAAjB;EAAA,OACA;IAAA,wBAAGD,KAAH;IAAA,IAAGA,KAAH,4BAAW,EAAX;IAAA,OACED,OAAO,CAACC,KAAD,EAAQC,KAAR,EAAe,aAAf,EAA8B,IAA9B,CADT;EAAA,CADA;AAAA,CADF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"themeProps.js","names":["getProp","theme","path","defaultValue","getThemeProp","value","ThemePropertyException","getThemeStringProp","toString","getThemeNumberProp","themeProp"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\"\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":";;;;;;;;;;;;;AACA;;AAEA;;AAIA;AACA;AACO,IAAMA,OAAO,GAAG,SAAVA,OAAU,GAID;EAAA,IAHpBC,KAGoB,uEAHG,EAGH;EAAA,IAFpBC,IAEoB,uEAFL,EAEK;EAAA,IADpBC,YACoB,uEADW,EACX;EACpB,OAAOD,IAAI,KAAK,EAAT,GAAcC,YAAd,GAA6B,
|
|
1
|
+
{"version":3,"file":"themeProps.js","names":["getProp","theme","path","defaultValue","get","getThemeProp","value","ThemePropertyException","getThemeStringProp","toString","getThemeNumberProp","themeProp"],"sources":["../../../src/react-theme/utils/themeProps.js"],"sourcesContent":["// @flow\nimport { get } from \"../../utils/helpers/objects\";\n\nimport { ThemePropertyException } from \"../../exceptions\";\n\nimport type { Theme, ThemePropValue } from \"../types\";\n\n/**\n */\nexport const getProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ?ThemePropValue => {\n return path === \"\" ? defaultValue : get(theme, path, defaultValue);\n};\n\n/**\n */\nexport const getThemeProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: ThemePropValue = \"\"\n): ThemePropValue => {\n const value = getProp(theme, path, defaultValue);\n\n if (\n value != null &&\n (typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"object\")\n ) {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, number or plain object, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeStringProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: string = \"\"\n): string => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"string\") {\n return value;\n } else if (typeof value === \"number\") {\n return value.toString();\n }\n\n throw new ThemePropertyException(\n `${path} is not a string, but: ${typeof value}`\n );\n};\n\n/**\n */\nexport const getThemeNumberProp = (\n theme: $Shape<Theme> = {},\n path: string = \"\",\n defaultValue: number = 0\n): number => {\n const value = getProp(theme, path, defaultValue);\n\n if (typeof value === \"number\") {\n return value;\n }\n\n throw new ThemePropertyException(\n `${path} is not a number, but: ${typeof value}`\n );\n};\n\n/*\n * Retrieve property value from theme property of styled component\n */\n/**\n */\nexport const themeProp =\n (\n path: string,\n defaultValue?: ThemePropValue\n ): (({ theme: Theme }) => ThemePropValue) =>\n ({ theme }: { theme: Theme }) =>\n getThemeProp(theme, path, defaultValue);\n"],"mappings":";;;;;;;;;;;;;AACA;;AAEA;;AAIA;AACA;AACO,IAAMA,OAAO,GAAG,SAAVA,OAAU,GAID;EAAA,IAHpBC,KAGoB,uEAHG,EAGH;EAAA,IAFpBC,IAEoB,uEAFL,EAEK;EAAA,IADpBC,YACoB,uEADW,EACX;EACpB,OAAOD,IAAI,KAAK,EAAT,GAAcC,YAAd,GAA6B,IAAAC,YAAA,EAAIH,KAAJ,EAAWC,IAAX,EAAiBC,YAAjB,CAApC;AACD,CANM;AAQP;AACA;;;;;AACO,IAAME,YAAY,GAAG,SAAfA,YAAe,GAIP;EAAA;;EAAA,IAHnBJ,KAGmB,uEAHI,EAGJ;EAAA,IAFnBC,IAEmB,uEAFJ,EAEI;EAAA,IADnBC,YACmB,uEADY,EACZ;EACnB,IAAMG,KAAK,GAAGN,OAAO,CAACC,KAAD,EAAQC,IAAR,EAAcC,YAAd,CAArB;;EAEA,IACEG,KAAK,IAAI,IAAT,KACC,OAAOA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AAD,EAAQC,IAAR,EAAcC,YAAd,CADd;EAAA,CAJA;AAAA,CADK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","names":["receiveLocale","locale","type","payload","updateLocale","dispatch","setLocales","locales"],"sources":["../../../src/redux/_i18n/actions.js"],"sourcesContent":["// @flow\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport type Locales from \"../../i18n/Locales\";\nimport type { SetLocalesAction, UpdateLocaleAction } from \"./types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n * Update current locale\n */\nexport const receiveLocale = (locale: string): UpdateLocaleAction => ({\n type: \"UPDATE_LOCALE\",\n payload: locale,\n});\n\n/**\n * Change locale of application and redirect\n */\nexport const updateLocale =\n (locale: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n dispatch(receiveLocale(locale));\n\n dispatch(finishProgress());\n };\n\n/**\n */\nexport const setLocales = (\n locales: Locales,\n locale: string\n): SetLocalesAction => ({\n type: \"SET_LOCALES\",\n payload: {\n locales,\n locale,\n },\n});\n"],"mappings":";;;;;;;AACA;;AAMA;AACA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,MAAD;EAAA,OAAyC;IACpEC,IAAI,EAAE,eAD8D;IAEpEC,OAAO,EAAEF;EAF2D,CAAzC;AAAA,CAAtB;AAKP;AACA;AACA;;;;;AACO,IAAMG,YAAY,GACvB,SADWA,YACX,CAACH,MAAD;EAAA,OACA,UAACI,QAAD,EAAc;IACZA,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"actions.js","names":["receiveLocale","locale","type","payload","updateLocale","dispatch","startProgress","finishProgress","setLocales","locales"],"sources":["../../../src/redux/_i18n/actions.js"],"sourcesContent":["// @flow\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport type Locales from \"../../i18n/Locales\";\nimport type { SetLocalesAction, UpdateLocaleAction } from \"./types\";\nimport type { ThunkAction } from \"../types\";\n\n/**\n * Update current locale\n */\nexport const receiveLocale = (locale: string): UpdateLocaleAction => ({\n type: \"UPDATE_LOCALE\",\n payload: locale,\n});\n\n/**\n * Change locale of application and redirect\n */\nexport const updateLocale =\n (locale: string): ThunkAction =>\n (dispatch) => {\n dispatch(startProgress());\n dispatch(receiveLocale(locale));\n\n dispatch(finishProgress());\n };\n\n/**\n */\nexport const setLocales = (\n locales: Locales,\n locale: string\n): SetLocalesAction => ({\n type: \"SET_LOCALES\",\n payload: {\n locales,\n locale,\n },\n});\n"],"mappings":";;;;;;;AACA;;AAMA;AACA;AACA;AACO,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,MAAD;EAAA,OAAyC;IACpEC,IAAI,EAAE,eAD8D;IAEpEC,OAAO,EAAEF;EAF2D,CAAzC;AAAA,CAAtB;AAKP;AACA;AACA;;;;;AACO,IAAMG,YAAY,GACvB,SADWA,YACX,CAACH,MAAD;EAAA,OACA,UAACI,QAAD,EAAc;IACZA,QAAQ,CAAC,IAAAC,gCAAA,GAAD,CAAR;IACAD,QAAQ,CAACL,aAAa,CAACC,MAAD,CAAd,CAAR;IAEAI,QAAQ,CAAC,IAAAE,iCAAA,GAAD,CAAR;EACD,CAND;AAAA,CADK;AASP;AACA;;;;;AACO,IAAMC,UAAU,GAAG,SAAbA,UAAa,CACxBC,OADwB,EAExBR,MAFwB;EAAA,OAGF;IACtBC,IAAI,EAAE,aADgB;IAEtBC,OAAO,EAAE;MACPM,OAAO,EAAPA,OADO;MAEPR,MAAM,EAANA;IAFO;EAFa,CAHE;AAAA,CAAnB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reducer.js","names":["updateLocale","state","locale","Cache","clear","setLocales","locales","initialState","Locales","I18nReducer","action","type","payload"],"sources":["../../../src/redux/_i18n/reducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state, locale) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (state, { locale, locales }) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: \"en\",\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;;;;;AAMA;AACA;AACA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,MAAR,EAAmB;EACtC;EACA,
|
|
1
|
+
{"version":3,"file":"reducer.js","names":["updateLocale","state","locale","setCookie","Cache","clear","setLocales","locales","initialState","Locales","I18nReducer","action","type","payload"],"sources":["../../../src/redux/_i18n/reducer.js"],"sourcesContent":["// @flow\nimport Cache from \"../../utils/browser/Cache\";\nimport { setCookie } from \"../../utils/browser/Cookies\";\n\nimport Locales from \"../../i18n/Locales\";\n\nimport type { Reducer } from \"redux\";\nimport type { I18nState } from \"./types\";\nimport type { ReduxAction } from \"../types\";\n\n/**\n */\nconst updateLocale = (state, locale) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n // clear cache because of cached contributions\n Cache.clear();\n\n return {\n ...state,\n locale,\n };\n};\n\n/**\n */\nconst setLocales = (state, { locale, locales }) => {\n // set locale in cookie\n setCookie(\"locale\", locale);\n\n if (locale) {\n return {\n ...state,\n locales,\n locale,\n };\n }\n\n return {\n ...state,\n locales,\n };\n};\n\n// REDUCER\nconst initialState: I18nState = {\n locales: new Locales(),\n locale: \"en\",\n};\n\n/**\n * Form reducer\n */\nexport const I18nReducer: Reducer<I18nState, ReduxAction> = (\n state = initialState,\n action = void 0\n) => {\n if (!action) {\n return state;\n }\n\n switch (action.type) {\n case \"SET_LOCALES\":\n return setLocales(state, action.payload);\n\n case \"UPDATE_LOCALE\":\n return updateLocale(state, action.payload);\n\n default:\n return state;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AAEA;;;;;;AAMA;AACA;AACA,IAAMA,YAAY,GAAG,SAAfA,YAAe,CAACC,KAAD,EAAQC,MAAR,EAAmB;EACtC;EACA,IAAAC,kBAAA,EAAU,QAAV,EAAoBD,MAApB,EAFsC,CAItC;;EACAE,cAAA,CAAMC,KAAN;;EAEA,uCACKJ,KADL;IAEEC,MAAM,EAANA;EAFF;AAID,CAXD;AAaA;AACA;;;AACA,IAAMI,UAAU,GAAG,SAAbA,UAAa,CAACL,KAAD,QAAgC;EAAA,IAAtBC,MAAsB,QAAtBA,MAAsB;EAAA,IAAdK,OAAc,QAAdA,OAAc;EACjD;EACA,IAAAJ,kBAAA,EAAU,QAAV,EAAoBD,MAApB;;EAEA,IAAIA,MAAJ,EAAY;IACV,uCACKD,KADL;MAEEM,OAAO,EAAPA,OAFF;MAGEL,MAAM,EAANA;IAHF;EAKD;;EAED,uCACKD,KADL;IAEEM,OAAO,EAAPA;EAFF;AAID,CAhBD,C,CAkBA;;;AACA,IAAMC,YAAuB,GAAG;EAC9BD,OAAO,EAAE,IAAIE,gBAAJ,EADqB;EAE9BP,MAAM,EAAE;AAFsB,CAAhC;AAKA;AACA;AACA;;AACO,IAAMQ,WAA4C,GAAG,SAA/CA,WAA+C,GAGvD;EAAA,IAFHT,KAEG,uEAFKO,YAEL;EAAA,IADHG,MACG,uEADM,KAAK,CACX;;EACH,IAAI,CAACA,MAAL,EAAa;IACX,OAAOV,KAAP;EACD;;EAED,QAAQU,MAAM,CAACC,IAAf;IACE,KAAK,aAAL;MACE,OAAON,UAAU,CAACL,KAAD,EAAQU,MAAM,CAACE,OAAf,CAAjB;;IAEF,KAAK,eAAL;MACE,OAAOb,YAAY,CAACC,KAAD,EAAQU,MAAM,CAACE,OAAf,CAAnB;;IAEF;MACE,OAAOZ,KAAP;EARJ;AAUD,CAlBM"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","names":["setModel","key","model","connectKey","type","payload","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","isInvalidUsername","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","loadModelPromise","resolve","then","response","FINISHED","catch","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/actions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestBaseOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestBaseOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (\n errorResponse.isResourceNotFoundAfterReload ||\n errorResponse.isInvalidUsername\n ) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestBaseOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestBaseOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAcA;AACA;AACO,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CACtBC,GADsB,EAEtBC,KAFsB,EAGH;EACnB;EACAA,KAAK,CAACC,UAAN,GAAmBF,GAAnB;EACA,OAAO;IACLG,IAAI,EAAE,eADD;IAELC,OAAO,EAAE;MACPJ,GAAG,EAAHA,GADO;MAEPC,KAAK,EAALA;IAFO;EAFJ,CAAP;AAOD,CAbM;AAeP;AACA;;;;;AACO,IAAMI,WAAW,GAAG,SAAdA,WAAc,CAACJ,KAAD;EAAA,OAA+C;IACxEE,IAAI,EAAE,kBADkE;IAExEC,OAAO,EAAEH;EAF+D,CAA/C;AAAA,CAApB;AAKP;AACA;;;;;AACO,IAAMK,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACN,GAAD;EAAA,OAA0C;IACxEG,IAAI,EAAE,sBADkE;IAExEC,OAAO,EAAEJ;EAF+D,CAA1C;AAAA,CAAzB;AAKP;AACA;AACA;;;;;AACO,IAAMO,cAAc,GAAG,SAAjBA,cAAiB;EAAA,OAA6B;IACzDJ,IAAI,EAAE;EADmD,CAA7B;AAAA,CAAvB;AAIP;AACA;;;;;AACO,IAAMK,YAAY,GAAG,SAAfA,YAAe,CAC1BR,GAD0B,EAE1BS,MAF0B;EAAA,OAGF;IACxBN,IAAI,EAAE,kBADkB;IAExBC,OAAO,EAAE;MAAEJ,GAAG,EAAHA,GAAF;MAAOS,MAAM,EAANA;IAAP;EAFe,CAHE;AAAA,CAArB;AAQP;AACA;;;;;AACA,IAAMC,sBAAsB,GAAG,SAAzBA,sBAAyB,CAC7BV,GAD6B,EAE7BC,KAF6B,EAG7BU,aAH6B,EAIU;EACvC,IAAIA,aAAJ,EAAmB;IACjB;IACA,IAAI,OAAOA,aAAa,CAAC,QAAD,CAApB,KAAmC,UAAvC,EAAmD;MACjD,IAAMC,WAAW,GAAGD,aAAa,CAACE,KAAd,EAApB;MACAD,WAAW,CAACE,MAAZ,CAAmBb,KAAnB;MAEA,OAAOI,WAAW,CAACO,WAAD,CAAlB;IACD;;IAED,MAAM,IAAIG,KAAJ,8DACkDf,GADlD,kDAAN;EAGD;;EAED,OAAOD,QAAQ,CAACC,GAAD,EAAMC,KAAN,CAAf;AACD,CApBD;AAsBA;AACA;;;AACO,IAAMe,SAAS,GAAG,SAAZA,SAAY,CACvBhB,GADuB,EAEvBiB,IAFuB,EAGvBC,OAHuB;EAAA;;EAAA,OAIF;IACrBf,IAAI,EAAE,iBADe;IAErBC,OAAO,EAAE;MACPa,IAAI,EAAEA,IAAI,YAAYE,aAAhB,GAAuBF,IAAvB,GAA8B,IAAIE,aAAJ,CAASF,IAAT,CAD7B;MAEPG,MAAM,qBAAEF,OAAF,aAAEA,OAAF,uBAAEA,OAAO,CAAEE,MAAX,6DAAqBC,
|
|
1
|
+
{"version":3,"file":"actions.js","names":["setModel","key","model","connectKey","type","payload","updateModel","removeModelByKey","resetModularUI","updateStatus","status","loadModelSuccessAction","modelToUpdate","clonedModel","clone","update","Error","loadModel","href","options","Href","method","HTTP_METHODS","GET","data","locale","childmodels","targetModel","successAction","errorAction","error","errorResponse","ErrorResponse","isChangePassword","isResourceNotFoundAfterReload","isInvalidUsername","MODULARUI_STATUS","ERROR","loadModularUI","dispatch","LOADING","startProgress","loadModelPromise","resolve","then","response","FINISHED","finishProgress","catch","handleError","reloadModel","selfhref","isReload"],"sources":["../../../src/redux/_modularui/actions.js"],"sourcesContent":["// @flow\nimport { HTTP_METHODS, MODULARUI_STATUS } from \"../../constants/Constants\";\nimport Href from \"../../models/href/Href\";\nimport ErrorResponse from \"../../models/error/ErrorResponse\";\nimport { finishProgress, startProgress } from \"../actions/ProgressIndicator\";\nimport { handleError } from \"../actions/Error\";\n\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { Dispatch, ThunkAction } from \"../types\";\nimport type {\n ModularUIAction,\n SetModelAction,\n UpdateModelAction,\n RemoveModelByKeyAction,\n ResetModularUIAction,\n UpdateStatusAction,\n} from \"./types\";\nimport type { RequestBaseOptions } from \"../../utils/fetch/types\";\n\n/**\n */\nexport const setModel = (\n key: string,\n model: ModularUIModel\n): SetModelAction => {\n // set key on model for later reference\n model.connectKey = key;\n return {\n type: \"MODULARUI/SET\",\n payload: {\n key,\n model,\n },\n };\n};\n\n/**\n */\nexport const updateModel = (model: ModularUIModel): UpdateModelAction => ({\n type: \"MODULARUI/UPDATE\",\n payload: model,\n});\n\n/**\n */\nexport const removeModelByKey = (key: string): RemoveModelByKeyAction => ({\n type: \"MODULARUI/REMOVE_KEY\",\n payload: key,\n});\n\n/**\n * Removes all models except the application model from the modular ui reducer\n */\nexport const resetModularUI = (): ResetModularUIAction => ({\n type: \"MODULARUI/RESET\",\n});\n\n/**\n */\nexport const updateStatus = (\n key: string,\n status: $Keys<typeof MODULARUI_STATUS>\n): UpdateStatusAction => ({\n type: \"MODULARUI/STATUS\",\n payload: { key, status },\n});\n\n/**\n */\nconst loadModelSuccessAction = (\n key: string,\n model: ModularUIModel,\n modelToUpdate\n): UpdateModelAction | SetModelAction => {\n if (modelToUpdate) {\n // $FlowFixMe[prop-missing]\n if (typeof modelToUpdate[\"update\"] === \"function\") {\n const clonedModel = modelToUpdate.clone();\n clonedModel.update(model);\n\n return updateModel(clonedModel);\n }\n\n throw new Error(\n `loadModel action: updateModel is set as option for ${key}, but the model is missing an update methode`\n );\n }\n\n return setModel(key, model);\n};\n\n/**\n */\nexport const loadModel = (\n key: string,\n href: Href | string,\n options?: RequestBaseOptions\n): ModularUIAction => ({\n type: \"MODULARUI/FETCH\",\n payload: {\n href: href instanceof Href ? href : new Href(href),\n method: options?.method ?? HTTP_METHODS.GET,\n data: options?.data,\n locale: options?.locale ?? \"en\",\n childmodels: options?.childmodels,\n targetModel: options?.targetModel,\n /**\n */\n successAction: (model) =>\n loadModelSuccessAction(key, model, options?.updateModel),\n /**\n */\n errorAction: (error) => {\n const errorResponse = new ErrorResponse(error, key);\n if (errorResponse.isChangePassword) {\n return {\n type: \"NO_ACTION\",\n };\n } else if (\n errorResponse.isResourceNotFoundAfterReload ||\n errorResponse.isInvalidUsername\n ) {\n return removeModelByKey(key);\n }\n\n return updateStatus(key, MODULARUI_STATUS.ERROR);\n },\n },\n});\n\n/**\n */\nexport const loadModularUI =\n (\n key: string,\n href: Href | string,\n options?: RequestBaseOptions\n ): ThunkAction =>\n (dispatch: Dispatch) => {\n dispatch(updateStatus(key, MODULARUI_STATUS.LOADING));\n dispatch(startProgress());\n\n const loadModelPromise = dispatch(loadModel(key, href, options));\n\n return Promise.resolve(loadModelPromise)\n .then((response) => {\n if (response?.type === \"FINISH_PROGRESS\") {\n dispatch(updateStatus(key, MODULARUI_STATUS.FINISHED));\n }\n\n return dispatch(finishProgress());\n })\n .catch((error) => dispatch(handleError(error)));\n };\n\n/**\n */\nexport const reloadModel = (\n model: ModularUIModel,\n options?: RequestBaseOptions\n): ThunkAction =>\n loadModularUI(model.connectKey, model.selfhref, {\n ...options,\n isReload: true,\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;AAcA;AACA;AACO,IAAMA,QAAQ,GAAG,SAAXA,QAAW,CACtBC,GADsB,EAEtBC,KAFsB,EAGH;EACnB;EACAA,KAAK,CAAC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C,KAAvB,CAAnB;MACD;IA3BM;EAFY,CAJE;AAAA,CAAlB;AAqCP;AACA;;;;;AACO,IAAMC,aAAa,GACxB,SADWA,aACX,CACErC,GADF,EAEEiB,IAFF,EAGEC,OAHF;EAAA,OAKA,UAACoB,QAAD,EAAwB;IACtBA,QAAQ,CAAC9B,YAAY,CAACR,GAAD,EAAMmC,2BAAA,CAAiBI,OAAvB,CAAb,CAAR;IACAD,QAAQ,CAAC,IAAAE,gCAAA,GAAD,CAAR;IAEA,IAAMC,gBAAgB,GAAGH,QAAQ,CAACtB,SAAS,CAAChB,GAAD,EAAMiB,IAAN,EAAYC,OAAZ,CAAV,CAAjC;IAEA,OAAO,iBAAQwB,OAAR,CAAgBD,gBAAhB,EACJE,IADI,CACC,UAACC,QAAD,EAAc;MAClB,IAAI,CAAAA,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEzC,IAAV,MAAmB,iBAAvB,EAA0C;QACxCmC,QAAQ,CAAC9B,YAAY,CAACR,GAAD,EAAMmC,2BAAA,CAAiBU,QAAvB,CAAb,CAAR;MACD;;MAED,OAAOP,QAAQ,CAAC,IAAAQ,iCAAA,GAAD,CAAf;IACD,CAPI,EAQJC,KARI,CAQE,UAAClB,KAAD;MAAA,OAAWS,QAAQ,CAAC,IAAAU,kBAAA,EAAYnB,KAAZ,CAAD,CAAnB;IAAA,CARF,CAAP;EASD,CApBD;AAAA,CADK;AAuBP;AACA;;;;;AACO,IAAMoB,WAAW,GAAG,SAAdA,WAAc,CACzBhD,KADyB,EAEzBiB,OAFyB;EAAA,OAIzBmB,aAAa,CAACpC,KAAK,CAACC,UAAP,EAAmBD,KAAK,CAACiD,QAAzB,kCACRhC,OADQ;IAEXiC,QAAQ,EAAE;EAFC,GAJY;AAAA,CAApB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connector.js","names":["connector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","location","url","displayName","contextId","modelEntry","modelKey","model","connectKey","handleManualReload","reloadOptions","handleFetch","href","fetchOptions","reload","state","doReload","isReload","locale","i18n","newProps","status","lastModification","Boolean"],"sources":["../../../src/redux/_modularui/connector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel, removeModelByKey } from \"./actions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./modularuiUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\n/**\n */\nconst connector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false }\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(loadModularUI(modelKey, href, fetchOptions));\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, { ...otherOptions, isReload: true })\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useSelector((state) => state.i18n.locale);\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry ? modelEntry.model : null,\n location,\n status: modelEntry ? modelEntry.status : null,\n lastModification: modelEntry ? modelEntry.lastModification : null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default connector;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;AAmBA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAChBC,IADgB,EAEhBC,QAFgB,EAI8C;EAAA,IAD9DC,OAC8D,uEADlC;IAAEC,QAAQ,EAAE,MAAZ;IAAoBC,eAAe,EAAE;EAArC,CACkC;EAC9D,wBAIIF,OAJJ,CACEC,QADF;EAAA,IACEA,QADF,kCACa,MADb;EAAA,4BAIID,OAJJ,CAEEE,eAFF;EAAA,IAEEA,eAFF,sCAEoB,KAFpB;EAAA,IAGKC,YAHL,0CAIIH,OAJJ;EAMA,OAAO,UAACI,SAAD,EAAmC;IACxC,IAAMC,gBAAgB,GAAG,SAAnBA,gBAAmB,CAACC,KAAD,EAAgB;MAAA;;MACvC,IAAMC,QAAQ,GAAG,
|
|
1
|
+
{"version":3,"file":"connector.js","names":["connector","name","resource","options","propName","removeOnUnmount","otherOptions","Component","WrappedComponent","props","dispatch","useDispatch","location","useLocation","url","useUrl","displayName","getDisplayName","contextId","modelEntry","useModularUI","modelKey","model","connectKey","handleManualReload","reloadOptions","reloadModel","handleFetch","href","fetchOptions","loadModularUI","reload","state","doReload","useReload","useEffect","isReload","removeModelByKey","locale","useSelector","i18n","newProps","status","lastModification","Boolean"],"sources":["../../../src/redux/_modularui/connector.js"],"sourcesContent":["// @flow\nimport { useEffect } from \"react\";\nimport { useDispatch, useSelector } from \"react-redux\";\nimport { useLocation } from \"react-router\";\n\nimport { loadModularUI, reloadModel, removeModelByKey } from \"./actions\";\n\nimport Href from \"../../models/href/Href\";\nimport { getDisplayName } from \"../../react/utils\";\n\nimport { useUrl, useReload } from \"./modularuiUtils\";\nimport { useModularUI } from \"../../hooks/useModularUI\";\n\nimport type { ComponentType, Node } from \"react\";\nimport type { Location } from \"react-router\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type { ModularUIOptions } from \"./types\";\n\nexport type InjectedProps = {\n +modelKey: string,\n +location: Location,\n +status: string | null,\n +lastModification: number | null,\n +hasModel: boolean,\n +locale: string,\n +fetchModularUI: (href: string | Href, fetchOptions: Object) => void,\n +reloadModel: (model: ModularUIModel, options: Object) => void,\n +data?: ?ModularUIModel,\n};\n\n/**\n */\nconst connector = (\n name: string,\n resource: string | Function,\n options: ModularUIOptions = { propName: \"data\", removeOnUnmount: false }\n): ((Component: ComponentType<any>) => (props: any) => Node) => {\n const {\n propName = \"data\",\n removeOnUnmount = false,\n ...otherOptions\n } = options;\n\n return (Component: ComponentType<any>) => {\n const WrappedComponent = (props: any) => {\n const dispatch = useDispatch();\n const location = useLocation();\n\n const url = useUrl(resource, { location, ...props });\n const displayName = getDisplayName(Component, name, props.contextId);\n\n // Load the model through the useModUI hook\n const modelEntry = useModularUI(displayName, url, otherOptions);\n const modelKey = modelEntry?.model?.connectKey;\n\n // handle manual reload of model\n const handleManualReload = (\n model: ModularUIModel,\n reloadOptions?: Object\n ) => {\n dispatch(reloadModel(model, reloadOptions));\n };\n\n // Provide connected models with a fetchModularUI method to be able\n // to run the loadModularUI action from a handler / callback in the component\n const handleFetch = (href: string | Href, fetchOptions: Object) => {\n dispatch(loadModularUI(modelKey, href, fetchOptions));\n };\n\n // Check if current model needs a reload\n const reload = location?.state?.reload ?? 0;\n const doReload = useReload(modelEntry, reload);\n useEffect(() => {\n if (doReload) {\n dispatch(\n loadModularUI(modelKey, url, { ...otherOptions, isReload: true })\n );\n }\n }, [dispatch, doReload, url, modelKey]);\n\n // Remove model when hoc unloads\n useEffect(() => {\n return () => {\n if (removeOnUnmount) {\n dispatch(removeModelByKey(modelKey));\n }\n };\n }, [dispatch, modelKey]);\n\n // Create new properties object to inject modularui properties to own props\n const locale = useSelector((state) => state.i18n.locale);\n const newProps: InjectedProps = {\n modelKey,\n [propName]: modelEntry ? modelEntry.model : null,\n location,\n status: modelEntry ? modelEntry.status : null,\n lastModification: modelEntry ? modelEntry.lastModification : null,\n hasModel: Boolean(modelEntry),\n locale,\n fetchModularUI: handleFetch,\n reloadModel: handleManualReload,\n };\n\n return <Component {...props} {...newProps} />;\n };\n\n WrappedComponent.displayName = `BI.modularui(${getDisplayName(\n WrappedComponent,\n name\n )}`;\n\n return WrappedComponent;\n };\n};\n\nexport default connector;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;AAmBA;AACA;AACA,IAAMA,SAAS,GAAG,SAAZA,SAAY,CAChBC,IADgB,EAEhBC,QAFgB,EAI8C;EAAA,IAD9DC,OAC8D,uEADlC;IAAEC,QAAQ,EAAE,MAAZ;IAAoBC,eAAe,EAAE;EAArC,CACkC;EAC9D,wBAIIF,OAJJ,CACEC,QADF;EAAA,IACEA,QADF,kCACa,MADb;EAAA,4BAIID,OAJJ,C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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","names":["createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","Error","errorHandler","errorAction","err","errorResult","handleFetch","action","payload","requestOptions","modularuiRequest","fetch","modularuiMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/middleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction } from \"./types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: Class<ModularUIModel>,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions) => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (next, dispatch, successAction, model) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (next, dispatch, errorAction, err) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (action: ModularUIAction, locale, dispatch, next) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularuiMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;;;AAuBA;AACA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,SAAD,EAA+B;EAAA;;EACnD,IAAMC,OAAO,GAAG,IAAIC,yBAAJ,CAAqBF,SAAS,CAACG,IAA/B,EAAqC;IACnDC,MAAM,EAAEJ,SAAS,CAACI,MAAV,IAAoBC,
|
|
1
|
+
{"version":3,"file":"middleware.js","names":["createRequest","modularui","request","ModularUIRequest","href","method","HTTP_METHODS","GET","data","locale","childmodels","isReload","targetModel","responseHandler","next","dispatch","successAction","model","successResult","then","result","catch","error","handleError","Error","finishProgress","errorHandler","errorAction","err","errorResult","handleFetch","action","startProgress","payload","requestOptions","modularuiRequest","fetch","modularuiMiddleware","api","type","getState","i18n"],"sources":["../../../src/redux/_modularui/middleware.js"],"sourcesContent":["// @flow\nimport ModularUIRequest from \"../../modularui/ModularUIRequest\";\nimport { HTTP_METHODS } from \"../../constants/Constants\";\n\nimport { startProgress, finishProgress } from \"../actions/ProgressIndicator\";\n\nimport { handleError } from \"../actions/Error\";\n\nimport type { Middleware, MiddlewareAPI } from \"redux\";\nimport type {\n ReduxAction,\n ReduxState,\n Dispatch,\n PossibleAction,\n} from \"../types\";\nimport type { ModularUIModel } from \"../../models/types\";\nimport type Href from \"../../models/href/Href\";\nimport type { ModularUIAction } from \"./types\";\n\ntype RequestOptions = {\n href: Href,\n method?: $Keys<typeof HTTP_METHODS>,\n data?: string | { [key: string]: string },\n locale: string,\n childmodels?: boolean,\n targetModel?: Class<ModularUIModel>,\n isReload?: boolean,\n};\n\n/**\n * Symbol key that carries API call info interpreted by this Redux middleware.\n */\nconst createRequest = (modularui: RequestOptions) => {\n const request = new ModularUIRequest(modularui.href, {\n method: modularui.method || HTTP_METHODS.GET,\n data: modularui.data || {},\n locale: modularui.locale,\n childmodels: modularui.childmodels ?? true,\n isReload: modularui.isReload,\n });\n\n if (modularui.targetModel) {\n request.targetModel = modularui.targetModel;\n }\n\n return request;\n};\n\n/**\n */\nconst responseHandler = (next, dispatch, successAction, model) => {\n if (successAction) {\n const successResult = successAction(model);\n\n if (successResult instanceof Promise) {\n successResult\n .then((result) => {\n dispatch(result);\n })\n .catch((error) => {\n next(handleError(error));\n });\n } else {\n try {\n dispatch(successResult);\n } catch (error) {\n throw new Error(\n `Result of successResult is not a valid redux action: ${error}`\n );\n }\n }\n }\n\n return next(finishProgress());\n};\n\n/**\n */\nconst errorHandler = (next, dispatch, errorAction, err) => {\n dispatch(finishProgress());\n\n if (errorAction) {\n const errorResult = errorAction(err);\n\n if (errorResult instanceof Promise) {\n errorResult.then((result) => dispatch(result));\n } else {\n dispatch(errorResult);\n }\n }\n\n return next(handleError(err));\n};\n\n/**\n */\nconst handleFetch = (action: ModularUIAction, locale, dispatch, next) => {\n dispatch(startProgress());\n\n const { successAction, errorAction, ...requestOptions } = action.payload;\n requestOptions.locale = locale;\n\n const modularuiRequest = createRequest(requestOptions);\n\n return modularuiRequest\n .fetch()\n .then((model) => responseHandler(next, dispatch, successAction, model))\n .catch((error) => errorHandler(next, dispatch, errorAction, error));\n};\n\n/**\n */\nexport const modularuiMiddleware: Middleware<\n ReduxState,\n ReduxAction,\n Dispatch\n> =\n (api: MiddlewareAPI<ReduxState, ReduxAction, Dispatch>) =>\n (next: Dispatch) =>\n (action: PossibleAction) => {\n if (action.type === \"MODULARUI/FETCH\") {\n return handleFetch(\n // $FlowExpectedError[incompatible-exact]\n action,\n api.getState().i18n.locale,\n api.dispatch,\n next\n );\n }\n\n return next(action);\n };\n"],"mappings":";;;;;;;;;;;;;AACA;;AACA;;AAEA;;AAEA;;;;AAuBA;AACA;AACA;AACA,IAAMA,aAAa,GAAG,SAAhBA,aAAgB,CAACC,SAAD,EAA+B;EAAA;;EACnD,IAAMC,OAAO,GAAG,IAAIC,yBAAJ,CAAqBF,SAAS,CAACG,IAA/B,EAAqC;IACnDC,MAAM,EAAEJ,SAAS,CAACI,MAAV,IAAoBC,uBAAA,CAAaC,GADU;IAEnDC,IAAI,EAAEP,SAAS,CAACO,IAAV,IAAkB,EAF2B;IAGnDC,MAAM,EAAER,SAAS,CAACQ,MAHiC;IAInDC,WAAW,2BAAET,SAAS,CAACS,WAAZ,yEAA2B,IAJa;IAKnDC,QAAQ,EAAEV,SAAS,CAACU;EAL+B,CAArC,CAAhB;;EAQA,IAAIV,SAAS,CAACW,WAAd,EAA2B;IACzBV,OAAO,CAACU,WAAR,GAAsBX,SAAS,CAACW,WAAhC;EACD;;EAED,OAAOV,OAAP;AACD,CAdD;AAgBA;AACA;;;AACA,IAAMW,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAOC,QAAP,EAAiBC,aAAjB,EAAgCC,KAAhC,EAA0C;EAChE,IAAID,aAAJ,EAAmB;IACjB,IAAME,aAA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