@amp-labs/react 1.5.1 → 1.5.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.
Files changed (26) hide show
  1. package/build/generated-sources/api/src/apis/ProjectApi.d.ts +20 -0
  2. package/build/generated-sources/api/src/apis/ProjectApi.js +21 -0
  3. package/build/generated-sources/api/src/models/ApiKeyOpts.d.ts +63 -0
  4. package/build/generated-sources/api/src/models/ApiKeyOpts.js +66 -0
  5. package/build/generated-sources/api/src/models/AuthType.d.ts +2 -0
  6. package/build/generated-sources/api/src/models/AuthType.js +2 -0
  7. package/build/generated-sources/api/src/models/BaseReadConfigObject.d.ts +6 -0
  8. package/build/generated-sources/api/src/models/BaseReadConfigObject.js +2 -0
  9. package/build/generated-sources/api/src/models/{OauthOpts.d.ts → Oauth2Opts.d.ts} +23 -17
  10. package/build/generated-sources/api/src/models/{OauthOpts.js → Oauth2Opts.js} +16 -14
  11. package/build/generated-sources/api/src/models/ProviderInfo.d.ts +16 -3
  12. package/build/generated-sources/api/src/models/ProviderInfo.js +9 -4
  13. package/build/generated-sources/api/src/models/index.d.ts +2 -2
  14. package/build/generated-sources/api/src/models/index.js +2 -2
  15. package/build/src/components/Configure/content/fields/OptionalFields/OptionalFields.js +21 -9
  16. package/build/src/components/Configure/content/fields/RequiredFields.js +1 -1
  17. package/build/src/components/Oauth/OauthFlow/OauthFlow.js +1 -1
  18. package/build/src/components/Oauth/WorkspaceEntry/WorkspaceOauthFlow.js +2 -5
  19. package/build/src/components/Oauth/fetchOAuthPopupURL.js +1 -1
  20. package/build/src/services/version.d.ts +1 -1
  21. package/build/src/services/version.js +1 -1
  22. package/package.json +1 -1
  23. package/build/generated-sources/api/src/models/ProjectMembership.d.ts +0 -56
  24. package/build/generated-sources/api/src/models/ProjectMembership.js +0 -63
  25. package/build/src/components/Oauth/OAuthPopup.d.ts +0 -20
  26. package/build/src/components/Oauth/OAuthPopup.js +0 -85
