@imposium-hub/components 1.62.1 → 1.62.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.
@@ -67,6 +67,14 @@ export interface IImposiumAPI {
67
67
  compId?: string,
68
68
  addMedia?: boolean
69
69
  ): Promise<any | Error>;
70
+ importBatchDataFromDataset(
71
+ batchId: string,
72
+ datasetId: string,
73
+ embed?: boolean,
74
+ accessKey?: string,
75
+ compId?: string,
76
+ addMedia?: boolean
77
+ ): Promise<any | Error>;
70
78
  updateBatchColumns(batchId: string, columns: any);
71
79
  insertNewRow(batchId: string, rowIndex: number);
72
80
  updateCellValue(batchId: string, colIndex: number, rowIndex: number, value: string);
@@ -717,6 +725,34 @@ export default class API {
717
725
  });
718
726
  };
719
727
 
728
+ public importBatchDataFromDataset = (
729
+ batchId: string,
730
+ datasetId: string,
731
+ embed: boolean = false,
732
+ accessKey: string = null,
733
+ compId: string = null,
734
+ addMedia: boolean = false
735
+ ): Promise<any | Error> => {
736
+ const formData: FormData = new FormData();
737
+
738
+ if (embed && accessKey && compId) {
739
+ formData.append('include_email_embed', 'true');
740
+ formData.append('composition_id', compId);
741
+ formData.append('access_key', accessKey);
742
+ } else if (compId) {
743
+ formData.append('composition_id', compId);
744
+ }
745
+
746
+ if (addMedia) {
747
+ formData.append('include_media', 'true');
748
+ }
749
+ return this.doRequest({
750
+ method: 'POST',
751
+ url: `/batch/${batchId}/data/from-dataset/${datasetId}`,
752
+ data: formData
753
+ });
754
+ };
755
+
720
756
  public updateBatchColumns = (batchId: string, columns: any[]): Promise<any | Error> => {
721
757
  return this.doRequest({
722
758
  method: 'PUT',