@useparagon/connect 2.5.1-experimental.1 → 2.5.1-experimental.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.
@@ -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
  }
@@ -59,6 +59,8 @@ export declare abstract class MicrosoftPicker extends BaseFilePicker {
59
59
  protected dependencyStatus: FilePickerStatus;
60
60
  protected accessToken: string;
61
61
  protected baseUrl: string;
62
+ protected pickerWindow: Window | null;
63
+ private messageListener;
62
64
  /**
63
65
  * Abstract method to get the picker options.
64
66
  * @returns {Partial<LaunchPickersOptions>} Picker options.
@@ -93,6 +95,10 @@ export declare abstract class MicrosoftPicker extends BaseFilePicker {
93
95
  * @returns {boolean} True if the picker is opened successfully, false otherwise.
94
96
  */
95
97
  open(): boolean;
98
+ /**
99
+ * Closes the file picker and cleans up the message listener.
100
+ */
101
+ close(): void;
96
102
  /**
97
103
  * Initializes the picker with necessary options and authentication.
98
104
  * @param {FilePickerInitOptions} options The options to initialize the picker.
@@ -115,6 +121,18 @@ export declare abstract class MicrosoftPicker extends BaseFilePicker {
115
121
  * @returns {string} The combined path.
116
122
  */
117
123
  protected combinePaths(...paths: string[]): string;
124
+ private removeMessageListener;
125
+ /**
126
+ * Tears down this instance's popup and listener. Releases the shared
127
+ * session only if it still points at this instance's window, so a late
128
+ * close from a superseded instance cannot kill a newer popup.
129
+ */
130
+ private teardownSession;
131
+ /**
132
+ * Closes whichever popup is currently active on the page, regardless of
133
+ * which picker instance opened it.
134
+ */
135
+ private closeActivePickerSession;
118
136
  /**
119
137
  * Launches the picker with specified options.
120
138
  * @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;