dromo-uploader-js 2.8.0 → 2.9.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.
@@ -628,6 +628,7 @@ export type IUser = {
628
628
  companyId?: string | undefined;
629
629
  companyName?: string | undefined;
630
630
  };
631
+ export type CustomStepInsertAfter = "HEADER_SELECT" | "COLUMN_MATCH" | "SELECT_MATCH";
631
632
  type MaybeAsync<T> = T | Promise<T>;
632
633
  export interface IParentConnectionMethods {
633
634
  handleColumnHooks: (fieldName: string, data: IColumnHookInput[]) => Promise<IColumnHookOutput[]>;
@@ -639,6 +640,8 @@ export interface IParentConnectionMethods {
639
640
  handleCloseModal: () => void;
640
641
  handleCancel: () => void;
641
642
  handleParseFileCallback: (buffer: ArrayBuffer, fileName: string) => Promise<string[][] | void>;
643
+ handleCustomStep: (id: string) => Promise<string | void>;
644
+ handleCustomStepMessage: (id: string, payload: unknown) => Promise<void>;
642
645
  }
643
646
  export interface IConnectionMethods {
644
647
  init: (licenseKey: string, fields: IDeveloperField[], settings: IDeveloperSettings, user: IUser, appHost?: string) => void;
@@ -661,11 +664,20 @@ export interface IConnectionMethods {
661
664
  cancelButtonText?: string;
662
665
  }) => void;
663
666
  setCustomParserFileExtensions: (fileExtensions: string[]) => void;
667
+ setCustomSteps: (steps: Array<{
668
+ id: string;
669
+ insertAfter: CustomStepInsertAfter;
670
+ label?: string;
671
+ url?: string;
672
+ }>) => void;
673
+ completeCustomStep: () => void;
674
+ goBackCustomStep: () => void;
664
675
  }
665
676
  export type WrapAsync<T> = {
666
677
  [P in keyof T]: T[P] extends (...args: infer Args) => infer Return ? (...args: Args) => Promise<Return> : T[P];
667
678
  };
668
679
  export type IPublicConnectionMethods = WrapAsync<Pick<IConnectionMethods, "addField" | "updateInfoMessages" | "setHeaderRowOverride" | "setUser" | "removeField" | "setDevelopmentMode" | "addRows" | "removeRows" | "setConfirmationMessage">>;
680
+ export type ICustomStepConnectionMethods = IPublicConnectionMethods & WrapAsync<Pick<IConnectionMethods, "completeCustomStep" | "goBackCustomStep">>;
669
681
  export type IDeveloperFieldType = "string" | "checkbox" | "select" | "multi-select" | "number" | "domain" | "date" | "ssn" | "datetime" | "phone-number" | "time" | "url" | "us-zip-code" | "country" | "uuid" | "us-state-territory" | "email";
670
682
  export interface ICellRef {
671
683
  rowIndex: number;
@@ -816,6 +828,25 @@ export interface IStepHook {
816
828
  type: keyof typeof EStepHook;
817
829
  callback: (uploader: IPublicConnectionMethods, data: IUploadStepData | IReviewStepData | IReviewStepPostHooksData) => MaybeAsync<void>;
818
830
  }
831
+ export interface ICustomStepConfig {
832
+ id: string;
833
+ insertAfter: CustomStepInsertAfter;
834
+ /** Label shown in the stepper bar. Defaults to the step id if omitted. */
835
+ label?: string;
836
+ /**
837
+ * Dromo renders an <iframe> pointing to this URL inside the standard
838
+ * StepContainer. Step id and label are appended as query params
839
+ * (?stepId=…&stepLabel=…). The iframe page signals navigation by posting
840
+ * { type: "DROMO_NEXT" } or { type: "DROMO_BACK" } to its parent window.
841
+ */
842
+ url?: string;
843
+ /**
844
+ * Called when the iframe posts { type: "DROMO_MESSAGE", payload: any }.
845
+ * Receives the same uploader instance as step hooks so you can call
846
+ * addField, removeField, addRows, etc. in response to iframe messages.
847
+ */
848
+ onMessage?: (uploader: ICustomStepConnectionMethods, payload: unknown) => MaybeAsync<void>;
849
+ }
819
850
  export type IBeforeFinishCallback = (data: Record<string, any>[], metadata: IResultMetadataWithValues, instance: IPublicConnectionMethods) => MaybeAsync<IBeforeFinishOutput>;
820
851
  export type IBeforeFinishOutput = void | {
821
852
  cancel: true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dromo-uploader-js",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Easy to use data (CSV, TSV, Excel) importer",
5
5
  "author": "ankitgoyal100",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  "@rollup/plugin-commonjs": "^16.0.0",
35
35
  "@rollup/plugin-node-resolve": "^10.0.0",
36
36
  "@rollup/plugin-replace": "^2.3.4",
37
+ "@rollup/plugin-terser": "^1.0.0",
37
38
  "@typescript-eslint/eslint-plugin": "^6.3.0",
38
39
  "@typescript-eslint/parser": "^6.3.0",
39
40
  "eslint": "^7.32.0",
@@ -43,12 +44,11 @@
43
44
  "eslint-plugin-node": "^11.1.0",
44
45
  "eslint-plugin-prettier": "^4.0.0",
45
46
  "eslint-plugin-promise": "^5.2.0",
46
- "microbundle-crl": "^0.13.10",
47
47
  "prettier": "^2.6.2",
48
48
  "rollup": "^2.79.2",
49
- "rollup-plugin-terser": "^7.0.2",
50
49
  "rollup-plugin-typescript2": "^0.29.0",
51
- "serve": "^13.0.2",
50
+ "serve": "^14.2.6",
51
+ "tslib": "^2.8.1",
52
52
  "typescript": "^5.1.6"
53
53
  },
54
54
  "files": [