@imposium-hub/components 2.12.4 → 2.13.0

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 (69) 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/header/Header.js +2 -3
  4. package/dist/cjs/components/header/Header.js.map +1 -1
  5. package/dist/cjs/components/publish-wizard/PublishWizard.d.ts +8 -0
  6. package/dist/cjs/components/publish-wizard/PublishWizard.js +156 -94
  7. package/dist/cjs/components/publish-wizard/PublishWizard.js.map +1 -1
  8. package/dist/cjs/constants/copy.d.ts +3 -0
  9. package/dist/cjs/constants/copy.js +3 -0
  10. package/dist/cjs/constants/copy.js.map +1 -1
  11. package/dist/cjs/constants/icons.d.ts +1 -0
  12. package/dist/cjs/constants/icons.js +3 -1
  13. package/dist/cjs/constants/icons.js.map +1 -1
  14. package/dist/cjs/constants/publish.d.ts +27 -0
  15. package/dist/cjs/constants/publish.js +33 -1
  16. package/dist/cjs/constants/publish.js.map +1 -1
  17. package/dist/cjs/redux/actions/asset-list.js +1 -1
  18. package/dist/cjs/redux/actions/asset-list.js.map +1 -1
  19. package/dist/cjs/redux/actions/publish.d.ts +1 -1
  20. package/dist/cjs/redux/actions/publish.js +2 -2
  21. package/dist/cjs/redux/actions/publish.js.map +1 -1
  22. package/dist/cjs/services/API.d.ts +6 -4
  23. package/dist/cjs/services/API.js +16 -4
  24. package/dist/cjs/services/API.js.map +1 -1
  25. package/dist/esm/components/app-wrapper/AppWrapper.js +2 -2
  26. package/dist/esm/components/app-wrapper/AppWrapper.js.map +1 -1
  27. package/dist/esm/components/header/Header.js +2 -3
  28. package/dist/esm/components/header/Header.js.map +1 -1
  29. package/dist/esm/components/publish-wizard/PublishWizard.d.ts +8 -0
  30. package/dist/esm/components/publish-wizard/PublishWizard.js +152 -92
  31. package/dist/esm/components/publish-wizard/PublishWizard.js.map +1 -1
  32. package/dist/esm/constants/copy.d.ts +3 -0
  33. package/dist/esm/constants/copy.js +3 -0
  34. package/dist/esm/constants/copy.js.map +1 -1
  35. package/dist/esm/constants/icons.d.ts +1 -0
  36. package/dist/esm/constants/icons.js +2 -0
  37. package/dist/esm/constants/icons.js.map +1 -1
  38. package/dist/esm/constants/publish.d.ts +27 -0
  39. package/dist/esm/constants/publish.js +32 -0
  40. package/dist/esm/constants/publish.js.map +1 -1
  41. package/dist/esm/redux/actions/asset-list.js +1 -1
  42. package/dist/esm/redux/actions/asset-list.js.map +1 -1
  43. package/dist/esm/redux/actions/publish.d.ts +1 -1
  44. package/dist/esm/redux/actions/publish.js +2 -2
  45. package/dist/esm/redux/actions/publish.js.map +1 -1
  46. package/dist/esm/services/API.d.ts +6 -4
  47. package/dist/esm/services/API.js +16 -4
  48. package/dist/esm/services/API.js.map +1 -1
  49. package/dist/styles.css +27 -10
  50. package/dist/styles.less +33 -14
  51. package/less/components/data-table.less +1 -0
  52. package/less/components/header.less +6 -5
  53. package/less/components/publish-wizard.less +26 -9
  54. package/package.json +1 -1
  55. package/src/components/app-wrapper/AppWrapper.tsx +2 -2
  56. package/src/components/header/Header.tsx +2 -4
  57. package/src/components/publish-wizard/PublishWizard.tsx +219 -119
  58. package/src/components/publish-wizard/publish/CrMPublishCreativeSelectCell.tsx +29 -0
  59. package/src/components/publish-wizard/publish/CrMPublishCreativeSelectHeader.tsx +33 -0
  60. package/src/components/publish-wizard/publish/CrMPublishNameCell.tsx +27 -0
  61. package/src/components/publish-wizard/publish/CrMPublishPreviewCell.tsx +27 -0
  62. package/src/components/publish-wizard/publish/CrMPublishStatusCell.tsx +13 -0
  63. package/src/components/publish-wizard/publish/CrMPublishUI.tsx +211 -0
  64. package/src/constants/copy.ts +3 -0
  65. package/src/constants/icons.tsx +3 -0
  66. package/src/constants/publish.ts +36 -0
  67. package/src/redux/actions/asset-list.ts +1 -1
  68. package/src/redux/actions/publish.ts +2 -2
  69. package/src/services/API.ts +38 -10
