@imposium-hub/components 2.11.5-0 → 2.11.5-1

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 (32) hide show
  1. package/dist/cjs/components/app-wrapper/AppWrapper.js +2 -2
  2. package/dist/cjs/components/app-wrapper/AppWrapper.js.map +1 -1
  3. package/dist/cjs/components/publish-wizard/PublishWizard.js +18 -4
  4. package/dist/cjs/components/publish-wizard/PublishWizard.js.map +1 -1
  5. package/dist/cjs/components/publish-wizard/publish/CrMPublishUI.d.ts +1 -0
  6. package/dist/cjs/components/publish-wizard/publish/CrMPublishUI.js +22 -13
  7. package/dist/cjs/components/publish-wizard/publish/CrMPublishUI.js.map +1 -1
  8. package/dist/cjs/constants/publish.d.ts +6 -0
  9. package/dist/cjs/constants/publish.js +9 -2
  10. package/dist/cjs/constants/publish.js.map +1 -1
  11. package/dist/cjs/services/API.d.ts +2 -2
  12. package/dist/cjs/services/API.js +6 -3
  13. package/dist/cjs/services/API.js.map +1 -1
  14. package/dist/esm/components/app-wrapper/AppWrapper.js +2 -2
  15. package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
  16. package/dist/esm/components/publish-wizard/PublishWizard.js +18 -4
  17. package/dist/esm/components/publish-wizard/PublishWizard.js.map +1 -1
  18. package/dist/esm/components/publish-wizard/publish/CrMPublishUI.d.ts +1 -0
  19. package/dist/esm/components/publish-wizard/publish/CrMPublishUI.js +23 -14
  20. package/dist/esm/components/publish-wizard/publish/CrMPublishUI.js.map +1 -1
  21. package/dist/esm/constants/publish.d.ts +6 -0
  22. package/dist/esm/constants/publish.js +8 -1
  23. package/dist/esm/constants/publish.js.map +1 -1
  24. package/dist/esm/services/API.d.ts +2 -2
  25. package/dist/esm/services/API.js +6 -3
  26. package/dist/esm/services/API.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/components/app-wrapper/AppWrapper.tsx +2 -2
  29. package/src/components/publish-wizard/PublishWizard.tsx +20 -4
  30. package/src/components/publish-wizard/publish/CrMPublishUI.tsx +41 -25
  31. package/src/constants/publish.ts +9 -1
  32. package/src/services/API.ts +19 -7
