@useparagon/connect 2.5.1-experimental.1 → 2.5.1-experimental.3

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.
@@ -52,5 +52,5 @@ export default class SDKEventEmitter {
52
52
  * @param userState
53
53
  * @param modalState
54
54
  */
55
- triggerEvent({ type, integrationId, integrationType, workflowId, workflowStateChange }: EventInfo, userState: AuthenticatedConnectUser): void;
55
+ triggerEvent({ type, integrationId, integrationType, credentialId, credential, workflowId, workflowStateChange, }: EventInfo, userState: AuthenticatedConnectUser): void;
56
56
  }
@@ -29,6 +29,7 @@ type FilePickerParamsOptions = {
29
29
  };
30
30
  selection: {
31
31
  mode: 'multiple' | 'single';
32
+ maximumCount?: number;
32
33
  };
33
34
  typesAndSources: {
34
35
  mode?: 'folders' | 'files' | 'all';
@@ -59,6 +60,8 @@ export declare abstract class MicrosoftPicker extends BaseFilePicker {
59
60
  protected dependencyStatus: FilePickerStatus;
60
61
  protected accessToken: string;
61
62
  protected baseUrl: string;
63
+ protected pickerWindow: Window | null;
64
+ private messageListener;
62
65
  /**
63
66
  * Abstract method to get the picker options.
64
67
  * @returns {Partial<LaunchPickersOptions>} Picker options.
@@ -93,6 +96,10 @@ export declare abstract class MicrosoftPicker extends BaseFilePicker {
93
96
  * @returns {boolean} True if the picker is opened successfully, false otherwise.
94
97
  */
95
98
  open(): boolean;
99
+ /**
100
+ * Closes the file picker and cleans up the message listener.
101
+ */
102
+ close(): void;
96
103
  /**
97
104
  * Initializes the picker with necessary options and authentication.
98
105
  * @param {FilePickerInitOptions} options The options to initialize the picker.
@@ -115,6 +122,18 @@ export declare abstract class MicrosoftPicker extends BaseFilePicker {
115
122
  * @returns {string} The combined path.
116
123
  */
117
124
  protected combinePaths(...paths: string[]): string;
125
+ private removeMessageListener;
126
+ /**
127
+ * Tears down this instance's popup and listener. Releases the shared
128
+ * session only if it still points at this instance's window, so a late
129
+ * close from a superseded instance cannot kill a newer popup.
130
+ */
131
+ private teardownSession;
132
+ /**
133
+ * Closes whichever popup is currently active on the page, regardless of
134
+ * which picker instance opened it.
135
+ */
136
+ private closeActivePickerSession;
118
137
  /**
119
138
  * Launches the picker with specified options.
120
139
  * @param {Partial<LaunchPickersOptions>} options The options to launch the picker with.
@@ -71,6 +71,7 @@ export declare class BoxFilePicker extends BaseFilePicker {
71
71
  private createPickerContainer;
72
72
  private injectCSS;
73
73
  private injectGlobalBtnContentCSS;
74
+ close(): void;
74
75
  open(): boolean;
75
76
  init(initOptions: FilePickerInitOptions): Promise<boolean>;
76
77
  private createScopedIframe;
@@ -9,6 +9,7 @@ export declare class GoogleDriveFilePicker extends BaseFilePicker {
9
9
  constructor(options: FilePickerOptions, connectSDKInstance: ConnectSDK);
10
10
  private get google();
11
11
  getInstance(): google.picker.Picker | null;
12
+ close(): void;
12
13
  open(): boolean;
13
14
  init(initOptions: FilePickerInitOptions): Promise<boolean>;
14
15
  protected onScriptLoaded(): void;
@@ -6,6 +6,7 @@ export declare abstract class BaseFilePicker implements IFilePicker {
6
6
  protected options: FilePickerOptions;
7
7
  protected initOptions: FilePickerInitOptions;
8
8
  abstract open(): boolean;
9
+ abstract close(): void;
9
10
  abstract init(options: FilePickerInitOptions): Promise<boolean>;
10
11
  /**
11
12
  * to be initialised inside {init} method
@@ -6,5 +6,6 @@ export default class ExternalFilePicker implements IFilePicker {
6
6
  open(): boolean;
7
7
  init(options: FilePickerInitOptions): Promise<boolean>;
8
8
  getInstance(): any;
9
+ close(): void;
9
10
  }
10
11
  export declare const buildExternalFilePickerInstance: (connectSingleton: ConnectSDK) => ExternalFilePickerConstruct;