@@ -70,6 +70,18 @@ export interface ProjectApiInterface {
70
70
  * Get a project
71
71
  */
72
72
  getProject(requestParameters: GetProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Project>;
73
+ /**
74
+ *
75
+ * @summary List all projects that the API key or user credential has access to
76
+ * @param {*} [options] Override http request option.
77
+ * @throws {RequiredError}
78
+ * @memberof ProjectApiInterface
79
+ */
80
+ listProjectsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Project>>>;
81
+ /**
82
+ * List all projects that the API key or user credential has access to
83
+ */
84
+ listProjects(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Project>>;
73
85
  /**
74
86
  *
75
87
  * @summary Update a project
@@ -113,6 +125,14 @@ export declare class ProjectApi extends runtime.BaseAPI implements ProjectApiInt
113
125
  * Get a project
114
126
  */
115
127
  getProject(requestParameters: GetProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Project>;
128
+ /**
129
+ * List all projects that the API key or user credential has access to
130
+ */
131
+ listProjectsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<Project>>>;
132
+ /**
133
+ * List all projects that the API key or user credential has access to
134
+ */
135
+ listProjects(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<Project>>;
116
136
  /**
117
137
  * Update a project
118
138
  */
@@ -116,6 +116,27 @@ class ProjectApi extends runtime.BaseAPI {
116
116
  const response = await this.getProjectRaw(requestParameters, initOverrides);
117
117
  return await response.value();
118
118
  }
119
+ /**
120
+ * List all projects that the API key or user credential has access to
121
+ */
122
+ async listProjectsRaw(initOverrides) {
123
+ const queryParameters = {};
124
+ const headerParameters = {};
125
+ const response = await this.request({
126
+ path: `/projects`,
127
+ method: 'GET',
128
+ headers: headerParameters,
129
+ query: queryParameters,
130
+ }, initOverrides);
131
+ return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(models_1.ProjectFromJSON));
132
+ }
133
+ /**
134
+ * List all projects that the API key or user credential has access to
135
+ */
136
+ async listProjects(initOverrides) {
137
+ const response = await this.listProjectsRaw(initOverrides);
138
+ return await response.value();
139
+ }
119
140
  /**
120
141
  * Update a project
121
142
  */
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Ampersand public API
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface ApiKeyOpts
16
+ */
17
+ export interface ApiKeyOpts {
18
+ /**
19
+ *
20
+ * @type {string}
21
+ * @memberof ApiKeyOpts
22
+ */
23
+ type: ApiKeyOptsTypeEnum;
24
+ /**
25
+ *
26
+ * @type {string}
27
+ * @memberof ApiKeyOpts
28
+ */
29
+ queryParamName?: string;
30
+ /**
31
+ *
32
+ * @type {string}
33
+ * @memberof ApiKeyOpts
34
+ */
35
+ headerName?: string;
36
+ /**
37
+ *
38
+ * @type {string}
39
+ * @memberof ApiKeyOpts
40
+ */
41
+ valuePrefix?: string;
42
+ /**
43
+ * URL with more information about how to get or use an API key.
44
+ * @type {string}
45
+ * @memberof ApiKeyOpts
46
+ */
47
+ docsURL?: string;
48
+ }
49
+ /**
50
+ * @export
51
+ */
52
+ export declare const ApiKeyOptsTypeEnum: {
53
+ readonly Query: "in-query";
54
+ readonly Header: "in-header";
55
+ };
56
+ export type ApiKeyOptsTypeEnum = typeof ApiKeyOptsTypeEnum[keyof typeof ApiKeyOptsTypeEnum];
57
+ /**
58
+ * Check if a given object implements the ApiKeyOpts interface.
59
+ */
60
+ export declare function instanceOfApiKeyOpts(value: object): boolean;
61
+ export declare function ApiKeyOptsFromJSON(json: any): ApiKeyOpts;
62
+ export declare function ApiKeyOptsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiKeyOpts;
63
+ export declare function ApiKeyOptsToJSON(value?: ApiKeyOpts | null): any;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * Ampersand public API
6
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+ *
8
+ * The version of the OpenAPI document: 1.0.0
9
+ *
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.ApiKeyOptsToJSON = exports.ApiKeyOptsFromJSONTyped = exports.ApiKeyOptsFromJSON = exports.instanceOfApiKeyOpts = exports.ApiKeyOptsTypeEnum = void 0;
17
+ const runtime_1 = require("../runtime");
18
+ /**
19
+ * @export
20
+ */
21
+ exports.ApiKeyOptsTypeEnum = {
22
+ Query: 'in-query',
23
+ Header: 'in-header'
24
+ };
25
+ /**
26
+ * Check if a given object implements the ApiKeyOpts interface.
27
+ */
28
+ function instanceOfApiKeyOpts(value) {
29
+ let isInstance = true;
30
+ isInstance = isInstance && "type" in value;
31
+ return isInstance;
32
+ }
33
+ exports.instanceOfApiKeyOpts = instanceOfApiKeyOpts;
34
+ function ApiKeyOptsFromJSON(json) {
35
+ return ApiKeyOptsFromJSONTyped(json, false);
36
+ }
37
+ exports.ApiKeyOptsFromJSON = ApiKeyOptsFromJSON;
38
+ function ApiKeyOptsFromJSONTyped(json, ignoreDiscriminator) {
39
+ if ((json === undefined) || (json === null)) {
40
+ return json;
41
+ }
42
+ return {
43
+ 'type': json['type'],
44
+ 'queryParamName': !(0, runtime_1.exists)(json, 'queryParamName') ? undefined : json['queryParamName'],
45
+ 'headerName': !(0, runtime_1.exists)(json, 'headerName') ? undefined : json['headerName'],
46
+ 'valuePrefix': !(0, runtime_1.exists)(json, 'valuePrefix') ? undefined : json['valuePrefix'],
47
+ 'docsURL': !(0, runtime_1.exists)(json, 'docsURL') ? undefined : json['docsURL'],
48
+ };
49
+ }
50
+ exports.ApiKeyOptsFromJSONTyped = ApiKeyOptsFromJSONTyped;
51
+ function ApiKeyOptsToJSON(value) {
52
+ if (value === undefined) {
53
+ return undefined;
54
+ }
55
+ if (value === null) {
56
+ return null;
57
+ }
58
+ return {
59
+ 'type': value.type,
60
+ 'queryParamName': value.queryParamName,
61
+ 'headerName': value.headerName,
62
+ 'valuePrefix': value.valuePrefix,
63
+ 'docsURL': value.docsURL,
64
+ };
65
+ }
66
+ exports.ApiKeyOptsToJSON = ApiKeyOptsToJSON;
@@ -15,6 +15,8 @@
15
15
  */
16
16
  export declare const AuthType: {
17
17
  readonly Oauth2: "oauth2";
18
+ readonly ApiKey: "api_key";
19
+ readonly Basic: "basic";
18
20
  readonly None: "none";
19
21
  };
20
22
  export type AuthType = typeof AuthType[keyof typeof AuthType];
@@ -20,6 +20,8 @@ exports.AuthTypeToJSON = exports.AuthTypeFromJSONTyped = exports.AuthTypeFromJSO
20
20
  */
21
21
  exports.AuthType = {
22
22
  Oauth2: 'oauth2',
23
+ ApiKey: 'api_key',
24
+ Basic: 'basic',
23
25
  None: 'none'
24
26
  };
25
27
  function AuthTypeFromJSON(json) {
@@ -49,6 +49,12 @@ export interface BaseReadConfigObject {
49
49
  selectedFieldMappings?: {
50
50
  [key: string]: string;
51
51
  };
52
+ /**
53
+ * The history configuration for the object.
54
+ * @type {string}
55
+ * @memberof BaseReadConfigObject
56
+ */
57
+ history?: string;
52
58
  }
53
59
  /**
54
60
  * Check if a given object implements the BaseReadConfigObject interface.
@@ -37,6 +37,7 @@ function BaseReadConfigObjectFromJSONTyped(json, ignoreDiscriminator) {
37
37
  'destination': !(0, runtime_1.exists)(json, 'destination') ? undefined : json['destination'],
38
38
  'selectedFields': !(0, runtime_1.exists)(json, 'selectedFields') ? undefined : json['selectedFields'],
39
39
  'selectedFieldMappings': !(0, runtime_1.exists)(json, 'selectedFieldMappings') ? undefined : json['selectedFieldMappings'],
40
+ 'history': !(0, runtime_1.exists)(json, 'history') ? undefined : json['history'],
40
41
  };
41
42
  }
42
43
  exports.BaseReadConfigObjectFromJSONTyped = BaseReadConfigObjectFromJSONTyped;
@@ -53,6 +54,7 @@ function BaseReadConfigObjectToJSON(value) {
53
54
  'destination': value.destination,
54
55
  'selectedFields': value.selectedFields,
55
56
  'selectedFieldMappings': value.selectedFieldMappings,
57
+ 'history': value.history,
56
58
  };
57
59
  }
58
60
  exports.BaseReadConfigObjectToJSON = BaseReadConfigObjectToJSON;
@@ -13,59 +13,65 @@ import type { TokenMetadataFields } from './TokenMetadataFields';
13
13
  /**
14
14
  *
15
15
  * @export
16
- * @interface OauthOpts
16
+ * @interface Oauth2Opts
17
17
  */
18
- export interface OauthOpts {
18
+ export interface Oauth2Opts {
19
19
  /**
20
20
  *
21
21
  * @type {string}
22
- * @memberof OauthOpts
22
+ * @memberof Oauth2Opts
23
23
  */
24
- grantType: OauthOptsGrantTypeEnum;
24
+ grantType: Oauth2OptsGrantTypeEnum;
25
25
  /**
26
26
  *
27
27
  * @type {string}
28
- * @memberof OauthOpts
28
+ * @memberof Oauth2Opts
29
29
  */
30
- authURL: string;
30
+ authURL?: string;
31
31
  /**
32
32
  *
33
33
  * @type {string}
34
- * @memberof OauthOpts
34
+ * @memberof Oauth2Opts
35
35
  */
36
36
  tokenURL: string;
37
37
  /**
38
38
  *
39
39
  * @type {boolean}
40
- * @memberof OauthOpts
40
+ * @memberof Oauth2Opts
41
41
  */
42
42
  explicitScopesRequired: boolean;
43
43
  /**
44
44
  *
45
45
  * @type {boolean}
46
- * @memberof OauthOpts
46
+ * @memberof Oauth2Opts
47
47
  */
48
48
  explicitWorkspaceRequired: boolean;
49
+ /**
50
+ *
51
+ * @type {string}
52
+ * @memberof Oauth2Opts
53
+ */
54
+ audience?: string;
49
55
  /**
50
56
  *
51
57
  * @type {TokenMetadataFields}
52
- * @memberof OauthOpts
58
+ * @memberof Oauth2Opts
53
59
  */
54
60
  tokenMetadataFields: TokenMetadataFields;
55
61
  }
56
62
  /**
57
63
  * @export
58
64
  */
59
- export declare const OauthOptsGrantTypeEnum: {
65
+ export declare const Oauth2OptsGrantTypeEnum: {
60
66
  readonly AuthorizationCode: "authorizationCode";
61
67
  readonly ClientCredentials: "clientCredentials";
62
68
  readonly Pkce: "PKCE";
63
69
  };
64
- export type OauthOptsGrantTypeEnum = typeof OauthOptsGrantTypeEnum[keyof typeof OauthOptsGrantTypeEnum];
70
+ export type Oauth2OptsGrantTypeEnum = typeof Oauth2OptsGrantTypeEnum[keyof typeof Oauth2OptsGrantTypeEnum];
65
71
  /**
66
- * Check if a given object implements the OauthOpts interface.
72
+ * Check if a given object implements the Oauth2Opts interface.
67
73
  */
68
- export declare function instanceOfOauthOpts(value: object): boolean;
69
- export declare function OauthOptsFromJSON(json: any): OauthOpts;
70
- export declare function OauthOptsFromJSONTyped(json: any, ignoreDiscriminator: boolean): OauthOpts;
71
- export declare function OauthOptsToJSON(value?: OauthOpts | null): any;
74
+ export declare function instanceOfOauth2Opts(value: object): boolean;
75
+ export declare function Oauth2OptsFromJSON(json: any): Oauth2Opts;
76
+ export declare function Oauth2OptsFromJSONTyped(json: any, ignoreDiscriminator: boolean): Oauth2Opts;
77
+ export declare function Oauth2OptsToJSON(value?: Oauth2Opts | null): any;
@@ -13,49 +13,50 @@
13
13
  * Do not edit the class manually.
14
14
  */
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.OauthOptsToJSON = exports.OauthOptsFromJSONTyped = exports.OauthOptsFromJSON = exports.instanceOfOauthOpts = exports.OauthOptsGrantTypeEnum = void 0;
16
+ exports.Oauth2OptsToJSON = exports.Oauth2OptsFromJSONTyped = exports.Oauth2OptsFromJSON = exports.instanceOfOauth2Opts = exports.Oauth2OptsGrantTypeEnum = void 0;
17
+ const runtime_1 = require("../runtime");
17
18
  const TokenMetadataFields_1 = require("./TokenMetadataFields");
18
19
  /**
19
20
  * @export
20
21
  */
21
- exports.OauthOptsGrantTypeEnum = {
22
+ exports.Oauth2OptsGrantTypeEnum = {
22
23
  AuthorizationCode: 'authorizationCode',
23
24
  ClientCredentials: 'clientCredentials',
24
25
  Pkce: 'PKCE'
25
26
  };
26
27
  /**
27
- * Check if a given object implements the OauthOpts interface.
28
+ * Check if a given object implements the Oauth2Opts interface.
28
29
  */
29
- function instanceOfOauthOpts(value) {
30
+ function instanceOfOauth2Opts(value) {
30
31
  let isInstance = true;
31
32
  isInstance = isInstance && "grantType" in value;
32
- isInstance = isInstance && "authURL" in value;
33
33
  isInstance = isInstance && "tokenURL" in value;
34
34
  isInstance = isInstance && "explicitScopesRequired" in value;
35
35
  isInstance = isInstance && "explicitWorkspaceRequired" in value;
36
36
  isInstance = isInstance && "tokenMetadataFields" in value;
37
37
  return isInstance;
38
38
  }
39
- exports.instanceOfOauthOpts = instanceOfOauthOpts;
40
- function OauthOptsFromJSON(json) {
41
- return OauthOptsFromJSONTyped(json, false);
39
+ exports.instanceOfOauth2Opts = instanceOfOauth2Opts;
40
+ function Oauth2OptsFromJSON(json) {
41
+ return Oauth2OptsFromJSONTyped(json, false);
42
42
  }
43
- exports.OauthOptsFromJSON = OauthOptsFromJSON;
44
- function OauthOptsFromJSONTyped(json, ignoreDiscriminator) {
43
+ exports.Oauth2OptsFromJSON = Oauth2OptsFromJSON;
44
+ function Oauth2OptsFromJSONTyped(json, ignoreDiscriminator) {
45
45
  if ((json === undefined) || (json === null)) {
46
46
  return json;
47
47
  }
48
48
  return {
49
49
  'grantType': json['grantType'],
50
- 'authURL': json['authURL'],
50
+ 'authURL': !(0, runtime_1.exists)(json, 'authURL') ? undefined : json['authURL'],
51
51
  'tokenURL': json['tokenURL'],
52
52
  'explicitScopesRequired': json['explicitScopesRequired'],
53
53
  'explicitWorkspaceRequired': json['explicitWorkspaceRequired'],
54
+ 'audience': !(0, runtime_1.exists)(json, 'audience') ? undefined : json['audience'],
54
55
  'tokenMetadataFields': (0, TokenMetadataFields_1.TokenMetadataFieldsFromJSON)(json['tokenMetadataFields']),
55
56
  };
56
57
  }
57
- exports.OauthOptsFromJSONTyped = OauthOptsFromJSONTyped;
58
- function OauthOptsToJSON(value) {
58
+ exports.Oauth2OptsFromJSONTyped = Oauth2OptsFromJSONTyped;
59
+ function Oauth2OptsToJSON(value) {
59
60
  if (value === undefined) {
60
61
  return undefined;
61
62
  }
@@ -68,7 +69,8 @@ function OauthOptsToJSON(value) {
68
69
  'tokenURL': value.tokenURL,
69
70
  'explicitScopesRequired': value.explicitScopesRequired,
70
71
  'explicitWorkspaceRequired': value.explicitWorkspaceRequired,
72
+ 'audience': value.audience,
71
73
  'tokenMetadataFields': (0, TokenMetadataFields_1.TokenMetadataFieldsToJSON)(value.tokenMetadataFields),
72
74
  };
73
75
  }
74
- exports.OauthOptsToJSON = OauthOptsToJSON;
76
+ exports.Oauth2OptsToJSON = Oauth2OptsToJSON;
@@ -9,8 +9,9 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
+ import type { ApiKeyOpts } from './ApiKeyOpts';
12
13
  import type { AuthType } from './AuthType';
13
- import type { OauthOpts } from './OauthOpts';
14
+ import type { Oauth2Opts } from './Oauth2Opts';
14
15
  import type { Support } from './Support';
15
16
  /**
16
17
  *
@@ -18,6 +19,12 @@ import type { Support } from './Support';
18
19
  * @interface ProviderInfo
19
20
  */
20
21
  export interface ProviderInfo {
22
+ /**
23
+ *
24
+ * @type {string}
25
+ * @memberof ProviderInfo
26
+ */
27
+ name: string;
21
28
  /**
22
29
  *
23
30
  * @type {AuthType}
@@ -32,10 +39,16 @@ export interface ProviderInfo {
32
39
  baseURL: string;
33
40
  /**
34
41
  *
35
- * @type {OauthOpts}
42
+ * @type {Oauth2Opts}
43
+ * @memberof ProviderInfo
44
+ */
45
+ oauth2Opts?: Oauth2Opts;
46
+ /**
47
+ *
48
+ * @type {ApiKeyOpts}
36
49
  * @memberof ProviderInfo
37
50
  */
38
- oauthOpts: OauthOpts;
51
+ apiKeyOpts?: ApiKeyOpts;
39
52
  /**
40
53
  *
41
54
  * @type {Support}
@@ -15,17 +15,18 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.ProviderInfoToJSON = exports.ProviderInfoFromJSONTyped = exports.ProviderInfoFromJSON = exports.instanceOfProviderInfo = void 0;
17
17
  const runtime_1 = require("../runtime");
18
+ const ApiKeyOpts_1 = require("./ApiKeyOpts");
18
19
  const AuthType_1 = require("./AuthType");
19
- const OauthOpts_1 = require("./OauthOpts");
20
+ const Oauth2Opts_1 = require("./Oauth2Opts");
20
21
  const Support_1 = require("./Support");
21
22
  /**
22
23
  * Check if a given object implements the ProviderInfo interface.
23
24
  */
24
25
  function instanceOfProviderInfo(value) {
25
26
  let isInstance = true;
27
+ isInstance = isInstance && "name" in value;
26
28
  isInstance = isInstance && "authType" in value;
27
29
  isInstance = isInstance && "baseURL" in value;
28
- isInstance = isInstance && "oauthOpts" in value;
29
30
  isInstance = isInstance && "support" in value;
30
31
  isInstance = isInstance && "providerOpts" in value;
31
32
  return isInstance;
@@ -40,9 +41,11 @@ function ProviderInfoFromJSONTyped(json, ignoreDiscriminator) {
40
41
  return json;
41
42
  }
42
43
  return {
44
+ 'name': json['name'],
43
45
  'authType': (0, AuthType_1.AuthTypeFromJSON)(json['authType']),
44
46
  'baseURL': json['baseURL'],
45
- 'oauthOpts': (0, OauthOpts_1.OauthOptsFromJSON)(json['oauthOpts']),
47
+ 'oauth2Opts': !(0, runtime_1.exists)(json, 'oauth2Opts') ? undefined : (0, Oauth2Opts_1.Oauth2OptsFromJSON)(json['oauth2Opts']),
48
+ 'apiKeyOpts': !(0, runtime_1.exists)(json, 'apiKeyOpts') ? undefined : (0, ApiKeyOpts_1.ApiKeyOptsFromJSON)(json['apiKeyOpts']),
46
49
  'support': (0, Support_1.SupportFromJSON)(json['support']),
47
50
  'providerOpts': json['providerOpts'],
48
51
  'displayName': !(0, runtime_1.exists)(json, 'displayName') ? undefined : json['displayName'],
@@ -58,9 +61,11 @@ function ProviderInfoToJSON(value) {
58
61
  return null;
59
62
  }
60
63
  return {
64
+ 'name': value.name,
61
65
  'authType': (0, AuthType_1.AuthTypeToJSON)(value.authType),
62
66
  'baseURL': value.baseURL,
63
- 'oauthOpts': (0, OauthOpts_1.OauthOptsToJSON)(value.oauthOpts),
67
+ 'oauth2Opts': (0, Oauth2Opts_1.Oauth2OptsToJSON)(value.oauth2Opts),
68
+ 'apiKeyOpts': (0, ApiKeyOpts_1.ApiKeyOptsToJSON)(value.apiKeyOpts),
64
69
  'support': (0, Support_1.SupportToJSON)(value.support),
65
70
  'providerOpts': value.providerOpts,
66
71
  'displayName': value.displayName,
@@ -1,5 +1,6 @@
1
1
  export * from './AcceptInviteRequest';
2
2
  export * from './ApiKey';
3
+ export * from './ApiKeyOpts';
3
4
  export * from './ApiKeyRequest';
4
5
  export * from './ApiProblem';
5
6
  export * from './AuthType';
@@ -62,8 +63,8 @@ export * from './IntegrationWriteObject';
62
63
  export * from './Invite';
63
64
  export * from './Log';
64
65
  export * from './LogMessage';
66
+ export * from './Oauth2Opts';
65
67
  export * from './OauthConnectRequest';
66
- export * from './OauthOpts';
67
68
  export * from './Operation';
68
69
  export * from './OperationEvent';
69
70
  export * from './OptionalFieldsAutoOption';
@@ -72,7 +73,6 @@ export * from './PatchApiKeyRequest';
72
73
  export * from './PatchApiKeyRequestApiKey';
73
74
  export * from './Problem';
74
75
  export * from './Project';
75
- export * from './ProjectMembership';
76
76
  export * from './ProviderApp';
77
77
  export * from './ProviderInfo';
78
78
  export * from './Revision';
@@ -18,6 +18,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
18
18
  /* eslint-disable */
19
19
  __exportStar(require("./AcceptInviteRequest"), exports);
20
20
  __exportStar(require("./ApiKey"), exports);
21
+ __exportStar(require("./ApiKeyOpts"), exports);
21
22
  __exportStar(require("./ApiKeyRequest"), exports);
22
23
  __exportStar(require("./ApiProblem"), exports);
23
24
  __exportStar(require("./AuthType"), exports);
@@ -80,8 +81,8 @@ __exportStar(require("./IntegrationWriteObject"), exports);
80
81
  __exportStar(require("./Invite"), exports);
81
82
  __exportStar(require("./Log"), exports);
82
83
  __exportStar(require("./LogMessage"), exports);
84
+ __exportStar(require("./Oauth2Opts"), exports);
83
85
  __exportStar(require("./OauthConnectRequest"), exports);
84
- __exportStar(require("./OauthOpts"), exports);
85
86
  __exportStar(require("./Operation"), exports);
86
87
  __exportStar(require("./OperationEvent"), exports);
87
88
  __exportStar(require("./OptionalFieldsAutoOption"), exports);
@@ -90,7 +91,6 @@ __exportStar(require("./PatchApiKeyRequest"), exports);
90
91
  __exportStar(require("./PatchApiKeyRequestApiKey"), exports);
91
92
  __exportStar(require("./Problem"), exports);
92
93
  __exportStar(require("./Project"), exports);
93
- __exportStar(require("./ProjectMembership"), exports);
94
94
  __exportStar(require("./ProviderApp"), exports);
95
95
  __exportStar(require("./ProviderInfo"), exports);
96
96
  __exportStar(require("./Revision"), exports);
@@ -8,7 +8,7 @@ const useSelectedConfigureState_1 = require("../../useSelectedConfigureState");
8
8
  const FieldHeader_1 = require("../FieldHeader");
9
9
  const setOptionalField_1 = require("./setOptionalField");
10
10
  function OptionalFields() {
11
- var _a, _b, _c, _d, _e;
11
+ var _a, _b;
12
12
  const { appName, configureState, setConfigureState, selectedObjectName, } = (0, useSelectedConfigureState_1.useSelectedConfigureState)();
13
13
  const selectedOptionalFields = (_a = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _a === void 0 ? void 0 : _a.selectedOptionalFields;
14
14
  const onCheckboxChange = (e) => {
@@ -17,13 +17,25 @@ function OptionalFields() {
17
17
  (0, setOptionalField_1.setOptionalField)(selectedObjectName, setConfigureState, name, checked);
18
18
  }
19
19
  };
20
- const shouldRender = !!(((_b = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _b === void 0 ? void 0 : _b.optionalFields)
21
- && ((_c = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _c === void 0 ? void 0 : _c.optionalFields));
22
- return (shouldRender && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { string: `${appName} reads the following optional fields` }), (0, jsx_runtime_1.jsx)(react_1.Stack, { marginBottom: 10, maxHeight: 300, overflowY: "scroll", border: "2px solid #EFEFEF", borderRadius: 8, gap: 0, children: (_e = (_d = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _d === void 0 ? void 0 : _d.optionalFields) === null || _e === void 0 ? void 0 : _e.map((field) => {
23
- if (!(0, utils_1.isIntegrationFieldMapping)(field)) {
24
- return ((0, jsx_runtime_1.jsx)(react_1.Box, { paddingX: 4, paddingY: 2, borderBottom: "1px", borderColor: "gray.100", children: (0, jsx_runtime_1.jsx)(react_1.Checkbox, { name: field.fieldName, id: field.fieldName, isChecked: !!(selectedOptionalFields === null || selectedOptionalFields === void 0 ? void 0 : selectedOptionalFields[field === null || field === void 0 ? void 0 : field.fieldName]), onChange: onCheckboxChange, children: field.displayName }) }, field.fieldName));
25
- }
26
- return null; // fallback for customed mapped fields
27
- }) })] })));
20
+ const readOptionalFields = (_b = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _b === void 0 ? void 0 : _b.optionalFields;
21
+ const onSelectAllCheckboxChange = (e) => {
22
+ const { checked } = e.target;
23
+ if (selectedObjectName && readOptionalFields) {
24
+ readOptionalFields.forEach((field) => {
25
+ if (!(0, utils_1.isIntegrationFieldMapping)(field)) {
26
+ (0, setOptionalField_1.setOptionalField)(selectedObjectName, setConfigureState, field.fieldName, checked);
27
+ }
28
+ });
29
+ }
30
+ };
31
+ const shouldRender = !!(readOptionalFields && readOptionalFields.length > 0);
32
+ const isAllChecked = Object.keys(selectedOptionalFields || {}).length === (readOptionalFields === null || readOptionalFields === void 0 ? void 0 : readOptionalFields.length);
33
+ const isIndeterminate = !isAllChecked && Object.keys(selectedOptionalFields || {}).length > 0;
34
+ return (shouldRender && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { string: `${appName} reads the following optional fields` }), (0, jsx_runtime_1.jsxs)(react_1.Stack, { marginBottom: 10, maxHeight: 300, overflowY: "scroll", border: "2px solid #EFEFEF", borderRadius: 8, gap: 0, children: [((readOptionalFields === null || readOptionalFields === void 0 ? void 0 : readOptionalFields.length) || 0) >= 2 && ((0, jsx_runtime_1.jsx)(react_1.Box, { backgroundColor: "gray.50", paddingX: 4, paddingY: 2, children: (0, jsx_runtime_1.jsx)(react_1.Checkbox, { name: "selectAll", id: "selectAll", onChange: onSelectAllCheckboxChange, isIndeterminate: isIndeterminate, isChecked: isAllChecked, children: "Select all" }) })), readOptionalFields.map((field) => {
35
+ if (!(0, utils_1.isIntegrationFieldMapping)(field)) {
36
+ return ((0, jsx_runtime_1.jsx)(react_1.Box, { paddingX: 4, paddingY: 2, borderBottom: "1px", borderColor: "gray.100", children: (0, jsx_runtime_1.jsx)(react_1.Checkbox, { name: field.fieldName, id: field.fieldName, isChecked: !!(selectedOptionalFields === null || selectedOptionalFields === void 0 ? void 0 : selectedOptionalFields[field === null || field === void 0 ? void 0 : field.fieldName]), onChange: onCheckboxChange, children: field.displayName }) }, field.fieldName));
37
+ }
38
+ return null; // fallback for customed mapped fields
39
+ })] })] })));
28
40
  }
29
41
  exports.OptionalFields = OptionalFields;
@@ -11,7 +11,7 @@ function RequiredFields() {
11
11
  var _a, _b, _c;
12
12
  const { configureState, selectedObjectName } = (0, useSelectedConfigureState_1.useSelectedConfigureState)();
13
13
  const { appName } = (0, ProjectContextProvider_1.useProject)();
14
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { string: `${appName} reads the following ${selectedObjectName} fields` }), (0, jsx_runtime_1.jsx)(react_1.Box, { marginBottom: "20px", children: ((_b = (_a = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _a === void 0 ? void 0 : _a.requiredFields) === null || _b === void 0 ? void 0 : _b.length)
14
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { string: `${appName} reads the following ${selectedObjectName} fields` }), (0, jsx_runtime_1.jsx)(react_1.Box, { marginBottom: "20px", display: "flex", gap: 1, children: ((_b = (_a = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _a === void 0 ? void 0 : _a.requiredFields) === null || _b === void 0 ? void 0 : _b.length)
15
15
  ? ((_c = configureState.read) === null || _c === void 0 ? void 0 : _c.requiredFields.map((field) => {
16
16
  if (!(0, utils_1.isIntegrationFieldMapping)(field)) {
17
17
  return (0, jsx_runtime_1.jsx)(react_1.Tag, { children: field.displayName }, field.fieldName);
@@ -22,7 +22,7 @@ function OauthFlow({ provider, consumerRef, consumerName, groupRef, groupName, }
22
22
  });
23
23
  }
24
24
  }, [apiKey, provider]);
25
- const workspaceRequired = (_b = (_a = providerInfo === null || providerInfo === void 0 ? void 0 : providerInfo.oauthOpts) === null || _a === void 0 ? void 0 : _a.explicitWorkspaceRequired) !== null && _b !== void 0 ? _b : false;
25
+ const workspaceRequired = (_b = (_a = providerInfo === null || providerInfo === void 0 ? void 0 : providerInfo.oauth2Opts) === null || _a === void 0 ? void 0 : _a.explicitWorkspaceRequired) !== null && _b !== void 0 ? _b : false;
26
26
  // required workspace
27
27
  if (workspaceRequired) {
28
28
  return ((0, jsx_runtime_1.jsx)(WorkspaceOauthFlow_1.WorkspaceOauthFlow, { provider: provider, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
@@ -1,7 +1,4 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.WorkspaceOauthFlow = void 0;
7
4
  const jsx_runtime_1 = require("react/jsx-runtime");
@@ -10,7 +7,7 @@ const ApiKeyContextProvider_1 = require("../../../context/ApiKeyContextProvider"
10
7
  const ProjectContextProvider_1 = require("../../../context/ProjectContextProvider");
11
8
  const utils_1 = require("../../../utils");
12
9
  const fetchOAuthPopupURL_1 = require("../fetchOAuthPopupURL");
13
- const OAuthPopup_1 = __importDefault(require("../OAuthPopup"));
10
+ const OAuthWindow_1 = require("../OAuthWindow/OAuthWindow");
14
11
  const SalesforceSubdomainEntry_1 = require("../Salesforce/SalesforceSubdomainEntry");
15
12
  const WorkspaceEntry_1 = require("./WorkspaceEntry");
16
13
  const PROVIDER_SALESFORCE = 'salesforce';
@@ -51,6 +48,6 @@ function WorkspaceOauthFlow({ provider, consumerRef, consumerName, groupRef, gro
51
48
  ? ((0, jsx_runtime_1.jsx)(SalesforceSubdomainEntry_1.SalesforceSubdomainEntry, { handleSubmit: handleSubmit, setWorkspace: setWorkspace, error: error, isButtonDisabled: workspace.length === 0 })) : (
52
49
  // general workspace entry component
53
50
  (0, jsx_runtime_1.jsx)(WorkspaceEntry_1.WorkspaceEntry, { provider: provider, handleSubmit: handleSubmit, setWorkspace: setWorkspace, error: error, isButtonDisabled: workspace.length === 0 }));
54
- return ((0, jsx_runtime_1.jsx)(OAuthPopup_1.default, { title: `Connect to ${(0, utils_1.capitalize)(provider)}`, url: oAuthCallbackURL, onClose: onClose, children: workspaceEntryComponent }));
51
+ return ((0, jsx_runtime_1.jsx)(OAuthWindow_1.OAuthWindow, { windowTitle: `Connect to ${(0, utils_1.capitalize)(provider)}`, oauthUrl: oAuthCallbackURL, onClose: onClose, children: workspaceEntryComponent }));
55
52
  }
56
53
  exports.WorkspaceOauthFlow = WorkspaceOauthFlow;
@@ -9,7 +9,7 @@ const fetchOAuthPopupURL = async (projectId, consumerRef, groupRef, apiKey, prov
9
9
  });
10
10
  const app = providerApps.find((a) => a.provider === provider);
11
11
  if (!app) {
12
- throw new Error(`You must first set up a ${(0, utils_1.capitalize)(provider)} Connected App using the Ampersand Console.`);
12
+ throw new Error(`You must first set up a ${(0, utils_1.capitalize)(provider)} Provider App using the Ampersand Console.`);
13
13
  }
14
14
  const request = {
15
15
  connectOAuthParams: {
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "1.5.1";
1
+ export declare const LIB_VERSION = "1.5.3";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
- exports.LIB_VERSION = '1.5.1';
4
+ exports.LIB_VERSION = '1.5.3';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",
@@ -1,56 +0,0 @@
1
- /**
2
- * Ampersand public API
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 1.0.0
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
- import type { Project } from './Project';
13
- /**
14
- *
15
- * @export
16
- * @interface ProjectMembership
17
- */
18
- export interface ProjectMembership {
19
- /**
20
- *
21
- * @type {Project}
22
- * @memberof ProjectMembership
23
- */
24
- project: Project;
25
- /**
26
- * The builder ID.
27
- * @type {string}
28
- * @memberof ProjectMembership
29
- */
30
- builderId: string;
31
- /**
32
- * The builder's role in the project.
33
- * @type {string}
34
- * @memberof ProjectMembership
35
- */
36
- role: string;
37
- /**
38
- * The time the membership was created.
39
- * @type {Date}
40
- * @memberof ProjectMembership
41
- */
42
- createTime: Date;
43
- /**
44
- * The time the membership was updated.
45
- * @type {Date}
46
- * @memberof ProjectMembership
47
- */
48
- updateTime?: Date;
49
- }
50
- /**
51
- * Check if a given object implements the ProjectMembership interface.
52
- */
53
- export declare function instanceOfProjectMembership(value: object): boolean;
54
- export declare function ProjectMembershipFromJSON(json: any): ProjectMembership;
55
- export declare function ProjectMembershipFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProjectMembership;
56
- export declare function ProjectMembershipToJSON(value?: ProjectMembership | null): any;
@@ -1,63 +0,0 @@
1
- "use strict";
2
- /* tslint:disable */
3
- /* eslint-disable */
4
- /**
5
- * Ampersand public API
6
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
- *
8
- * The version of the OpenAPI document: 1.0.0
9
- *
10
- *
11
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
- * https://openapi-generator.tech
13
- * Do not edit the class manually.
14
- */
15
- Object.defineProperty(exports, "__esModule", { value: true });
16
- exports.ProjectMembershipToJSON = exports.ProjectMembershipFromJSONTyped = exports.ProjectMembershipFromJSON = exports.instanceOfProjectMembership = void 0;
17
- const runtime_1 = require("../runtime");
18
- const Project_1 = require("./Project");
19
- /**
20
- * Check if a given object implements the ProjectMembership interface.
21
- */
22
- function instanceOfProjectMembership(value) {
23
- let isInstance = true;
24
- isInstance = isInstance && "project" in value;
25
- isInstance = isInstance && "builderId" in value;
26
- isInstance = isInstance && "role" in value;
27
- isInstance = isInstance && "createTime" in value;
28
- return isInstance;
29
- }
30
- exports.instanceOfProjectMembership = instanceOfProjectMembership;
31
- function ProjectMembershipFromJSON(json) {
32
- return ProjectMembershipFromJSONTyped(json, false);
33
- }
34
- exports.ProjectMembershipFromJSON = ProjectMembershipFromJSON;
35
- function ProjectMembershipFromJSONTyped(json, ignoreDiscriminator) {
36
- if ((json === undefined) || (json === null)) {
37
- return json;
38
- }
39
- return {
40
- 'project': (0, Project_1.ProjectFromJSON)(json['project']),
41
- 'builderId': json['builderId'],
42
- 'role': json['role'],
43
- 'createTime': (new Date(json['createTime'])),
44
- 'updateTime': !(0, runtime_1.exists)(json, 'updateTime') ? undefined : (new Date(json['updateTime'])),
45
- };
46
- }
47
- exports.ProjectMembershipFromJSONTyped = ProjectMembershipFromJSONTyped;
48
- function ProjectMembershipToJSON(value) {
49
- if (value === undefined) {
50
- return undefined;
51
- }
52
- if (value === null) {
53
- return null;
54
- }
55
- return {
56
- 'project': (0, Project_1.ProjectToJSON)(value.project),
57
- 'builderId': value.builderId,
58
- 'role': value.role,
59
- 'createTime': (value.createTime.toISOString()),
60
- 'updateTime': value.updateTime === undefined ? undefined : (value.updateTime.toISOString()),
61
- };
62
- }
63
- exports.ProjectMembershipToJSON = ProjectMembershipToJSON;
@@ -1,20 +0,0 @@
1
- /**
2
- * OAuthPopup.tsx
3
- * @deprecated - this page will be deleted in the future
4
- * Takes a URL and creates a popup showing that page.
5
- */
6
- import React from 'react';
7
- type PopupProps = {
8
- url: string | null;
9
- title: string;
10
- onClose: (err: string | null) => void;
11
- children: React.ReactNode;
12
- };
13
- /**
14
- * v1 popup to manage oauth flow
15
- * @deprecated
16
- * @param param0
17
- * @returns
18
- */
19
- declare function OAuthPopup({ title, url, children, onClose, }: PopupProps): import("react/jsx-runtime").JSX.Element;
20
- export default OAuthPopup;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const jsx_runtime_1 = require("react/jsx-runtime");
4
- /**
5
- * OAuthPopup.tsx
6
- * @deprecated - this page will be deleted in the future
7
- * Takes a URL and creates a popup showing that page.
8
- */
9
- const react_1 = require("react");
10
- const ApiKeyContextProvider_1 = require("../../context/ApiKeyContextProvider");
11
- const ConnectionsContextProvider_1 = require("../../context/ConnectionsContextProvider");
12
- const ProjectContextProvider_1 = require("../../context/ProjectContextProvider");
13
- const api_1 = require("../../services/api");
14
- const DEFAULT_WIDTH = 600; // px
15
- const DEFAULT_HEIGHT = 600; // px
16
- const DEFAULT_INTERVAL = 500; // ms
17
- const SUCCESS_EVENT = 'AUTHORIZATION_SUCCEEDED';
18
- const FAILURE_EVENT = 'AUTHORIZATION_FAILED';
19
- const createPopup = ({ url, title, }) => {
20
- const left = window.screenX + (window.outerWidth - DEFAULT_WIDTH) / 2;
21
- const top = window.screenY + (window.outerHeight - DEFAULT_HEIGHT) / 2.5; // a lil shorter
22
- const popup = window.open(url, title, `width=${DEFAULT_WIDTH},height=${DEFAULT_HEIGHT},left=${left},top=${top}`);
23
- return popup;
24
- };
25
- /**
26
- * v1 popup to manage oauth flow
27
- * @deprecated
28
- * @param param0
29
- * @returns
30
- */
31
- function OAuthPopup({ title = '', url, children, onClose, }) {
32
- const { projectId } = (0, ProjectContextProvider_1.useProject)();
33
- const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
34
- const [externalWindow, setExternalWindow] = (0, react_1.useState)();
35
- const intervalRef = (0, react_1.useRef)();
36
- const clearTimer = () => window.clearInterval(intervalRef.current);
37
- const { setSelectedConnection } = (0, ConnectionsContextProvider_1.useConnections)();
38
- (0, react_1.useEffect)(() => {
39
- if (url)
40
- setExternalWindow(createPopup({ url, title }));
41
- }, [url, title]);
42
- const refreshConnections = (0, react_1.useCallback)(async (connectionId) => {
43
- const connection = await (0, api_1.api)().connectionApi.getConnection({ projectId, connectionId }, {
44
- headers: { 'X-Api-Key': apiKey !== null && apiKey !== void 0 ? apiKey : '' },
45
- });
46
- setSelectedConnection(connection);
47
- }, [projectId, apiKey, setSelectedConnection]);
48
- (0, react_1.useEffect)(() => {
49
- window.addEventListener('message', (event) => {
50
- var _a, _b, _c, _d, _e;
51
- if (event.origin === api_1.AMP_SERVER) {
52
- // this event come from our own server
53
- if (((_a = event.data) === null || _a === void 0 ? void 0 : _a.eventType) === SUCCESS_EVENT) {
54
- clearTimer();
55
- const connectionId = (_b = event.data.data) === null || _b === void 0 ? void 0 : _b.connection;
56
- if (!connectionId) {
57
- console.error('Ampersand server returned a successful authorization event, but did not return a connection ID.');
58
- onClose('There is an unexpected server issue.');
59
- }
60
- else {
61
- refreshConnections(connectionId);
62
- onClose(null);
63
- }
64
- }
65
- else if (((_c = event.data) === null || _c === void 0 ? void 0 : _c.eventType) === FAILURE_EVENT) {
66
- clearTimer();
67
- onClose((_e = (_d = event.data.data) === null || _d === void 0 ? void 0 : _d.message) !== null && _e !== void 0 ? _e : 'There was an error logging you in. Please try again.');
68
- }
69
- }
70
- });
71
- }, [externalWindow, onClose, refreshConnections]);
72
- (0, react_1.useEffect)(() => {
73
- if (externalWindow && !intervalRef.current) {
74
- intervalRef.current = window.setInterval(() => {
75
- // Check if window was closed prematurely.
76
- if (!externalWindow || externalWindow.closed) {
77
- clearTimer();
78
- onClose('The popup was closed too quickly. Please try again.');
79
- }
80
- }, DEFAULT_INTERVAL);
81
- }
82
- }, [externalWindow, onClose]);
83
- return ((0, jsx_runtime_1.jsx)("div", { children: children }));
84
- }
85
- exports.default = OAuthPopup;