@zengenti/contensis-react-base 4.0.0-beta.1 → 4.0.0-beta.2
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/cjs/{App-cf7e3103.js → App-b56aca04.js} +139 -93
- package/{esm/App-6e8e803b.js.map → cjs/App-b56aca04.js.map} +1 -1
- package/cjs/{ChangePassword.container-a617190b.js → ChangePassword.container-ae35785e.js} +120 -62
- package/{esm/ChangePassword.container-ae0f9ce4.js.map → cjs/ChangePassword.container-ae35785e.js.map} +1 -1
- package/cjs/{ContensisDeliveryApi-9e32960d.js → ContensisDeliveryApi-4fcf049d.js} +71 -17
- package/{esm/ContensisDeliveryApi-c66b0cc3.js.map → cjs/ContensisDeliveryApi-4fcf049d.js.map} +1 -1
- package/cjs/CookieConstants-000427db.js.map +1 -1
- package/cjs/{RouteLoader-3e284fd6.js → RouteLoader-c06dccd5.js} +182 -63
- package/cjs/RouteLoader-c06dccd5.js.map +1 -0
- package/cjs/{ToJs-149fc5e1.js → ToJs-a8d8f3f0.js} +14 -6
- package/cjs/{ToJs-149fc5e1.js.map → ToJs-a8d8f3f0.js.map} +1 -1
- package/cjs/client.js +20 -14
- package/cjs/client.js.map +1 -1
- package/cjs/contensis-react-base.js +275 -139
- package/cjs/contensis-react-base.js.map +1 -1
- package/cjs/forms.js +717 -228
- package/cjs/forms.js.map +1 -1
- package/cjs/{fromJSLeaveImmer-7c363211.js → fromJSLeaveImmer-e74c673c.js} +4 -1
- package/cjs/{fromJSLeaveImmer-7c363211.js.map → fromJSLeaveImmer-e74c673c.js.map} +1 -1
- package/cjs/{reducers-9afb5f89.js → reducers-73a03ef4.js} +31 -10
- package/cjs/{reducers-9afb5f89.js.map → reducers-73a03ef4.js.map} +1 -1
- package/cjs/redux.js +4 -5
- package/cjs/redux.js.map +1 -1
- package/cjs/routing.js +6 -4
- package/cjs/routing.js.map +1 -1
- package/cjs/{sagas-e04b94c1.js → sagas-570f23ba.js} +286 -187
- package/cjs/{sagas-e04b94c1.js.map → sagas-570f23ba.js.map} +1 -1
- package/cjs/search.js +82 -56
- package/cjs/search.js.map +1 -1
- package/cjs/{selectors-46b689d0.js → selectors-14caa813.js} +6 -1
- package/cjs/selectors-14caa813.js.map +1 -0
- package/cjs/urls-6fcaf4c6.js.map +1 -1
- package/cjs/user.js +9 -4
- package/cjs/user.js.map +1 -1
- package/cjs/util.js +55 -35
- package/cjs/util.js.map +1 -1
- package/cjs/{version-79a027cb.js → version-34d91f68.js} +60 -26
- package/cjs/version-34d91f68.js.map +1 -0
- package/cjs/{version-afd4f77e.js → version-a410c88e.js} +6 -3
- package/cjs/{version-afd4f77e.js.map → version-a410c88e.js.map} +1 -1
- package/esm/{App-6e8e803b.js → App-83107d7e.js} +137 -91
- package/{cjs/App-cf7e3103.js.map → esm/App-83107d7e.js.map} +1 -1
- package/esm/{ChangePassword.container-ae0f9ce4.js → ChangePassword.container-76fd5e9b.js} +120 -62
- package/{cjs/ChangePassword.container-a617190b.js.map → esm/ChangePassword.container-76fd5e9b.js.map} +1 -1
- package/esm/{ContensisDeliveryApi-c66b0cc3.js → ContensisDeliveryApi-fe57a037.js} +71 -17
- package/{cjs/ContensisDeliveryApi-9e32960d.js.map → esm/ContensisDeliveryApi-fe57a037.js.map} +1 -1
- package/esm/CookieConstants-3d3b6531.js.map +1 -1
- package/esm/RouteLoader-29fd689a.js +310 -0
- package/esm/RouteLoader-29fd689a.js.map +1 -0
- package/esm/{ToJs-ae860aad.js → ToJs-df57f31d.js} +14 -6
- package/esm/{ToJs-ae860aad.js.map → ToJs-df57f31d.js.map} +1 -1
- package/esm/client.js +21 -15
- package/esm/client.js.map +1 -1
- package/esm/contensis-react-base.js +270 -136
- package/esm/contensis-react-base.js.map +1 -1
- package/esm/forms.js +717 -228
- package/esm/forms.js.map +1 -1
- package/esm/{fromJSLeaveImmer-e2dacd63.js → fromJSLeaveImmer-0114ffcf.js} +4 -1
- package/esm/{fromJSLeaveImmer-e2dacd63.js.map → fromJSLeaveImmer-0114ffcf.js.map} +1 -1
- package/esm/{reducers-3d5c37d1.js → reducers-aa8cef1e.js} +31 -10
- package/esm/{reducers-3d5c37d1.js.map → reducers-aa8cef1e.js.map} +1 -1
- package/esm/redux.js +7 -8
- package/esm/redux.js.map +1 -1
- package/esm/routing.js +3 -4
- package/esm/routing.js.map +1 -1
- package/esm/{sagas-933a8fc8.js → sagas-07e82e18.js} +239 -139
- package/esm/{sagas-933a8fc8.js.map → sagas-07e82e18.js.map} +1 -1
- package/esm/search.js +83 -57
- package/esm/search.js.map +1 -1
- package/esm/{selectors-01074974.js → selectors-691caf02.js} +6 -1
- package/esm/selectors-691caf02.js.map +1 -0
- package/esm/urls-eac9a747.js.map +1 -1
- package/esm/user.js +11 -6
- package/esm/user.js.map +1 -1
- package/esm/util.js +55 -35
- package/esm/util.js.map +1 -1
- package/esm/{version-346a9787.js → version-3d9911e2.js} +60 -26
- package/esm/version-3d9911e2.js.map +1 -0
- package/esm/{version-0fbd1b82.js → version-9f29becb.js} +6 -3
- package/esm/{version-0fbd1b82.js.map → version-9f29becb.js.map} +1 -1
- package/models/redux/appstate.d.ts +2 -3
- package/models/redux/store/history.d.ts +2 -2
- package/models/routing/components/Redirect.d.ts +5 -0
- package/models/routing/components/StaticRouteLoader.d.ts +6 -0
- package/models/routing/httpContext.d.ts +7 -0
- package/models/routing/index.d.ts +3 -0
- package/models/routing/redux/actions.d.ts +2 -3
- package/models/routing/routes.d.ts +11 -5
- package/models/util/ContensisDeliveryApi.d.ts +0 -1
- package/models/util/mergeStaticRoutes.d.ts +1 -0
- package/package.json +3 -5
- package/cjs/RouteLoader-3e284fd6.js.map +0 -1
- package/cjs/selectors-46b689d0.js.map +0 -1
- package/cjs/version-79a027cb.js.map +0 -1
- package/esm/RouteLoader-e3c5505f.js +0 -196
- package/esm/RouteLoader-e3c5505f.js.map +0 -1
- package/esm/selectors-01074974.js.map +0 -1
- package/esm/version-346a9787.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToJs-ae860aad.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/user/util/CookieHelper.class.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { StateType } from '~/config';\nimport { AppState } from '~/redux/appstate';\nimport { getImmutableOrJS as getIn } from '~/redux/util';\n\nexport const selectUserIsLoading = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isLoading']);\n\nexport const selectUserIsAuthenticated = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticated']);\n\nexport const selectUserIsAuthenticationError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticationError']);\n\nexport const selectUserIsError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isError']);\n\n/**\n * DEPRECATED 12/2021 - use selectUserErrorMessage instead\n * @param state AppState\n * @returns string\n */\nexport const selectUserAuthenticationErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectUserErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectClientCredentials = (\n state: AppState,\n returnType?: StateType\n) =>\n getIn(\n state,\n ['user', 'authenticationState', 'clientCredentials'],\n {},\n returnType\n );\n\nexport const selectUser = (state: AppState, returnType?: StateType) =>\n getIn(state, 'user', {}, returnType);\n\nexport const selectUserIsZengentiStaff = (state: AppState) =>\n getIn(state, ['user', 'isZengentiStaff']);\n\nexport const selectUserGuid = (state: AppState) => getIn(state, ['user', 'id']);\n\nexport const selectUsername = (state: AppState) =>\n getIn(state, ['user', 'username']);\n\nexport const selectUserEmail = (state: AppState) =>\n getIn(state, ['user', 'email']);\n\nexport const selectUserGroups = (state: AppState, returnType?: StateType) =>\n getIn(state, ['user', 'groups'], [], returnType);\n\nexport const selectUserSecurityToken = (state: AppState) =>\n getIn(state, [\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n\nexport const selectUserRegistration = (\n state: AppState,\n returnType?: StateType\n) => getIn(state, ['user', 'registration'], {}, returnType);\n\nexport const selectUserRegistrationError = (state: AppState) =>\n getIn(state, ['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = (state: AppState) =>\n getIn(state, ['user', 'registration', 'isLoading'], false);\n\nexport const selectUserRegistrationIsSuccess = (state: AppState) =>\n getIn(state, ['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'isSending']);\n\nexport const selectPasswordResetRequestSent = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'sent']);\n\nexport const selectPasswordResetRequestError = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'error']);\n\nexport const selectResetPasswordSending = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'isSending']);\n\nexport const selectResetPasswordSent = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'sent']);\n\nexport const selectResetPasswordError = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'error']);\n\nexport const selectChangePasswordSending = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'isSending']);\n\nexport const selectChangePasswordSent = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'sent']);\n\nexport const selectChangePasswordError = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'error']);\n","import { Group } from 'contensis-management-api/lib/models';\nimport { RequireLogin } from '~/routing/routes';\n\nexport const matchUserGroup = (\n userGroups: Group[] = [],\n requiredGroups: RequireLogin = []\n) => {\n if (\n !Array.isArray(requiredGroups) ||\n (Array.isArray(requiredGroups) && requiredGroups.length === 0)\n )\n return true;\n\n const groupMatch = requiredGroups.some(requiredGroup => {\n return userGroups.some(userGroup => {\n if (requiredGroup.id === userGroup.id) {\n return true;\n }\n if (requiredGroup.name === userGroup.name) {\n return true;\n }\n });\n });\n return groupMatch;\n};\n","import { useCookies } from 'react-cookie';\n\nconst COOKIE_VALID_DAYS = 1; // 0 = Session cookie\n\ntype CookieHook = ReturnType<typeof useCookies>;\ntype Cookies = { [k: string]: string };\ntype SetCookie = CookieHook[1];\ntype RemoveCookie = CookieHook[2];\n\n// CookieHelper is a class that takes in and lets us pass around the methods provided\n// by `useCookie` react hook in backend code that is connected to the universal-cookies\n// instance created in SSR middleware (and provides browser cookies)\nexport class CookieHelper {\n private cookies: Cookies;\n private setCookie: SetCookie;\n private removeCookie: RemoveCookie;\n\n get raw() {\n return this.cookies;\n }\n\n constructor(\n cookies: { [k: string]: string },\n setCookie: CookieHelper['setCookie'],\n removeCookie: CookieHelper['removeCookie']\n ) {\n this.cookies = cookies;\n this.setCookie = setCookie;\n this.removeCookie = removeCookie;\n }\n\n GetCookie(name: string) {\n const cookie = this.cookies[name];\n if (typeof cookie === 'undefined') {\n return null;\n }\n return cookie;\n }\n\n SetCookie(name: string, value: string, maxAgeDays = COOKIE_VALID_DAYS) {\n // update local cookies object as this is provided as a clone of `req.universalCookies`\n this.cookies[name] = value;\n\n // call the passed setCookie method so we can update the `universal-cookie` instance\n // with the change listener attached so the cookies can be set in SSR response\n if (maxAgeDays === 0) this.setCookie(name, value);\n else\n this.setCookie(name, value, {\n expires: addDays(new Date(), maxAgeDays),\n });\n }\n\n DeleteCookie(name: string) {\n // update local cookies object as this is provided as a clone of `req.universalCookies`\n delete this.cookies[name];\n\n this.removeCookie(name);\n }\n}\nconst addDays = (date = new Date(), days: number) => {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n};\n\nexport const mapCookieHeader = cookies =>\n typeof cookies === 'object'\n ? Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n : cookies;\n","/* eslint-disable react/display-name */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport React from 'react';\n\nexport const toJS =\n <Props extends { [key: string]: any }>(\n WrappedComponent: React.ComponentType<Props>\n ) =>\n (wrappedComponentProps: Props) => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce<Props>(\n (newProps: any, wrappedComponentProp) => {\n const propKey = wrappedComponentProp[KEY];\n const propValue = wrappedComponentProp[VALUE];\n newProps[propKey] =\n propValue && typeof propValue === 'object' && 'toJS' in propValue\n ? propValue.toJS()\n : propValue;\n return newProps as Props;\n },\n {} as Props\n );\n\n return <WrappedComponent {...propsJS} />;\n };\n"],"names":["selectUserIsLoading","state","getIn","selectUserIsAuthenticated","selectUserIsAuthenticationError","selectUserIsError","selectUserAuthenticationErrorMessage","selectUserErrorMessage","selectClientCredentials","returnType","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","selectUserRegistrationIsSuccess","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","selectChangePasswordSending","selectChangePasswordSent","selectChangePasswordError","matchUserGroup","userGroups","requiredGroups","Array","isArray","length","groupMatch","some","requiredGroup","userGroup","id","name","COOKIE_VALID_DAYS","CookieHelper","raw","cookies","constructor","setCookie","removeCookie","GetCookie","cookie","SetCookie","value","maxAgeDays","expires","addDays","Date","DeleteCookie","date","days","result","setDate","getDate","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","propKey","propValue","React","createElement"],"mappings":";;;MAIaA,mBAAmB,GAAIC,KAAe,IACjDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,WAAW,CAAC,EAAC;MAE/CE,yBAAyB,GAAIF,KAAe,IACvDC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,EAAC;MAErDG,+BAA+B,GAAIH,KAAe,IAC7DC,gBAAK,CAACD,KAAK,EAAE,CAAC,MAAM,EAAE,qBAAqB,EAAE,uBAAuB,CAAC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ACI,OAAO,CAACJ,IAAI,CAAC,CAAA;AAEzB,IAAA,IAAI,CAACO,YAAY,CAACP,IAAI,CAAC,CAAA;AACzB,GAAA;AACF,CAAA;AACA,MAAMc,OAAO,GAAGA,CAACG,IAAI,GAAG,IAAIF,IAAI,EAAE,EAAEG,IAAY,KAAK;AACnD,EAAA,MAAMC,MAAM,GAAG,IAAIJ,IAAI,CAACE,IAAI,CAAC,CAAA;EAC7BE,MAAM,CAACC,OAAO,CAACD,MAAM,CAACE,OAAO,EAAE,GAAGH,IAAI,CAAC,CAAA;AACvC,EAAA,OAAOC,MAAM,CAAA;AACf,CAAC;;AC/DD;MAIaG,IAAI,GAEbC,gBAA4C,IAE7CC,qBAA4B,IAAK;EAChC,MAAMC,GAAG,GAAG,CAAC,CAAA;EACb,MAAMC,KAAK,GAAG,CAAC,CAAA;AAEf,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,OAAO,CAACL,qBAAqB,CAAC,CAACM,MAAM,CAC1D,CAACC,QAAa,EAAEC,oBAAoB,KAAK;AACvC,IAAA,MAAMC,OAAO,GAAGD,oBAAoB,CAACP,GAAG,CAAC,CAAA;AACzC,IAAA,MAAMS,SAAS,GAAGF,oBAAoB,CAACN,KAAK,CAAC,CAAA;IAC7CK,QAAQ,CAACE,OAAO,CAAC,GACfC,SAAS,IAAI,OAAOA,SAAS,KAAK,QAAQ,IAAI,MAAM,IAAIA,SAAS,GAC7DA,SAAS,CAACZ,IAAI,EAAE,GAChBY,SAAS,CAAA;AACf,IAAA,OAAOH,QAAQ,CAAA;GAChB,EACD,EAAE,CACH,CAAA;AAED,EAAA,oBAAOI,KAAA,CAAAC,aAAA,CAACb,gBAAgB,EAAKI,OAAO,CAAI,CAAA;AAC1C;;;;"}
|
|
1
|
+
{"version":3,"file":"ToJs-df57f31d.js","sources":["../src/user/redux/selectors.ts","../src/user/util/matchGroups.ts","../src/user/util/CookieHelper.class.ts","../src/util/ToJs.tsx"],"sourcesContent":["import { StateType } from '~/config';\nimport { AppState } from '~/redux/appstate';\nimport { getImmutableOrJS as getIn } from '~/redux/util';\n\nexport const selectUserIsLoading = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isLoading']);\n\nexport const selectUserIsAuthenticated = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticated']);\n\nexport const selectUserIsAuthenticationError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isAuthenticationError']);\n\nexport const selectUserIsError = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'isError']);\n\n/**\n * DEPRECATED 12/2021 - use selectUserErrorMessage instead\n * @param state AppState\n * @returns string\n */\nexport const selectUserAuthenticationErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectUserErrorMessage = (state: AppState) =>\n getIn(state, ['user', 'authenticationState', 'errorMessage']);\n\nexport const selectClientCredentials = (\n state: AppState,\n returnType?: StateType\n) =>\n getIn(\n state,\n ['user', 'authenticationState', 'clientCredentials'],\n {},\n returnType\n );\n\nexport const selectUser = (state: AppState, returnType?: StateType) =>\n getIn(state, 'user', {}, returnType);\n\nexport const selectUserIsZengentiStaff = (state: AppState) =>\n getIn(state, ['user', 'isZengentiStaff']);\n\nexport const selectUserGuid = (state: AppState) => getIn(state, ['user', 'id']);\n\nexport const selectUsername = (state: AppState) =>\n getIn(state, ['user', 'username']);\n\nexport const selectUserEmail = (state: AppState) =>\n getIn(state, ['user', 'email']);\n\nexport const selectUserGroups = (state: AppState, returnType?: StateType) =>\n getIn(state, ['user', 'groups'], [], returnType);\n\nexport const selectUserSecurityToken = (state: AppState) =>\n getIn(state, [\n 'user',\n 'authenticationState',\n 'clientCredentials',\n 'contensisClassicToken',\n ]);\n\nexport const selectUserRegistration = (\n state: AppState,\n returnType?: StateType\n) => getIn(state, ['user', 'registration'], {}, returnType);\n\nexport const selectUserRegistrationError = (state: AppState) =>\n getIn(state, ['user', 'registration', 'error'], false);\n\nexport const selectUserRegistrationIsLoading = (state: AppState) =>\n getIn(state, ['user', 'registration', 'isLoading'], false);\n\nexport const selectUserRegistrationIsSuccess = (state: AppState) =>\n getIn(state, ['user', 'registration', 'success'], false);\n\nexport const selectPasswordResetRequestSending = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'isSending']);\n\nexport const selectPasswordResetRequestSent = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'sent']);\n\nexport const selectPasswordResetRequestError = (state: AppState) =>\n getIn(state, ['user', 'passwordResetRequest', 'error']);\n\nexport const selectResetPasswordSending = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'isSending']);\n\nexport const selectResetPasswordSent = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'sent']);\n\nexport const selectResetPasswordError = (state: AppState) =>\n getIn(state, ['user', 'resetPassword', 'error']);\n\nexport const selectChangePasswordSending = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'isSending']);\n\nexport const selectChangePasswordSent = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'sent']);\n\nexport const selectChangePasswordError = (state: AppState) =>\n getIn(state, ['user', 'changePassword', 'error']);\n","import { Group } from 'contensis-management-api/lib/models';\nimport { RequireLogin } from '~/routing/routes';\n\nexport const matchUserGroup = (\n userGroups: Group[] = [],\n requiredGroups: RequireLogin = []\n) => {\n if (\n !Array.isArray(requiredGroups) ||\n (Array.isArray(requiredGroups) && requiredGroups.length === 0)\n )\n return true;\n\n const groupMatch = requiredGroups.some(requiredGroup => {\n return userGroups.some(userGroup => {\n if (requiredGroup.id === userGroup.id) {\n return true;\n }\n if (requiredGroup.name === userGroup.name) {\n return true;\n }\n });\n });\n return groupMatch;\n};\n","import { useCookies } from 'react-cookie';\n\nconst COOKIE_VALID_DAYS = 1; // 0 = Session cookie\n\ntype CookieHook = ReturnType<typeof useCookies>;\ntype Cookies = { [k: string]: string };\ntype SetCookie = CookieHook[1];\ntype RemoveCookie = CookieHook[2];\n\n// CookieHelper is a class that takes in and lets us pass around the methods provided\n// by `useCookie` react hook in backend code that is connected to the universal-cookies\n// instance created in SSR middleware (and provides browser cookies)\nexport class CookieHelper {\n private cookies: Cookies;\n private setCookie: SetCookie;\n private removeCookie: RemoveCookie;\n\n get raw() {\n return this.cookies;\n }\n\n constructor(\n cookies: { [k: string]: string },\n setCookie: CookieHelper['setCookie'],\n removeCookie: CookieHelper['removeCookie']\n ) {\n this.cookies = cookies;\n this.setCookie = setCookie;\n this.removeCookie = removeCookie;\n }\n\n GetCookie(name: string) {\n const cookie = this.cookies[name];\n if (typeof cookie === 'undefined') {\n return null;\n }\n return cookie;\n }\n\n SetCookie(name: string, value: string, maxAgeDays = COOKIE_VALID_DAYS) {\n // update local cookies object as this is provided as a clone of `req.universalCookies`\n this.cookies[name] = value;\n\n // call the passed setCookie method so we can update the `universal-cookie` instance\n // with the change listener attached so the cookies can be set in SSR response\n if (maxAgeDays === 0) this.setCookie(name, value);\n else\n this.setCookie(name, value, {\n expires: addDays(new Date(), maxAgeDays),\n });\n }\n\n DeleteCookie(name: string) {\n // update local cookies object as this is provided as a clone of `req.universalCookies`\n delete this.cookies[name];\n\n this.removeCookie(name);\n }\n}\nconst addDays = (date = new Date(), days: number) => {\n const result = new Date(date);\n result.setDate(result.getDate() + days);\n return result;\n};\n\nexport const mapCookieHeader = cookies =>\n typeof cookies === 'object'\n ? Object.entries(cookies)\n .map(([name, value]) => `${name}=${value}`)\n .join('; ')\n : cookies;\n","/* eslint-disable react/display-name */\n/* eslint-disable @typescript-eslint/naming-convention */\nimport React from 'react';\n\nexport const toJS =\n <Props extends { [key: string]: any }>(\n WrappedComponent: React.ComponentType<Props>\n ) =>\n (wrappedComponentProps: Props) => {\n const KEY = 0;\n const VALUE = 1;\n\n const propsJS = Object.entries(wrappedComponentProps).reduce<Props>(\n (newProps: any, wrappedComponentProp) => {\n const propKey = wrappedComponentProp[KEY];\n const propValue = wrappedComponentProp[VALUE];\n newProps[propKey] =\n propValue && typeof propValue === 'object' && 'toJS' in propValue\n ? propValue.toJS()\n : propValue;\n return newProps as Props;\n },\n {} as Props\n );\n\n return <WrappedComponent {...propsJS} />;\n };\n"],"names":["selectUserIsLoading","state","getIn","selectUserIsAuthenticated","selectUserIsAuthenticationError","selectUserIsError","selectUserAuthenticationErrorMessage","selectUserErrorMessage","selectClientCredentials","returnType","selectUser","selectUserIsZengentiStaff","selectUserGuid","selectUsername","selectUserEmail","selectUserGroups","selectUserSecurityToken","selectUserRegistration","selectUserRegistrationError","selectUserRegistrationIsLoading","selectUserRegistrationIsSuccess","selectPasswordResetRequestSending","selectPasswordResetRequestSent","selectPasswordResetRequestError","selectResetPasswordSending","selectResetPasswordSent","selectResetPasswordError","selectChangePasswordSending","selectChangePasswordSent","selectChangePasswordError","matchUserGroup","userGroups","requiredGroups","Array","isArray","length","groupMatch","some","requiredGroup","userGroup","id","name","COOKIE_VALID_DAYS","CookieHelper","raw","cookies","constructor","setCookie","removeCookie","GetCookie","cookie","SetCookie","value","maxAgeDays","expires","addDays","Date","DeleteCookie","date","days","result","setDate","getDate","toJS","WrappedComponent","wrappedComponentProps","KEY","VALUE","propsJS","Object","entries","reduce","newProps","wrappedComponentProp","propKey","propValue"],"mappings":";;;MAIaA,mBAAmB,GAAIC,KAAD,IACjCC,gBAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,WAAhC,CAAR,EADA;MAGME,yBAAyB,GAAIF,KAAD,IACvCC,gBAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,iBAAhC,CAAR,EADA;MAGMG,+BAA+B,GAAIH,KAAD,IAC7CC,gBAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,uBAAhC,CAAR,EADA;MAGMI,iBAAiB,GAAIJ,KAAD,IAC/BC,gBAAK,CAACD,KAAD,EAAQ,CAAC,MAAD,EAAS,qBAAT,EAAgC,SAAhC,CAAR,EADA;AAGP;AACA;AACA;AACA;AACA;;AACO,MAAMK,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D,GAAA;;AA7CuB,CAAA;;AA+C1B,MAAMc,OAAO,GAAG,CAACG,IAAI,GAAG,IAAIF,IAAJ,EAAR,EAAoBG,IAApB,KAAqC;AACnD,EAAA,MAAMC,MAAM,GAAG,IAAIJ,IAAJ,CAASE,IAAT,CAAf,CAAA;AACAE,EAAAA,MAAM,CAACC,OAAP,CAAeD,MAAM,CAACE,OAAP,KAAmBH,IAAlC,CAAA,CAAA;AACA,EAAA,OAAOC,MAAP,CAAA;AACD,CAJD;;AC3DA;MAIaG,IAAI,GAEbC,gBADF,IAGCC,qBAAD,IAAkC;EAChC,MAAMC,GAAG,GAAG,CAAZ,CAAA;EACA,MAAMC,KAAK,GAAG,CAAd,CAAA;AAEA,EAAA,MAAMC,OAAO,GAAGC,MAAM,CAACC,OAAP,CAAeL,qBAAf,CAAsCM,CAAAA,MAAtC,CACd,CAACC,QAAD,EAAgBC,oBAAhB,KAAyC;AACvC,IAAA,MAAMC,OAAO,GAAGD,oBAAoB,CAACP,GAAD,CAApC,CAAA;AACA,IAAA,MAAMS,SAAS,GAAGF,oBAAoB,CAACN,KAAD,CAAtC,CAAA;AACAK,IAAAA,QAAQ,CAACE,OAAD,CAAR,GACEC,SAAS,IAAI,OAAOA,SAAP,KAAqB,QAAlC,IAA8C,MAAA,IAAUA,SAAxD,GACIA,SAAS,CAACZ,IAAV,EADJ,GAEIY,SAHN,CAAA;AAIA,IAAA,OAAOH,QAAP,CAAA;GARY,EAUd,EAVc,CAAhB,CAAA;AAaA,EAAA,oBAAO,KAAC,CAAA,aAAA,CAAA,gBAAD,EAAsBJ,OAAtB,CAAP,CAAA;AACD;;;;"}
|
package/esm/client.js
CHANGED
|
@@ -2,33 +2,32 @@ import 'isomorphic-fetch';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import require$$0 from 'react-dom';
|
|
4
4
|
import { Provider } from 'react-redux';
|
|
5
|
-
import {
|
|
5
|
+
import { unstable_HistoryRouter } from 'react-router-dom';
|
|
6
6
|
import { loadableReady } from '@loadable/component';
|
|
7
7
|
import { parse } from 'query-string';
|
|
8
8
|
import { CookiesProvider } from 'react-cookie';
|
|
9
|
-
import { c as createStore, s as selectVersionStatus } from './version-
|
|
10
|
-
import { s as setVersionStatus } from './version-
|
|
11
|
-
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-
|
|
12
|
-
export { A as ReactApp } from './App-
|
|
13
|
-
import { c as setCurrentProject } from './selectors-
|
|
14
|
-
import { d as deliveryApi } from './ContensisDeliveryApi-
|
|
9
|
+
import { c as createStore, s as selectVersionStatus } from './version-3d9911e2.js';
|
|
10
|
+
import { s as setVersionStatus } from './version-9f29becb.js';
|
|
11
|
+
import { b as browserHistory, r as rootSaga, p as pickProject } from './App-83107d7e.js';
|
|
12
|
+
export { A as ReactApp } from './App-83107d7e.js';
|
|
13
|
+
import { c as setCurrentProject } from './selectors-691caf02.js';
|
|
14
|
+
import { d as deliveryApi } from './ContensisDeliveryApi-fe57a037.js';
|
|
15
15
|
import 'redux';
|
|
16
16
|
import 'redux-thunk';
|
|
17
17
|
import 'redux-saga';
|
|
18
18
|
import 'redux-injectors';
|
|
19
19
|
import 'immer';
|
|
20
|
-
import './reducers-
|
|
20
|
+
import './reducers-aa8cef1e.js';
|
|
21
21
|
import '@redux-saga/core/effects';
|
|
22
22
|
import 'history';
|
|
23
23
|
import 'loglevel';
|
|
24
24
|
import 'await-to-js';
|
|
25
|
-
import './ChangePassword.container-
|
|
26
|
-
import './ToJs-
|
|
25
|
+
import './ChangePassword.container-76fd5e9b.js';
|
|
26
|
+
import './ToJs-df57f31d.js';
|
|
27
27
|
import 'jsonpath-mapper';
|
|
28
28
|
import './CookieConstants-3d3b6531.js';
|
|
29
29
|
import 'contensis-delivery-api';
|
|
30
|
-
import './RouteLoader-
|
|
31
|
-
import 'react-router-config';
|
|
30
|
+
import './RouteLoader-29fd689a.js';
|
|
32
31
|
import 'reselect';
|
|
33
32
|
|
|
34
33
|
var hydrateRoot;
|
|
@@ -68,10 +67,11 @@ class ClientApp {
|
|
|
68
67
|
withSagas,
|
|
69
68
|
withEvents
|
|
70
69
|
} = config;
|
|
70
|
+
|
|
71
71
|
const GetClientJSX = store => {
|
|
72
72
|
const ClientJsx = /*#__PURE__*/React.createElement(CookiesProvider, null, /*#__PURE__*/React.createElement(Provider, {
|
|
73
73
|
store: store
|
|
74
|
-
}, /*#__PURE__*/React.createElement(
|
|
74
|
+
}, /*#__PURE__*/React.createElement(unstable_HistoryRouter, {
|
|
75
75
|
history: browserHistory
|
|
76
76
|
}, /*#__PURE__*/React.createElement(ReactApp, {
|
|
77
77
|
routes: routes,
|
|
@@ -79,11 +79,12 @@ class ClientApp {
|
|
|
79
79
|
}))));
|
|
80
80
|
return ClientJsx;
|
|
81
81
|
};
|
|
82
|
-
const isProduction = !(process.env.NODE_ENV !== 'production');
|
|
83
82
|
|
|
83
|
+
const isProduction = !(process.env.NODE_ENV !== 'production');
|
|
84
84
|
/**
|
|
85
85
|
* Webpack HMR Setup.
|
|
86
86
|
*/
|
|
87
|
+
|
|
87
88
|
const HMRRenderer = Component => {
|
|
88
89
|
if (isProduction) loadableReady(() => {
|
|
89
90
|
hydrateRoot(documentRoot, Component);
|
|
@@ -91,6 +92,7 @@ class ClientApp {
|
|
|
91
92
|
namespace: 'modern'
|
|
92
93
|
});else createRoot(documentRoot).render(Component);
|
|
93
94
|
};
|
|
95
|
+
|
|
94
96
|
const hmr = store => {
|
|
95
97
|
// webpack Hot Module Replacement API
|
|
96
98
|
if (module.hot) {
|
|
@@ -100,17 +102,20 @@ class ClientApp {
|
|
|
100
102
|
});
|
|
101
103
|
}
|
|
102
104
|
};
|
|
105
|
+
|
|
103
106
|
const qs = parse(window.location.search);
|
|
104
107
|
const versionStatus = deliveryApi.getClientSideVersionStatus();
|
|
108
|
+
|
|
105
109
|
if (window.isDynamic || window.REDUX_DATA || process.env.NODE_ENV !== 'production') {
|
|
106
110
|
createStore(withReducers, window.REDUX_DATA, browserHistory, stateType).then(store => {
|
|
107
111
|
const state = store.getState();
|
|
108
112
|
const ssrVersionStatus = selectVersionStatus(state);
|
|
109
113
|
if (!ssrVersionStatus) store.dispatch(setVersionStatus(versionStatus));
|
|
110
|
-
|
|
111
114
|
/* eslint-disable no-console */
|
|
115
|
+
|
|
112
116
|
console.log('Hydrating from inline Redux');
|
|
113
117
|
/* eslint-enable no-console */
|
|
118
|
+
|
|
114
119
|
store.runSaga(rootSaga(withSagas));
|
|
115
120
|
store.dispatch(setCurrentProject(pickProject(window.location.hostname, qs), [], window.location.hostname));
|
|
116
121
|
delete window.REDUX_DATA;
|
|
@@ -130,6 +135,7 @@ class ClientApp {
|
|
|
130
135
|
});
|
|
131
136
|
}
|
|
132
137
|
}
|
|
138
|
+
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
export { ClientApp as default };
|
package/esm/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sources":["../node_modules/react-dom/client.js","../src/client/client.tsx"],"sourcesContent":["'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n","import 'isomorphic-fetch';\nimport React from 'react';\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport {
|
|
1
|
+
{"version":3,"file":"client.js","sources":["../node_modules/react-dom/client.js","../src/client/client.tsx"],"sourcesContent":["'use strict';\n\nvar m = require('react-dom');\nif (process.env.NODE_ENV === 'production') {\n exports.createRoot = m.createRoot;\n exports.hydrateRoot = m.hydrateRoot;\n} else {\n var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;\n exports.createRoot = function(c, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.createRoot(c, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n exports.hydrateRoot = function(c, h, o) {\n i.usingClientEntryPoint = true;\n try {\n return m.hydrateRoot(c, h, o);\n } finally {\n i.usingClientEntryPoint = false;\n }\n };\n}\n","import 'isomorphic-fetch';\nimport React from 'react';\nimport { createRoot, hydrateRoot } from 'react-dom/client';\nimport { Provider as ReduxProvider } from 'react-redux';\nimport { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';\nimport { loadableReady } from '@loadable/component';\nimport { parse } from 'query-string';\nimport { CookiesProvider } from 'react-cookie';\n\nimport { selectVersionStatus } from '~/redux/selectors/version';\nimport { setVersionStatus } from '~/redux/actions/version';\nimport rootSaga from '~/redux/sagas';\nimport { browserHistory as history } from '~/redux/store/history';\nimport createStore from '~/redux/store/store';\n\nimport { setCurrentProject } from '~/routing/redux/actions';\n\nimport { deliveryApi } from '~/util/ContensisDeliveryApi';\nimport pickProject from '~/util/pickProject';\n\nimport { AppConfig } from '~/config';\n\ndeclare let window: typeof globalThis & {\n isDynamic;\n REDUX_DATA;\n};\n\ntype ReactAppProps = { routes: any; withEvents: any };\n\nclass ClientApp {\n constructor(ReactApp: React.ComponentType<ReactAppProps>, config: AppConfig) {\n const documentRoot = document.getElementById('root') as HTMLElement;\n\n const {\n stateType = 'immutable',\n routes,\n withReducers,\n withSagas,\n withEvents,\n } = config;\n\n const GetClientJSX = store => {\n const ClientJsx = (\n <CookiesProvider>\n <ReduxProvider store={store}>\n <HistoryRouter history={history as any}>\n <ReactApp routes={routes} withEvents={withEvents} />\n </HistoryRouter>\n </ReduxProvider>\n </CookiesProvider>\n );\n return ClientJsx;\n };\n\n const isProduction = !(process.env.NODE_ENV !== 'production');\n\n /**\n * Webpack HMR Setup.\n */\n const HMRRenderer = Component => {\n if (isProduction)\n loadableReady(\n () => {\n hydrateRoot(documentRoot, Component);\n },\n { namespace: 'modern' }\n );\n else createRoot(documentRoot).render(Component);\n };\n\n const hmr = store => {\n // webpack Hot Module Replacement API\n if (module.hot) {\n module.hot.accept(ReactApp as unknown as string, () => {\n // if you are using harmony modules ({modules:false})\n HMRRenderer(GetClientJSX(store));\n });\n }\n };\n\n const qs = parse(window.location.search);\n const versionStatus = deliveryApi.getClientSideVersionStatus();\n\n if (\n window.isDynamic ||\n window.REDUX_DATA ||\n process.env.NODE_ENV !== 'production'\n ) {\n createStore(withReducers, window.REDUX_DATA, history, stateType).then(\n store => {\n const state = store.getState();\n const ssrVersionStatus = selectVersionStatus(state);\n if (!ssrVersionStatus)\n store.dispatch(setVersionStatus(versionStatus));\n\n /* eslint-disable no-console */\n console.log('Hydrating from inline Redux');\n /* eslint-enable no-console */\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n delete window.REDUX_DATA;\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n }\n );\n } else {\n fetch(`${window.location.pathname}?redux=true`)\n .then(response => response.json())\n .then(data => {\n const ssRedux = JSON.parse(data);\n createStore(withReducers, ssRedux, history, stateType).then(store => {\n store.dispatch(setVersionStatus(versionStatus));\n\n store.runSaga(rootSaga(withSagas));\n store.dispatch(\n setCurrentProject(\n pickProject(window.location.hostname, qs),\n [],\n window.location.hostname\n )\n );\n\n HMRRenderer(GetClientJSX(store));\n\n hmr(store);\n });\n });\n }\n }\n}\n\nexport default ClientApp;\n"],"names":["ClientApp","constructor","ReactApp","config","documentRoot","document","getElementById","stateType","routes","withReducers","withSagas","withEvents","GetClientJSX","store","ClientJsx","ReduxProvider","HistoryRouter","history","isProduction","process","env","NODE_ENV","HMRRenderer","Component","loadableReady","hydrateRoot","namespace","createRoot","render","hmr","module","hot","accept","qs","parse","window","location","search","versionStatus","deliveryApi","getClientSideVersionStatus","isDynamic","REDUX_DATA","createStore","then","state","getState","ssrVersionStatus","selectVersionStatus","dispatch","setVersionStatus","console","log","runSaga","rootSaga","setCurrentProject","pickProject","hostname","fetch","pathname","response","json","data","ssRedux","JSON"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;AACA,IAAI,CAAC,GAAG,UAAoB,CAAC;AAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;AAC3C,EAAE,UAAkB,GAAG,CAAC,CAAC,UAAU,CAAC;AACpC,EAAE,WAAmB,GAAG,CAAC,CAAC,WAAW,CAAC;AACtC,CAAC,MAAM;AACP,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,kDAAkD,CAAC;AAC/D,EAAE,aAAqB,SAAS,CAAC,EAAE,CAAC,EAAE;AACtC,IAAI,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC;AACnC,IAAI,IAAI;AACR,MAAM,OAAO,CAAC,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAChC,KAAK,SAAS;AACd,MAAM,CAAC,CAAC,qBAAqB,GAAG,KAAK,CAAC;AACtC,KAAK;AACL,GAAG,CAAC;AACJ,EAAE,WAAA,GAAsB,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;AAC1C,IAAI,CAAC,CAAC,qBAAqB,GAAG,IAAI,CAAC;AACnC,IAAI,IAAI;AACR,MAAM,OAAO,CAAC,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,SAAS;AACd,MAAM,CAAC,CAAC,qBAAqB,GAAG,KAAK,CAAC;AACtC,KAAK;AACL,GAAG,CAAC;AACJ;;ACKA,MAAMA,SAAN,CAAgB;AACdC,EAAAA,WAAW,CAACC,QAAD,EAA+CC,MAA/C,EAAkE;AAC3E,IAAA,MAAMC,YAAY,GAAGC,QAAQ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