package/dist/styles.less CHANGED
@@ -1131,6 +1131,7 @@ body{
1131
1131
  .filterable-cell-wrapper {
1132
1132
  display: flex;
1133
1133
  align-items: center;
1134
+ justify-content: space-between;
1134
1135
  }
1135
1136
 
1136
1137
  .filterable-cell-wrapper {
@@ -1866,13 +1867,14 @@ body{
1866
1867
  border:none;
1867
1868
  }
1868
1869
 
1869
- .additional-buttons{
1870
+ .creativeMgrBtn {
1871
+ position: relative;
1872
+ top: 1px;
1870
1873
  margin-right:10px;
1874
+ }
1871
1875
 
1872
- .creativeMgrBtn {
1873
- position: relative;
1874
- top: 1px;
1875
- }
1876
+ .additional-buttons{
1877
+ margin-right:10px;
1876
1878
  }
1877
1879
 
1878
1880
  .btn-help {
@@ -2236,8 +2238,22 @@ body{
2236
2238
 
2237
2239
 
2238
2240
  .publish-wizard{
2239
-
2240
- padding-top:30px;
2241
+ display: flex;
2242
+ flex-direction: column;
2243
+ height: 100%;
2244
+ padding-top: 30px;
2245
+ box-sizing: border-box;
2246
+
2247
+ > div:first-of-type {
2248
+ flex: 1;
2249
+ }
2250
+
2251
+ .lower-buttons {
2252
+ margin-top: auto;
2253
+ padding-bottom: 5px;
2254
+ width: 100%;
2255
+ text-align: center;
2256
+ }
2241
2257
 
2242
2258
  .missingColumns{
2243
2259
  margin: 15px;
@@ -2310,13 +2326,6 @@ body{
2310
2326
  background-color: @backgroundLight;
2311
2327
  }
2312
2328
 
2313
- .lower-buttons{
2314
- margin-top:10px;
2315
- left:0px;
2316
- width:100%;
2317
- text-align: center;
2318
- }
2319
-
2320
2329
  .link-wrapper{
2321
2330
  display: flex;
2322
2331
  flex-wrap: wrap;
@@ -2417,6 +2426,16 @@ body{
2417
2426
  }
2418
2427
  }
2419
2428
 
2429
+ .crm-publish-name{
2430
+ background: @backgroundDark;
2431
+ width: 100%;
2432
+ padding-left: 5px;
2433
+
2434
+ &.disabled{
2435
+ opacity: 0.5;
2436
+ }
2437
+ }
2438
+
2420
2439
  @sectionPadding:7px 5px 5px 5px;
2421
2440
  @sectionHeaderHeight:25px;
2422
2441
  @loaderHeight:6px;
@@ -82,6 +82,7 @@
82
82
  .filterable-cell-wrapper {
83
83
  display: flex;
84
84
  align-items: center;
85
+ justify-content: space-between;
85
86
  }
86
87
 
87
88
  .filterable-cell-wrapper {
@@ -193,13 +193,14 @@
193
193
  border:none;
194
194
  }
195
195
 
196
- .additional-buttons{
196
+ .creativeMgrBtn {
197
+ position: relative;
198
+ top: 1px;
197
199
  margin-right:10px;
200
+ }
198
201
 
199
- .creativeMgrBtn {
200
- position: relative;
201
- top: 1px;
202
- }
202
+ .additional-buttons{
203
+ margin-right:10px;
203
204
  }
204
205
 
205
206
  .btn-help {
@@ -1,7 +1,21 @@
1
1
 
2
2
  .publish-wizard{
3
-
4
- padding-top:30px;
3
+ display: flex;
4
+ flex-direction: column;
5
+ height: 100%;
6
+ padding-top: 30px;
7
+ box-sizing: border-box;
8
+
9
+ > div:first-of-type {
10
+ flex: 1;
11
+ }
12
+
13
+ .lower-buttons {
14
+ margin-top: auto;
15
+ padding-bottom: 5px;
16
+ width: 100%;
17
+ text-align: center;
18
+ }
5
19
 
6
20
  .missingColumns{
7
21
  margin: 15px;
@@ -74,13 +88,6 @@
74
88
  background-color: @backgroundLight;
75
89
  }
76
90
 
77
- .lower-buttons{
78
- margin-top:10px;
79
- left:0px;
80
- width:100%;
81
- text-align: center;
82
- }
83
-
84
91
  .link-wrapper{
85
92
  display: flex;
86
93
  flex-wrap: wrap;
@@ -179,4 +186,14 @@
179
186
  font-weight: bold;
180
187
  font-size:14px;
181
188
  }
189
+ }
190
+
191
+ .crm-publish-name{
192
+ background: @backgroundDark;
193
+ width: 100%;
194
+ padding-left: 5px;
195
+
196
+ &.disabled{
197
+ opacity: 0.5;
198
+ }
182
199
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@imposium-hub/components",
3
- "version": "2.12.4",
3
+ "version": "2.13.0",
4
4
  "description": "React & Typescript component / asset library for Imposium front-ends",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -251,7 +251,7 @@ export const AppWrapper: React.FC<IAppWrapperProps> = (props) => {
251
251
  if (crmApi && crmBaseUrl) {
252
252
  crmApi.init(crmBaseUrl, getAccessTokenSilently);
253
253
  }
254
- api.getAccessData(false)
254
+ api.getAccessData(false, storyId)
255
255
  .then((freshAccess: any) => {
256
256
  props.setAccessData(freshAccess);
257
257
  propagateCreds(freshAccess);
@@ -259,7 +259,7 @@ export const AppWrapper: React.FC<IAppWrapperProps> = (props) => {
259
259
  .catch((e: Error) => {
260
260
  setErrorState(APP_WRAPPER_ERROR_STATES.UNAUTHORIZED_ORG);
261
261
 
262
- // Attempt to get the access data again without the org ID, so we can at least shoe the user the org dropdown
262
+ // Attempt to get the access data again without the org ID, so we can at least show the user the org dropdown
263
263
  api.init(baseUrl, getAccessTokenSilently, null);
264
264
  if (crmApi && crmBaseUrl) {
265
265
  crmApi.init(crmBaseUrl, getAccessTokenSilently);
@@ -544,11 +544,9 @@ class ImposiumHeader extends React.PureComponent<IHeaderProps, IHeaderState> {
544
544
  </span>
545
545
 
546
546
  <span className='inner-right'>
547
+ {CrMLink}
547
548
  {storyToggle}
548
- <div className='additional-buttons'>
549
- {additionalButtons}
550
- {CrMLink}
551
- </div>
549
+ <div className='additional-buttons'>{additionalButtons}</div>
552
550
  {accountDropdownToggle}
553
551
  <a
554
552
  href='https://support.flashtalking.com/hc/en-us/sections/25515903148819-Imposium'
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { CrMPublishUI } from './publish/CrMPublishUI';
2
3
  import Button from '../button/Button';
3
4
  import SelectField from '../select-field/SelectField';
4
5
  import HRule from '../h-rule/HRule';
@@ -23,6 +24,8 @@ import PublishStatusIndicator from './publish/PublishStatusIndicator';
23
24
  import { bindActionCreators } from 'redux';
24
25
  import { publishVersion } from '../../redux/actions/publish';
25
26
  import { connect } from 'react-redux';
27
+ import { CRM_INTEGRATED_PROJECT_TYPES } from '../../constants/publish';
28
+ import { useFlag } from '@innovid/feature-flags-react';
26
29
 
27
30
  interface IPublishWizardProps {
28
31
  fromCrM?: boolean;
@@ -34,7 +37,7 @@ interface IPublishWizardProps {
34
37
  checkStoryForErrors(): any;
35
38
  addViewer(c: any): void;
36
39
  exportExperiences: () => void;
37
- publishVersion: (api: IImposiumAPI, sId: string) => any;
40
+ publishVersion: (api: IImposiumAPI, sId: string, creativeIds?: string[]) => any;
38
41
  batchesList: any;
39
42
  onClose(): any;
40
43
  api: IImposiumAPI;
@@ -94,6 +97,7 @@ interface IPublishWizardState {
94
97
  next: boolean;
95
98
  nextStep: boolean;
96
99
  publishError: string;
100
+ selectedCreatives: string[];
97
101
  }
98
102
 
99
103
  interface IBigButtonProps {
@@ -140,7 +144,8 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
140
144
  error: false,
141
145
  next: false,
142
146
  nextStep: false,
143
- publishError: null
147
+ publishError: null,
148
+ selectedCreatives: []
144
149
  };
145
150
  this.emailWorkflow = React.createRef();
146
151
  this.hiddenFileInputRef = React.createRef();
@@ -301,7 +306,7 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
301
306
 
302
307
  if (fromCrM) {
303
308
  this.props
304
- .publishVersion(api, id)
309
+ .publishVersion(api, id, this.state.selectedCreatives)
305
310
  .then(() => {
306
311
  this.setState({ screenIndex: 1 });
307
312
  })
@@ -331,15 +336,37 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
331
336
  const { story, project, fromCrM } = this.props;
332
337
  const variables = story ? story.acts[project.actId].inventory : {};
333
338
  const varLength = variables ? Object.keys(variables).length : 0;
339
+ const projectType = story.creativeId
340
+ ? CRM_INTEGRATED_PROJECT_TYPES.SINGLE_CREATIVE
341
+ : CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE;
334
342
 
335
343
  if (fromCrM && varLength === 0) {
336
344
  return true;
345
+ } else if (
346
+ fromCrM &&
347
+ this.state.selectedCreatives.length === 0 &&
348
+ projectType === CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE
349
+ ) {
350
+ return true;
337
351
  }
338
352
  return false;
339
353
  }
340
354
 
355
+ private getErrorCopyForCrMPublish() {
356
+ const { story, project } = this.props;
357
+ const variables = story ? story.acts[project.actId].inventory : {};
358
+ const varLength = variables ? Object.keys(variables).length : 0;
359
+
360
+ if (varLength === 0) {
361
+ return copy.publish.noVariablesError;
362
+ } else if (this.state.selectedCreatives.length === 0) {
363
+ return null;
364
+ }
365
+ }
366
+
341
367
  private renderLowerButtons() {
342
368
  const { screenIndex, done, error, next } = this.state;
369
+ const { fromCrM, story } = this.props;
343
370
  const { publishing } = this.props.publishData;
344
371
  const disabledForCrM = this.shouldDisablePublishButtonForCrM();
345
372
  const lowerButtons = [];
@@ -347,6 +374,15 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
347
374
  // publish and skip buttons
348
375
  if (screenIndex === 0) {
349
376
  // publish
377
+
378
+ const projectType = story.creativeId
379
+ ? CRM_INTEGRATED_PROJECT_TYPES.SINGLE_CREATIVE
380
+ : CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE;
381
+ const btnCopy = fromCrM
382
+ ? projectType === CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE
383
+ ? `Publish to ${this.state.selectedCreatives.length} Creatives`
384
+ : 'Publish to Creative Manager'
385
+ : copy.publish.btnPublish;
350
386
  lowerButtons.push(
351
387
  <Button
352
388
  tooltip={copy.publish.btnPublish}
@@ -355,7 +391,7 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
355
391
  key='btn-publish'
356
392
  onClick={() => this.handlePublish()}
357
393
  color='primary'>
358
- {copy.publish.btnPublish}
394
+ {btnCopy}
359
395
  </Button>
360
396
  );
361
397
 
@@ -434,28 +470,47 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
434
470
  }
435
471
 
436
472
  private renderPublish() {
473
+ const { fromCrM, story } = this.props;
437
474
  const { publishing } = this.props.publishData;
438
- const disabledForCrM = this.shouldDisablePublishButtonForCrM();
439
475
  const { publishError } = this.state;
440
- const errorCopy = publishError
441
- ? publishError
442
- : disabledForCrM
443
- ? copy.publish.noVariablesError
444
- : null;
445
-
476
+ const errorCopyForCrM = this.getErrorCopyForCrMPublish();
477
+ const errorCopy = publishError ? publishError : errorCopyForCrM ? errorCopyForCrM : null;
478
+ const projectType = story.creativeId
479
+ ? CRM_INTEGRATED_PROJECT_TYPES.SINGLE_CREATIVE
480
+ : CRM_INTEGRATED_PROJECT_TYPES.MULTI_CREATIVE;
446
481
  const error = errorCopy ? (
447
482
  <p className='publish-error'>
448
483
  <span className='icon'>{ICON_EXCLAIMATION_TRIANGLE}</span>&nbsp;&nbsp;{errorCopy}
449
484
  </p>
450
485
  ) : null;
451
- return (
452
- <div>
453
- <h2>{copy.publish.publishStepTitle}</h2>
454
- <HRule />
455
- <p>{publishing ? copy.publish.publishInProgress : copy.publish.publishStepDesc}</p>
456
- {error}
457
- </div>
458
- );
486
+
487
+ if (fromCrM) {
488
+ return (
489
+ <CrMPublishUI
490
+ projectType={projectType}
491
+ selectedCreatives={this.state.selectedCreatives}
492
+ onUpdateSelectedCreatives={(c) => this.setState({ selectedCreatives: c })}
493
+ onError={(e) => this.setState({ publishError: e })}
494
+ publishing={publishing}
495
+ error={error}
496
+ creativeLibraryId={story.creativeLibraryId}
497
+ projectId={story.id}
498
+ api={this.props.api}
499
+ crmBaseUrl={this.props.creativeManagerBaseUrl}
500
+ />
501
+ );
502
+ } else {
503
+ return (
504
+ <div>
505
+ <h2>{copy.publish.publishStepTitle}</h2>
506
+ <HRule />
507
+ <p>
508
+ {publishing ? copy.publish.publishInProgress : copy.publish.publishStepDesc}
509
+ </p>
510
+ {error}
511
+ </div>
512
+ );
513
+ }
459
514
  }
460
515
 
461
516
  private renderDistributionOptions() {
@@ -487,86 +542,6 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
487
542
  });
488
543
  }
489
544
 
490
- let distributionOptions = !fromCrM
491
- ? [
492
- {
493
- label: (
494
- <span>
495
- {ICON_GLOBE}&nbsp;{copy.publish.btnWebsite}
496
- </span>
497
- ),
498
- onClick: (e) => this.onSelectOption(2)
499
- },
500
- {
501
- label: (
502
- <span>
503
- {ICON_EMAIL}&nbsp;{copy.publish.btnEmail}
504
- </span>
505
- ),
506
- onClick: (e) => this.onSelectOption(3)
507
- },
508
- {
509
- label: (
510
- <span>
511
- {ICON_HUBSPOT}&nbsp;{copy.publish.btnHubspot}
512
- </span>
513
- ),
514
- onClick: (e) => this.onSelectOption(5)
515
- },
516
- {
517
- label: (
518
- <span>
519
- {ICON_PROJECT_DIAGRAM}&nbsp;{copy.publish.btnAPI}
520
- </span>
521
- ),
522
- onClick: (e) => this.onSelectOption(6)
523
- },
524
- {
525
- label: (
526
- <span>
527
- {ICON_DOWNLOAD}&nbsp;{copy.publish.btnExport}
528
- </span>
529
- ),
530
- onClick: (e) => this.onSelectOption(7)
531
- },
532
- {
533
- label: (
534
- <span>
535
- {ICON_IMAGE}&nbsp;{copy.publish.btnCRM}
536
- </span>
537
- ),
538
- onClick: (e) => this.onSelectOption(8)
539
- }
540
- ]
541
- : [
542
- {
543
- label: (
544
- <span>
545
- {ICON_DOWNLOAD}&nbsp;{copy.publish.btnRunTestBatch}
546
- </span>
547
- ),
548
- onClick: (e) => this.onSelectOption(7)
549
- },
550
- {
551
- label: (
552
- <span>
553
- {ICON_UP_RIGHT_FROM_SQUARE}&nbsp;{copy.publish.btnCrM}
554
- </span>
555
- ),
556
- link: `${creativeManagerBaseUrl}/library/${story.creativeLibraryId}/creative/${story.creativeId}/versions/`
557
- }
558
- ];
559
-
560
- if (publishDataset) {
561
- const indexes = [0, 2, 3];
562
- distributionOptions = distributionOptions.reduce((acc, value, index) => {
563
- if (!indexes.includes(index)) {
564
- acc.push(value);
565
- }
566
- return acc;
567
- }, []);
568
- }
569
-
570
545
  const compDropdown = !fromCrM ? (
571
546
  <SelectField
572
547
  label={copy.project.compName}
@@ -609,26 +584,14 @@ class PublishWizard extends React.PureComponent<IPublishWizardProps, IPublishWiz
609
584
  {accessKeyDropdown}
610
585
 
611
586
  <div className='link-wrapper'>
612
- {distributionOptions?.map((option: any, index) => {
613
- if (option.link) {
614
- return (
615
- <BigLink
616
- key={index}
617
- label={option.label}
618
- link={option.link}
619
- />
620
- );
621
- } else {
622
- return (
623
- <BigButton
624
- key={index}
625
- disabled={!selectedComposition}
626
- label={option.label}
627
- onClick={option.onClick}
628
- />
629
- );
630
- }
631
- })}
587
+ <DistributeOptions
588
+ story={story}
589
+ fromCrM={fromCrM}
590
+ onSelectOption={this.onSelectOption}
591
+ selectedComposition={selectedComposition}
592
+ publishDataset={publishDataset}
593
+ creativeManagerBaseUrl={creativeManagerBaseUrl}
594
+ />
632
595
  </div>
633
596
  </div>
634
597
  </div>
@@ -816,3 +779,140 @@ export const BigLink: React.FC<IBigLinkProps> = (p: IBigLinkProps) => {
816
779
  </a>
817
780
  );
818
781
  };
782
+
783
+ export const DistributeOptions = ({
784
+ story,
785
+ fromCrM,
786
+ onSelectOption,
787
+ selectedComposition,
788
+ publishDataset,
789
+ creativeManagerBaseUrl
790
+ }) => {
791
+ const isPrerendersEnabled = useFlag('feature.IMPOSIUM_EDITOR.PRERENDERS_CRM_WORKFLOW');
792
+
793
+ const getCrMLink = (creativeLibraryId: string, creativeId?: string) => {
794
+ if (creativeId) {
795
+ return `${creativeManagerBaseUrl}/library/${creativeLibraryId}/creative/${creativeId}/versions/`;
796
+ } else {
797
+ return `${creativeManagerBaseUrl}/library/${creativeLibraryId}`;
798
+ }
799
+ };
800
+
801
+ let distributionOptions: any = !fromCrM
802
+ ? [
803
+ {
804
+ label: (
805
+ <span>
806
+ {ICON_GLOBE}&nbsp;{copy.publish.btnWebsite}
807
+ </span>
808
+ ),
809
+ onClick: (e) => onSelectOption(2)
810
+ },
811
+ {
812
+ label: (
813
+ <span>
814
+ {ICON_EMAIL}&nbsp;{copy.publish.btnEmail}
815
+ </span>
816
+ ),
817
+ onClick: (e) => onSelectOption(3)
818
+ },
819
+ {
820
+ label: (
821
+ <span>
822
+ {ICON_HUBSPOT}&nbsp;{copy.publish.btnHubspot}
823
+ </span>
824
+ ),
825
+ onClick: (e) => onSelectOption(5)
826
+ },
827
+ {
828
+ label: (
829
+ <span>
830
+ {ICON_PROJECT_DIAGRAM}&nbsp;{copy.publish.btnAPI}
831
+ </span>
832
+ ),
833
+ onClick: (e) => onSelectOption(6)
834
+ },
835
+ {
836
+ label: (
837
+ <span>
838
+ {ICON_DOWNLOAD}&nbsp;{copy.publish.btnExport}
839
+ </span>
840
+ ),
841
+ onClick: (e) => onSelectOption(7)
842
+ },
843
+ {
844
+ label: (
845
+ <span>
846
+ {ICON_IMAGE}&nbsp;{copy.publish.btnCRM}
847
+ </span>
848
+ ),
849
+ onClick: (e) => onSelectOption(8)
850
+ }
851
+ ]
852
+ : [
853
+ {
854
+ label: (
855
+ <span>
856
+ {ICON_DOWNLOAD}&nbsp;{copy.publish.btnRunTestBatch}
857
+ </span>
858
+ ),
859
+ onClick: (e) => onSelectOption(7)
860
+ },
861
+ {
862
+ label: (
863
+ <span>
864
+ {ICON_UP_RIGHT_FROM_SQUARE}&nbsp;{copy.publish.btnCrM}
865
+ </span>
866
+ ),
867
+ link: getCrMLink(story.creativeLibraryId, story.creativeId)
868
+ }
869
+ ];
870
+
871
+ if (publishDataset) {
872
+ const indexes = [0, 2, 3];
873
+ distributionOptions = distributionOptions.reduce((acc, value, index) => {
874
+ if (!indexes.includes(index)) {
875
+ acc.push(value);
876
+ }
877
+ return acc;
878
+ }, []);
879
+ }
880
+
881
+ if (fromCrM && isPrerendersEnabled) {
882
+ distributionOptions.push({
883
+ label: (
884
+ <span>
885
+ {ICON_IMAGE}&nbsp;{copy.publish.btnCRM}
886
+ </span>
887
+ ),
888
+ onClick: (e) => onSelectOption(8),
889
+ style: { width: 'calc(100% - 4px)' }
890
+ });
891
+ }
892
+
893
+ return (
894
+ <>
895
+ {distributionOptions?.map((option: any, index) => {
896
+ if (option.link) {
897
+ return (
898
+ <BigLink
899
+ key={index}
900
+ label={option.label}
901
+ link={option.link}
902
+ />
903
+ );
904
+ } else {
905
+ return (
906
+ <BigButton
907
+ key={index}
908
+ disabled={!selectedComposition}
909
+ label={option.label}
910
+ onClick={option.onClick}
911
+ style={option.style}
912
+ />
913
+ );
914
+ }
915
+ })}
916
+ </>
917
+ );
918
+ };
@@ -0,0 +1,29 @@
1
+ import * as React from 'react';
2
+ import CheckboxField from '../../checkbox-field/CheckboxField';
3
+ import { canBePublishedTo } from './CrMPublishUI';
4
+ interface ICrMPublishCreativeSelectCellProps {
5
+ cell: any;
6
+ onSelectChange: (creativeId: string, selected: boolean) => void;
7
+ selectedCreatives: string[];
8
+ }
9
+
10
+ export const CrMPublishCreativeSelectCell: React.FC<ICrMPublishCreativeSelectCellProps> = (
11
+ props
12
+ ) => {
13
+ const { cell, onSelectChange, selectedCreatives } = props;
14
+ const creativeId = cell.row.original.creativeId;
15
+ const isSelected = selectedCreatives.includes(creativeId);
16
+ const showCheckbox = canBePublishedTo(cell.row.original.approvalStatus);
17
+ if (showCheckbox) {
18
+ return (
19
+ <CheckboxField
20
+ label=''
21
+ propagate={false}
22
+ value={isSelected}
23
+ onChange={(selected) => onSelectChange(creativeId, selected)}
24
+ />
25
+ );
26
+ } else {
27
+ return null;
28
+ }
29
+ };