@imposium-hub/components 2.6.0 → 2.6.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.
Files changed (34) hide show
  1. package/dist/cjs/Util.js +2 -1
  2. package/dist/cjs/Util.js.map +1 -1
  3. package/dist/cjs/components/app-wrapper/AppWrapper.js +17 -8
  4. package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
  5. package/dist/cjs/components/modal/Modal.d.ts +1 -1
  6. package/dist/cjs/components/modal/Modal.js +3 -2
  7. package/dist/cjs/components/modal/Modal.js.map +1 -1
  8. package/dist/cjs/services/API.d.ts +2 -0
  9. package/dist/cjs/services/API.js +6 -0
  10. package/dist/cjs/services/API.js.map +1 -1
  11. package/dist/cjs/services/Session.d.ts +11 -0
  12. package/dist/cjs/services/Session.js +126 -3
  13. package/dist/cjs/services/Session.js.map +1 -1
  14. package/dist/esm/Util.js +2 -1
  15. package/dist/esm/Util.js.map +1 -1
  16. package/dist/esm/components/app-wrapper/AppWrapper.js +18 -9
  17. package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
  18. package/dist/esm/components/modal/Modal.d.ts +1 -1
  19. package/dist/esm/components/modal/Modal.js +3 -2
  20. package/dist/esm/components/modal/Modal.js.map +1 -1
  21. package/dist/esm/services/API.d.ts +2 -0
  22. package/dist/esm/services/API.js +6 -0
  23. package/dist/esm/services/API.js.map +1 -1
  24. package/dist/esm/services/Session.d.ts +11 -0
  25. package/dist/esm/services/Session.js +84 -3
  26. package/dist/esm/services/Session.js.map +1 -1
  27. package/dist/styles.css +5 -0
  28. package/dist/styles.less +1 -0
  29. package/less/components/button.less +1 -0
  30. package/package.json +1 -1
  31. package/src/Util.ts +2 -1
  32. package/src/components/app-wrapper/AppWrapper.tsx +23 -13
  33. package/src/components/modal/Modal.tsx +10 -7
  34. package/src/services/API.ts +8 -0
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import Header from '../header/Header';
3
- import { validateAccessLevel } from '../../Util';
3
+ import { getLastModifiedStoryInOrg, validateAccessLevel } from '../../Util';
4
4
  import { ConfirmModal } from '../confirm-modal/ConfirmModal';
5
5
  import { IImposiumAPI } from '../../services/API';
6
6
  import { useAuth0 } from '@auth0/auth0-react';
@@ -165,22 +165,32 @@ export const AppWrapper: React.FC<IAppWrapperProps> = (props) => {
165
165
  setErrorState(APP_WRAPPER_ERROR_STATES.UNAUTHORIZED_APP);
166
166
  }
167
167
  } else if (initialOrganizationId) {
168
- if (allowNoStories) {
169
- const validAccessLevel = validateAccessLevel(
170
- initialOrganizationId,
171
- serviceId,
172
- freshAccess
173
- );
174
- if (validAccessLevel) {
175
- api.init(baseUrl, getAccessTokenSilently, initialOrganizationId);
176
- onAuthenticated(initialOrganizationId, null);
177
- setBlockRender(false);
168
+ const validAccessLevel = validateAccessLevel(
169
+ initialOrganizationId,
170
+ serviceId,
171
+ freshAccess
172
+ );
173
+
174
+ if (validAccessLevel) {
175
+ const lastModified = getLastModifiedStoryInOrg(initialOrganizationId, freshAccess);
176
+ api.init(baseUrl, getAccessTokenSilently, initialOrganizationId);
177
+
178
+ if (lastModified) {
179
+ replaceRoute(`/${initialOrganizationId}/${lastModified}`);
180
+ onAuthenticated(initialOrganizationId, lastModified);
178
181
  setErrorState(null);
182
+ setBlockRender(false);
179
183
  } else {
180
- setErrorState(APP_WRAPPER_ERROR_STATES.UNAUTHORIZED_APP);
184
+ if (allowNoStories) {
185
+ onAuthenticated(initialOrganizationId, null);
186
+ setErrorState(null);
187
+ setBlockRender(false);
188
+ } else {
189
+ setErrorState(APP_WRAPPER_ERROR_STATES.NO_STORIES);
190
+ }
181
191
  }
182
192
  } else {
183
- setErrorState(APP_WRAPPER_ERROR_STATES.NO_STORIES);
193
+ setErrorState(APP_WRAPPER_ERROR_STATES.UNAUTHORIZED_APP);
184
194
  }
185
195
  }
186
196
  };
@@ -8,7 +8,7 @@ interface IModalProps {
8
8
  isOpen: boolean;
9
9
  style?: any;
10
10
  wrapperStyle?: any;
11
- onRequestClose(e): void;
11
+ onRequestClose?(e): void;
12
12
  }
13
13
 
14
14
  class Modal extends React.PureComponent<IModalProps> {
@@ -49,7 +49,14 @@ class Modal extends React.PureComponent<IModalProps> {
49
49
  }
50
50
 
51
51
  public render() {
52
- const { isOpen, style, wrapperStyle } = this.props;
52
+ const { isOpen, style, wrapperStyle, onRequestClose } = this.props;
53
+ const btnClose = onRequestClose ? (
54
+ <Button
55
+ onClick={this.evtHandlers.onClose}
56
+ customStyles={this.closeStyles}>
57
+ {ICON_TIMES}
58
+ </Button>
59
+ ) : null;
53
60
 
54
61
  if (isOpen) {
55
62
  return (
@@ -64,11 +71,7 @@ class Modal extends React.PureComponent<IModalProps> {
64
71
  className='modal-container'
65
72
  style={style}>
66
73
  <div className='modal-content'>{this.props.children}</div>
67
- <Button
68
- onClick={this.evtHandlers.onClose}
69
- customStyles={this.closeStyles}>
70
- {ICON_TIMES}
71
- </Button>
74
+ {btnClose}
72
75
  </div>
73
76
  </div>
74
77
  );
@@ -12,6 +12,7 @@ import { API_AUTH_TYPES } from '../components/font-picker/font-manager/constants
12
12
 
13
13
  export interface IImposiumAPI {
14
14
  init(baseUrl: string, credentials: any, orgId?: string);
15
+ updateProjectVersion(storyId: string);
15
16
  getAssets(filters: any, storyId: string, unprocessed?: boolean, showVariables?: boolean);
16
17
  getAssetItem(assetId: string);
17
18
  uploadAsset(
@@ -266,6 +267,13 @@ export default class API {
266
267
  });
267
268
  };
268
269
 
270
+ public updateProjectVersion = (storyId: string): Promise<any | Error> => {
271
+ return this.doRequest({
272
+ method: 'POST',
273
+ url: `/story/${storyId}/update-project-version`
274
+ });
275
+ };
276
+
269
277
  public saveQueueAssoc = (
270
278
  queueId: string,
271
279
  storyId: string,