@@ -238,7 +238,7 @@ export const AppWrapper: React.FC<IAppWrapperProps> = (props) => {
238
238
  if (crmApi && crmBaseUrl) {
239
239
  crmApi.init(crmBaseUrl, getAccessTokenSilently);
240
240
  }
241
- api.getAccessData(false)
241
+ api.getAccessData(false, storyId)
242
242
  .then((freshAccess: any) => {
243
243
  props.setAccessData(freshAccess);
244
244
  propagateCreds(freshAccess);
@@ -246,7 +246,7 @@ export const AppWrapper: React.FC<IAppWrapperProps> = (props) => {
246
246
  .catch((e: Error) => {
247
247
  setErrorState(APP_WRAPPER_ERROR_STATES.UNAUTHORIZED_ORG);
248
248
 
249
- // Attempt to get the access data again without the org ID, so we can at least shoe the user the org dropdown
249
+ // Attempt to get the access data again without the org ID, so we can at least show the user the org dropdown
250
250
  api.init(baseUrl, getAccessTokenSilently, null);
251
251
  if (crmApi && crmBaseUrl) {
252
252
  crmApi.init(crmBaseUrl, getAccessTokenSilently);
@@ -24,6 +24,7 @@ import PublishStatusIndicator from './publish/PublishStatusIndicator';
24
24
  import { bindActionCreators } from 'redux';
25
25
  import { publishVersion } from '../../redux/actions/publish';
26
26
  import { connect } from 'react-redux';
27
+ import { CRM_INTEGRATED_PROJECT_TYPES } from '../../constants/publish';
27
28
 
28
29
  interface IPublishWizardProps {
29
30
  fromCrM?: boolean;
@@ -334,10 +335,17 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
334
335
  const { story, project, fromCrM } = this.props;
335
336
  const variables = story ? story.acts[project.actId].inventory : {};
336
337
  const varLength = variables ? Object.keys(variables).length : 0;
338
+ const projectType = story.creativeId
339
+ ? CRM_INTEGRATED_PROJECT_TYPES.SINGLE_CREATIVE
340
+ : CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE;
337
341
 
338
342
  if (fromCrM && varLength === 0) {
339
343
  return true;
340
- } else if (fromCrM && this.state.selectedCreatives.length === 0) {
344
+ } else if (
345
+ fromCrM &&
346
+ this.state.selectedCreatives.length === 0 &&
347
+ projectType === CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE
348
+ ) {
341
349
  return true;
342
350
  }
343
351
  return false;
@@ -357,7 +365,7 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
357
365
 
358
366
  private renderLowerButtons() {
359
367
  const { screenIndex, done, error, next } = this.state;
360
- const { fromCrM } = this.props;
368
+ const { fromCrM, story } = this.props;
361
369
  const { publishing } = this.props.publishData;
362
370
  const disabledForCrM = this.shouldDisablePublishButtonForCrM();
363
371
  const lowerButtons = [];
@@ -366,8 +374,13 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
366
374
  if (screenIndex === 0) {
367
375
  // publish
368
376
 
377
+ const projectType = story.creativeId
378
+ ? CRM_INTEGRATED_PROJECT_TYPES.SINGLE_CREATIVE
379
+ : CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE;
369
380
  const btnCopy = fromCrM
370
- ? `Publish to ${this.state.selectedCreatives.length} Creatives`
381
+ ? projectType === CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE
382
+ ? `Publish to ${this.state.selectedCreatives.length} Creatives`
383
+ : 'Publish to Creative Manager'
371
384
  : copy.publish.btnPublish;
372
385
  lowerButtons.push(
373
386
  <Button
@@ -461,7 +474,9 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
461
474
  const { publishError } = this.state;
462
475
  const errorCopyForCrM = this.getErrorCopyForCrMPublish();
463
476
  const errorCopy = publishError ? publishError : errorCopyForCrM ? errorCopyForCrM : null;
464
-
477
+ const projectType = story.creativeId
478
+ ? CRM_INTEGRATED_PROJECT_TYPES.SINGLE_CREATIVE
479
+ : CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE;
465
480
  const error = errorCopy ? (
466
481
  <p className='publish-error'>
467
482
  <span className='icon'>{ICON_EXCLAIMATION_TRIANGLE}</span>&nbsp;&nbsp;{errorCopy}
@@ -471,6 +486,7 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
471
486
  if (fromCrM) {
472
487
  return (
473
488
  <CrMPublishUI
489
+ projectType={projectType}
474
490
  selectedCreatives={this.state.selectedCreatives}
475
491
  onUpdateSelectedCreatives={(c) => this.setState({ selectedCreatives: c })}
476
492
  onError={(e) => this.setState({ publishError: e })}
@@ -3,7 +3,10 @@ import * as copy from '../../../constants/copy';
3
3
  import { DataTable, HRule, Button, IImposiumAPI, TextField } from '../../..';
4
4
  import { useEffect, useState, useCallback } from 'react';
5
5
  import { ICON_SEARCH } from '../../../constants/icons';
6
- import { CREATIVE_STATUSES_TO_PUBLISH } from '../../../constants/publish';
6
+ import {
7
+ CREATIVE_STATUSES_TO_PUBLISH,
8
+ CRM_INTEGRATED_PROJECT_TYPES
9
+ } from '../../../constants/publish';
7
10
  import { CrMPublishStatusCell } from './CrMPublishStatusCell';
8
11
  import { CrMPublishPreviewCell } from './CrMPublishPreviewCell';
9
12
  import { CrMPublishNameCell } from './CrMPublishNameCell';
@@ -11,6 +14,7 @@ import { CrMPublishCreativeSelectHeader } from './CrMPublishCreativeSelectHeader
11
14
  import { CrMPublishCreativeSelectCell } from './CrMPublishCreativeSelectCell';
12
15
 
13
16
  interface ICrmPublishUIProps {
17
+ projectType: string;
14
18
  publishing: boolean;
15
19
  error: React.ReactNode;
16
20
  api: IImposiumAPI;
@@ -24,6 +28,7 @@ interface ICrmPublishUIProps {
24
28
 
25
29
  export const CrMPublishUI: React.FC<ICrmPublishUIProps> = (props) => {
26
30
  const {
31
+ projectType,
27
32
  publishing,
28
33
  error,
29
34
  crmBaseUrl,
@@ -164,30 +169,41 @@ export const CrMPublishUI: React.FC<ICrmPublishUIProps> = (props) => {
164
169
  });
165
170
  }, []);
166
171
 
167
- return (
168
- <div>
169
- <h2>{copy.publish.publishStepTitleFromCrM}</h2>
170
- <HRule />
171
- <p>{publishing ? copy.publish.publishInProgress : ''}</p>
172
- <DataTable
173
- showInterstitial={publishing}
174
- columns={COLUMN_CONFIG}
175
- data={
176
- nameFilter
177
- ? creativeConfig.filter((creative) => {
178
- return creative.creativeName
179
- .toLowerCase()
180
- .includes(nameFilter.toLowerCase());
181
- })
182
- : creativeConfig
183
- }
184
- hidePaginator={true}
185
- itemsPerPage={1000}
186
- tightRows={true}
187
- />
188
- {error && <p className='publish-error'>{error}</p>}
189
- </div>
190
- );
172
+ if (projectType === CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE) {
173
+ return (
174
+ <div>
175
+ <h2>{copy.publish.publishStepTitleFromCrM}</h2>
176
+ <HRule />
177
+ <p>{publishing ? copy.publish.publishInProgress : ''}</p>
178
+ <DataTable
179
+ showInterstitial={publishing}
180
+ columns={COLUMN_CONFIG}
181
+ data={
182
+ nameFilter
183
+ ? creativeConfig.filter((creative) => {
184
+ return creative.creativeName
185
+ .toLowerCase()
186
+ .includes(nameFilter.toLowerCase());
187
+ })
188
+ : creativeConfig
189
+ }
190
+ hidePaginator={true}
191
+ itemsPerPage={1000}
192
+ tightRows={true}
193
+ />
194
+ {error && <p className='publish-error'>{error}</p>}
195
+ </div>
196
+ );
197
+ } else {
198
+ return (
199
+ <div>
200
+ <h2>{copy.publish.publishStepTitle}</h2>
201
+ <HRule />
202
+ <p>{publishing ? copy.publish.publishInProgress : copy.publish.publishStepDesc}</p>
203
+ {error && <p className='publish-error'>{error}</p>}
204
+ </div>
205
+ );
206
+ }
191
207
  };
192
208
 
193
209
  export const canBePublishedTo = (approvalStatus: string) => {
@@ -34,6 +34,7 @@ export const CREATIVE_STATUSES = {
34
34
  PRODUCTION_INCOMPLETE: 'PRODUCTION_INCOMPLETE',
35
35
  APPROVED: 'APPROVED',
36
36
  REJECTED: 'REJECTED',
37
+ FAILED: 'FAILED',
37
38
  TRANSCODING: 'TRANSCODING',
38
39
  TRANSCODING_ERROR: 'TRANSCODING_ERROR',
39
40
  SUBMITTED: 'SUBMITTED'
@@ -45,6 +46,7 @@ export const CREATIVE_STATUS_LABELS = {
45
46
  PRODUCTION_INCOMPLETE: 'Production',
46
47
  APPROVED: 'Approved',
47
48
  REJECTED: 'Rejected',
49
+ FAILED: 'Failed',
48
50
  TRANSCODING: 'Transcoding',
49
51
  TRANSCODING_ERROR: 'Transcoding Error',
50
52
  SUBMITTED: 'Submitted'
@@ -53,5 +55,11 @@ export const CREATIVE_STATUS_LABELS = {
53
55
  export const CREATIVE_STATUSES_TO_PUBLISH = [
54
56
  CREATIVE_STATUSES.UNSUBMITTED,
55
57
  CREATIVE_STATUSES.PRODUCTION_INCOMPLETE,
56
- CREATIVE_STATUSES.REJECTED
58
+ CREATIVE_STATUSES.REJECTED,
59
+ CREATIVE_STATUSES.FAILED
57
60
  ];
61
+
62
+ export const CRM_INTEGRATED_PROJECT_TYPES = {
63
+ SINGLE_CREATIVE: 'SINGLE_CREATIVE',
64
+ MULTI_CREATIVE: 'MULTI_CREATIVE'
65
+ };
@@ -152,7 +152,7 @@ export interface IImposiumAPI {
152
152
  debugId(id: string);
153
153
  cacheActiveStory(serviceId: any, orgId: string, storyId?: string);
154
154
  getCachedStoryForOrg(serviceId: string, orgId: string);
155
- getAccessData(includeTotalRenders?: boolean, orgId?: string);
155
+ getAccessData(includeTotalRenders?: boolean, storyId?: string);
156
156
  deleteExperience(experienceId: string, eraseMedia?: boolean);
157
157
  exportExperiences(experienceId: string, params: any);
158
158
  addOrReplaceNote(experienceId: string, notes: string);
@@ -234,7 +234,8 @@ export default class API {
234
234
 
235
235
  private doRequest = async (
236
236
  config: AxiosRequestConfig,
237
- organizationId?: string
237
+ organizationId?: string,
238
+ storyId?: string
238
239
  ): Promise<any> => {
239
240
  if (this.authType === API_AUTH_TYPES.TOKEN) {
240
241
  const token = await this.getToken();
@@ -246,6 +247,10 @@ export default class API {
246
247
  headers['X-Imposium-Account-Id'] = organizationId;
247
248
  }
248
249
 
250
+ if (storyId) {
251
+ headers['X-Imposium-Project-Id'] = storyId;
252
+ }
253
+
249
254
  config.headers = headers;
250
255
  }
251
256
 
@@ -1718,17 +1723,24 @@ export default class API {
1718
1723
  });
1719
1724
  };
1720
1725
 
1721
- public getAccessData = (getTotalRenders: boolean = false): Promise<any | Error> => {
1726
+ public getAccessData = (
1727
+ getTotalRenders: boolean = false,
1728
+ storyId?: string
1729
+ ): Promise<any | Error> => {
1722
1730
  let route = `/access`;
1723
1731
 
1724
1732
  if (getTotalRenders) {
1725
1733
  route += '?include_total_renders=true';
1726
1734
  }
1727
1735
 
1728
- return this.doRequest({
1729
- method: 'GET',
1730
- url: route
1731
- });
1736
+ return this.doRequest(
1737
+ {
1738
+ method: 'GET',
1739
+ url: route
1740
+ },
1741
+ null,
1742
+ storyId
1743
+ );
1732
1744
  };
1733
1745
 
1734
1746
  public removeQueueAssoc = (queueId: string, storyId: string): Promise<any> => {