@amp-labs/react 1.4.4 → 1.5.1
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.
- package/build/generated-sources/api/src/apis/index.d.ts +0 -2
- package/build/generated-sources/api/src/apis/index.js +0 -2
- package/build/generated-sources/api/src/models/BaseReadConfig.d.ts +4 -4
- package/build/generated-sources/api/src/models/BaseReadConfig.js +3 -3
- package/build/generated-sources/api/src/models/{BaseReadConfigStandardObject.d.ts → BaseReadConfigObject.d.ts} +12 -12
- package/build/generated-sources/api/src/models/{BaseReadConfigStandardObject.js → BaseReadConfigObject.js} +11 -11
- package/build/generated-sources/api/src/models/HydratedIntegrationRead.d.ts +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationRead.js +2 -2
- package/build/generated-sources/api/src/models/IntegrationRead.d.ts +1 -1
- package/build/generated-sources/api/src/models/IntegrationRead.js +2 -2
- package/build/generated-sources/api/src/models/ProviderInfo.d.ts +12 -0
- package/build/generated-sources/api/src/models/ProviderInfo.js +5 -0
- package/build/generated-sources/api/src/models/index.d.ts +1 -2
- package/build/generated-sources/api/src/models/index.js +1 -2
- package/build/src/components/Configure/actions/mutateAndSetState/updateInstallationAndSetState.js +1 -1
- package/build/src/components/Configure/actions/read/onSaveReadCreateInstallation.js +3 -3
- package/build/src/components/Configure/actions/read/onSaveReadUpdateInstallation.js +1 -1
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +2 -2
- package/build/src/components/Configure/content/UpdateInstallation.js +1 -1
- package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js +2 -1
- package/build/src/components/Configure/state/utils.js +3 -3
- package/build/src/components/Configure/utils.d.ts +1 -1
- package/build/src/components/Configure/utils.js +7 -7
- package/build/src/components/Oauth/NoWorkspaceEntry/NoWorkspaceOauthFlow.js +8 -11
- package/build/src/components/Oauth/OAuthPopup.d.ts +7 -1
- package/build/src/components/Oauth/OAuthPopup.js +7 -1
- package/build/src/components/Oauth/OAuthWindow/OAuthWindow.d.ts +14 -0
- package/build/src/components/Oauth/OAuthWindow/OAuthWindow.js +65 -0
- package/build/src/components/Oauth/OAuthWindow/windowHelpers.d.ts +24 -0
- package/build/src/components/Oauth/OAuthWindow/windowHelpers.js +77 -0
- package/build/src/components/Oauth/WorkspaceEntry/WorkspaceOauthFlow.js +2 -2
- package/build/src/components/Oauth/fetchOAuthPopupURL.d.ts +1 -0
- package/build/src/components/Oauth/{fetchOAuthCallbackURL.js → fetchOAuthPopupURL.js} +6 -5
- package/build/src/services/ApiService.d.ts +1 -3
- package/build/src/services/ApiService.js +0 -2
- package/build/src/services/api.d.ts +2 -2
- package/build/src/services/version.d.ts +1 -1
- package/build/src/services/version.js +1 -1
- package/package.json +4 -4
- package/build/generated-sources/api/src/apis/AllowedDomainApi.d.ts +0 -79
- package/build/generated-sources/api/src/apis/AllowedDomainApi.js +0 -101
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.d.ts +0 -126
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.js +0 -154
- package/build/generated-sources/api/src/models/UpsertProjectMembershipRequest.d.ts +0 -37
- package/build/generated-sources/api/src/models/UpsertProjectMembershipRequest.js +0 -53
- package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +0 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OAuthWindow = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const ApiKeyContextProvider_1 = require("../../../context/ApiKeyContextProvider");
|
|
7
|
+
const ConnectionsContextProvider_1 = require("../../../context/ConnectionsContextProvider");
|
|
8
|
+
const ProjectContextProvider_1 = require("../../../context/ProjectContextProvider");
|
|
9
|
+
const windowHelpers_1 = require("./windowHelpers");
|
|
10
|
+
/**
|
|
11
|
+
* v2 OAuth window to manage OAuth flow
|
|
12
|
+
* @param param0
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function OAuthWindow({ children, oauthUrl, windowTitle = 'Connect to Provider', onClose, }) {
|
|
16
|
+
const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
|
|
17
|
+
const { projectId } = (0, ProjectContextProvider_1.useProject)();
|
|
18
|
+
const [connectionId, setConnectionId] = (0, react_1.useState)(null);
|
|
19
|
+
const [oauthWindow, setOauthWindow] = (0, react_1.useState)(null);
|
|
20
|
+
const { setSelectedConnection } = (0, ConnectionsContextProvider_1.useConnections)();
|
|
21
|
+
const receiveMessage = (0, windowHelpers_1.getReceiveMessageEventHandler)(setConnectionId);
|
|
22
|
+
const openOAuthWindow = (0, windowHelpers_1.getOpenWindowHandler)(windowTitle, setOauthWindow, receiveMessage, oauthUrl);
|
|
23
|
+
const refreshConnections = (0, windowHelpers_1.getRefreshConnectionHandler)(projectId, apiKey, setSelectedConnection);
|
|
24
|
+
// open the OAuth window on mount and prop change
|
|
25
|
+
(0, react_1.useEffect)(() => {
|
|
26
|
+
if (oauthUrl && !oauthWindow) {
|
|
27
|
+
openOAuthWindow(); // creates new window and adds event listener
|
|
28
|
+
}
|
|
29
|
+
}, [oauthUrl, oauthWindow, openOAuthWindow, receiveMessage, windowTitle]);
|
|
30
|
+
// refresh connections on connectionId change
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
if (connectionId) {
|
|
33
|
+
refreshConnections(connectionId)
|
|
34
|
+
.then(() => {
|
|
35
|
+
oauthWindow === null || oauthWindow === void 0 ? void 0 : oauthWindow.close(); // only close the window if connection is successful
|
|
36
|
+
// console.debug('Connection successful');
|
|
37
|
+
}).catch((err) => {
|
|
38
|
+
var _a;
|
|
39
|
+
console.error('Error refreshing connection: ', err);
|
|
40
|
+
onClose((_a = err.message) !== null && _a !== void 0 ? _a : 'Unexpected error: not able to refresh connection');
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}, [connectionId, apiKey, setSelectedConnection, refreshConnections, oauthWindow, onClose]);
|
|
44
|
+
// check if the window is closed
|
|
45
|
+
const interval = oauthWindow && setInterval(() => {
|
|
46
|
+
if (((oauthWindow === null || oauthWindow === void 0 ? void 0 : oauthWindow.closed) || !oauthWindow) && !!interval) {
|
|
47
|
+
clearInterval(interval);
|
|
48
|
+
// cleanup event listener and window reference
|
|
49
|
+
window.removeEventListener('message', receiveMessage);
|
|
50
|
+
setOauthWindow(null);
|
|
51
|
+
if (!connectionId) {
|
|
52
|
+
// if connectionId is not set, then set OAuth failed error
|
|
53
|
+
console.error('OAuth failed. Please try again.');
|
|
54
|
+
if (onClose)
|
|
55
|
+
onClose('OAuth failed. Please try again.');
|
|
56
|
+
}
|
|
57
|
+
else if (connectionId && onClose) {
|
|
58
|
+
// if connectionId is set, then set OAuth success -- no error in onClose
|
|
59
|
+
onClose(null);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}, 500);
|
|
63
|
+
return (0, jsx_runtime_1.jsx)("div", { children: children });
|
|
64
|
+
}
|
|
65
|
+
exports.OAuthWindow = OAuthWindow;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Connection } from '../../../services/api';
|
|
3
|
+
/**
|
|
4
|
+
* returns a function to refresh the connection
|
|
5
|
+
* @param projectId
|
|
6
|
+
* @param apiKey
|
|
7
|
+
* @param setSelectedConnection
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function getRefreshConnectionHandler(projectId: string, apiKey: string, setSelectedConnection: React.Dispatch<React.SetStateAction<Connection | null>>): (_connectionId: string) => Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* opens a new window with the OAuth URL
|
|
13
|
+
* side effect: adds a message event listener to the window
|
|
14
|
+
* @param oauthUrl
|
|
15
|
+
* @param windowTitle
|
|
16
|
+
* @param setOauthWindow
|
|
17
|
+
* @param receiveMessage
|
|
18
|
+
* @returns a function to open the oauth window
|
|
19
|
+
*/
|
|
20
|
+
export declare function getOpenWindowHandler(windowTitle: string, setOauthWindow: React.Dispatch<React.SetStateAction<Window | null>>, receiveMessage: (event: MessageEvent) => void, oauthUrl: string | null): () => void;
|
|
21
|
+
/**
|
|
22
|
+
* returns a function to handle the message event
|
|
23
|
+
*/
|
|
24
|
+
export declare function getReceiveMessageEventHandler(setConnectionId: React.Dispatch<React.SetStateAction<null>>): (event: MessageEvent) => void;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getReceiveMessageEventHandler = exports.getOpenWindowHandler = exports.getRefreshConnectionHandler = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
const api_1 = require("../../../services/api");
|
|
6
|
+
const DEFAULT_WIDTH = 600; // px
|
|
7
|
+
const DEFAULT_HEIGHT = 600; // px
|
|
8
|
+
const SUCCESS_EVENT = 'AUTHORIZATION_SUCCEEDED';
|
|
9
|
+
const FAILURE_EVENT = 'AUTHORIZATION_FAILED';
|
|
10
|
+
/**
|
|
11
|
+
* returns a function to refresh the connection
|
|
12
|
+
* @param projectId
|
|
13
|
+
* @param apiKey
|
|
14
|
+
* @param setSelectedConnection
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
function getRefreshConnectionHandler(projectId, apiKey, setSelectedConnection) {
|
|
18
|
+
return (0, react_1.useCallback)(async (_connectionId) => {
|
|
19
|
+
const connection = await (0, api_1.api)().connectionApi.getConnection({ projectId, connectionId: _connectionId }, {
|
|
20
|
+
headers: { 'X-Api-Key': apiKey !== null && apiKey !== void 0 ? apiKey : '' },
|
|
21
|
+
});
|
|
22
|
+
setSelectedConnection(connection);
|
|
23
|
+
}, [projectId, apiKey, setSelectedConnection]);
|
|
24
|
+
}
|
|
25
|
+
exports.getRefreshConnectionHandler = getRefreshConnectionHandler;
|
|
26
|
+
/**
|
|
27
|
+
* opens a new window with the OAuth URL
|
|
28
|
+
* side effect: adds a message event listener to the window
|
|
29
|
+
* @param oauthUrl
|
|
30
|
+
* @param windowTitle
|
|
31
|
+
* @param setOauthWindow
|
|
32
|
+
* @param receiveMessage
|
|
33
|
+
* @returns a function to open the oauth window
|
|
34
|
+
*/
|
|
35
|
+
function getOpenWindowHandler(windowTitle, setOauthWindow, receiveMessage, oauthUrl) {
|
|
36
|
+
return (0, react_1.useCallback)(() => {
|
|
37
|
+
if (!oauthUrl)
|
|
38
|
+
return;
|
|
39
|
+
const left = window.screenX + (window.outerWidth - DEFAULT_WIDTH) / 2;
|
|
40
|
+
const top = window.screenY + (window.outerHeight - DEFAULT_HEIGHT) / 2.5;
|
|
41
|
+
const windowDimensions = `width=${DEFAULT_WIDTH},height=${DEFAULT_HEIGHT},left=${left},top=${top}`;
|
|
42
|
+
// creates a new window
|
|
43
|
+
const newWindow = window.open(oauthUrl, windowTitle, windowDimensions);
|
|
44
|
+
setOauthWindow(newWindow);
|
|
45
|
+
window.addEventListener('message', receiveMessage, false);
|
|
46
|
+
}, [oauthUrl, windowTitle, setOauthWindow, receiveMessage]);
|
|
47
|
+
}
|
|
48
|
+
exports.getOpenWindowHandler = getOpenWindowHandler;
|
|
49
|
+
/**
|
|
50
|
+
* returns a function to handle the message event
|
|
51
|
+
*/
|
|
52
|
+
function getReceiveMessageEventHandler(setConnectionId) {
|
|
53
|
+
return (0, react_1.useCallback)((event) => {
|
|
54
|
+
var _a;
|
|
55
|
+
// Ignore messages from unexpected origins
|
|
56
|
+
if (event.origin !== api_1.AMP_SERVER) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
// success case
|
|
60
|
+
if (event.data.eventType === SUCCESS_EVENT) {
|
|
61
|
+
const connection = (_a = event.data.data) === null || _a === void 0 ? void 0 : _a.connection; // connection id
|
|
62
|
+
if (connection) {
|
|
63
|
+
setConnectionId(connection);
|
|
64
|
+
// do not close the window if connection is successful yet
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
console.error('Connection ID not found in event data: ', { event });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// failure case
|
|
71
|
+
if (event.data.eventType === FAILURE_EVENT) {
|
|
72
|
+
console.error('OAuth failed: ', { event });
|
|
73
|
+
// do not close the window if error occurs
|
|
74
|
+
}
|
|
75
|
+
}, [setConnectionId]);
|
|
76
|
+
}
|
|
77
|
+
exports.getReceiveMessageEventHandler = getReceiveMessageEventHandler;
|
|
@@ -9,7 +9,7 @@ const react_1 = require("react");
|
|
|
9
9
|
const ApiKeyContextProvider_1 = require("../../../context/ApiKeyContextProvider");
|
|
10
10
|
const ProjectContextProvider_1 = require("../../../context/ProjectContextProvider");
|
|
11
11
|
const utils_1 = require("../../../utils");
|
|
12
|
-
const
|
|
12
|
+
const fetchOAuthPopupURL_1 = require("../fetchOAuthPopupURL");
|
|
13
13
|
const OAuthPopup_1 = __importDefault(require("../OAuthPopup"));
|
|
14
14
|
const SalesforceSubdomainEntry_1 = require("../Salesforce/SalesforceSubdomainEntry");
|
|
15
15
|
const WorkspaceEntry_1 = require("./WorkspaceEntry");
|
|
@@ -34,7 +34,7 @@ function WorkspaceOauthFlow({ provider, consumerRef, consumerName, groupRef, gro
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
try {
|
|
37
|
-
const url = await (0,
|
|
37
|
+
const url = await (0, fetchOAuthPopupURL_1.fetchOAuthPopupURL)(projectId, consumerRef, groupRef, apiKey, provider, workspace, consumerName, groupName);
|
|
38
38
|
setOAuthCallbackURL(url);
|
|
39
39
|
}
|
|
40
40
|
catch (err) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const fetchOAuthPopupURL: (projectId: string, consumerRef: string, groupRef: string, apiKey: string, provider: string, workspace?: string, consumerName?: string, groupName?: string) => Promise<string>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.fetchOAuthPopupURL = void 0;
|
|
4
4
|
const api_1 = require("../../services/api");
|
|
5
5
|
const utils_1 = require("../../utils");
|
|
6
|
-
const
|
|
6
|
+
const fetchOAuthPopupURL = async (projectId, consumerRef, groupRef, apiKey, provider, workspace, consumerName, groupName) => {
|
|
7
7
|
const providerApps = await (0, api_1.api)().providerAppApi.listProviderApps({ projectId }, {
|
|
8
8
|
headers: { 'X-Api-Key': apiKey !== null && apiKey !== void 0 ? apiKey : '' },
|
|
9
9
|
});
|
|
@@ -11,7 +11,7 @@ const fetchOAuthCallbackURL = async (projectId, consumerRef, groupRef, apiKey, p
|
|
|
11
11
|
if (!app) {
|
|
12
12
|
throw new Error(`You must first set up a ${(0, utils_1.capitalize)(provider)} Connected App using the Ampersand Console.`);
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const request = {
|
|
15
15
|
connectOAuthParams: {
|
|
16
16
|
providerWorkspaceRef: workspace,
|
|
17
17
|
projectId,
|
|
@@ -22,7 +22,8 @@ const fetchOAuthCallbackURL = async (projectId, consumerRef, groupRef, apiKey, p
|
|
|
22
22
|
providerAppId: app.id,
|
|
23
23
|
provider,
|
|
24
24
|
},
|
|
25
|
-
}
|
|
25
|
+
};
|
|
26
|
+
const url = await (0, api_1.api)().oAuthApi.oauthConnect(request);
|
|
26
27
|
return url;
|
|
27
28
|
};
|
|
28
|
-
exports.
|
|
29
|
+
exports.fetchOAuthPopupURL = fetchOAuthPopupURL;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Configuration, ConnectionApi, ConsumerApi, DestinationApi, GroupApi, InstallationApi, IntegrationApi, OAuthApi, OperationApi, ProjectApi, ProviderApi, ProviderAppApi, RevisionApi, UploadURLApi } from '../../generated-sources/api/src';
|
|
2
2
|
/**
|
|
3
3
|
* ApiService is a wrapper around the generated API client, which exposes
|
|
4
4
|
* all generated api services as properties.
|
|
@@ -8,7 +8,6 @@ import { AllowedDomainApi, Configuration, ConnectionApi, ConsumerApi, Destinatio
|
|
|
8
8
|
* Note: some services are not used in this repo.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ApiService {
|
|
11
|
-
allowedDomainApi: AllowedDomainApi;
|
|
12
11
|
connectionApi: ConnectionApi;
|
|
13
12
|
consumerApi: ConsumerApi;
|
|
14
13
|
destinationApi: DestinationApi;
|
|
@@ -18,7 +17,6 @@ export declare class ApiService {
|
|
|
18
17
|
oAuthApi: OAuthApi;
|
|
19
18
|
operationApi: OperationApi;
|
|
20
19
|
projectApi: ProjectApi;
|
|
21
|
-
projectMembershipApi: ProjectMembershipApi;
|
|
22
20
|
providerApi: ProviderApi;
|
|
23
21
|
providerAppApi: ProviderAppApi;
|
|
24
22
|
revisionApi: RevisionApi;
|
|
@@ -14,7 +14,6 @@ const src_1 = require("../../generated-sources/api/src");
|
|
|
14
14
|
*/
|
|
15
15
|
class ApiService {
|
|
16
16
|
constructor(config) {
|
|
17
|
-
this.allowedDomainApi = new src_1.AllowedDomainApi(config);
|
|
18
17
|
this.connectionApi = new src_1.ConnectionApi(config);
|
|
19
18
|
this.consumerApi = new src_1.ConsumerApi(config);
|
|
20
19
|
this.destinationApi = new src_1.DestinationApi(config);
|
|
@@ -24,7 +23,6 @@ class ApiService {
|
|
|
24
23
|
this.oAuthApi = new src_1.OAuthApi(config);
|
|
25
24
|
this.operationApi = new src_1.OperationApi(config);
|
|
26
25
|
this.projectApi = new src_1.ProjectApi(config);
|
|
27
|
-
this.projectMembershipApi = new src_1.ProjectMembershipApi(config);
|
|
28
26
|
this.providerApi = new src_1.ProviderApi(config);
|
|
29
27
|
this.providerAppApi = new src_1.ProviderAppApi(config);
|
|
30
28
|
this.revisionApi = new src_1.RevisionApi(config);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationField, HydratedIntegrationFieldExistent, HydratedIntegrationObject, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedRevision, Installation, Integration, IntegrationFieldMapping, Project, ProviderApp, ProviderInfo, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig } from '../../generated-sources/api/src';
|
|
1
|
+
import { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationField, HydratedIntegrationFieldExistent, HydratedIntegrationObject, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedRevision, Installation, Integration, IntegrationFieldMapping, OauthConnectOperationRequest, Project, ProviderApp, ProviderInfo, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig } from '../../generated-sources/api/src';
|
|
2
2
|
import { ApiService } from './ApiService';
|
|
3
3
|
export declare const AMP_SERVER: string;
|
|
4
4
|
export declare const AMP_API_ROOT: string;
|
|
@@ -7,4 +7,4 @@ export declare const api: () => ApiService;
|
|
|
7
7
|
/**
|
|
8
8
|
* Types exported from generated api
|
|
9
9
|
*/
|
|
10
|
-
export type { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedIntegrationObject, HydratedIntegrationField, HydratedRevision, Installation, Integration, HydratedIntegrationFieldExistent, IntegrationFieldMapping, Project, ProviderApp, ProviderInfo, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig, };
|
|
10
|
+
export type { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedIntegrationObject, HydratedIntegrationField, HydratedRevision, Installation, Integration, HydratedIntegrationFieldExistent, IntegrationFieldMapping, OauthConnectOperationRequest, Project, ProviderApp, ProviderInfo, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const LIB_VERSION = "1.
|
|
1
|
+
export declare const LIB_VERSION = "1.5.1";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amp-labs/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"description": "Ampersand React library.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ampersand Labs",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"@openapitools/openapi-generator-cli": "^2.7.0",
|
|
50
50
|
"@types/lodash.isequal": "^4.5.7",
|
|
51
51
|
"@types/react": "^18.2.33",
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
53
|
-
"@typescript-eslint/parser": "^
|
|
52
|
+
"@typescript-eslint/eslint-plugin": "^7.10.0",
|
|
53
|
+
"@typescript-eslint/parser": "^7.10.0",
|
|
54
54
|
"babel-jest": "^29.7.0",
|
|
55
55
|
"eslint": "^8.52.0",
|
|
56
56
|
"eslint-config-airbnb": "^19.0.4",
|
|
57
|
-
"eslint-config-airbnb-typescript": "^
|
|
57
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
58
58
|
"eslint-plugin-import": "^2.29.0",
|
|
59
59
|
"eslint-plugin-jsx-a11y": "^6.8.0",
|
|
60
60
|
"eslint-plugin-n": "^17.2.0",
|
|
@@ -1,79 +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 * as runtime from '../runtime';
|
|
13
|
-
export interface ListAllowedDomainsForProjectRequest {
|
|
14
|
-
projectId: string;
|
|
15
|
-
}
|
|
16
|
-
export interface ListAllowedProjectsForDomainRequest {
|
|
17
|
-
domain: string;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* AllowedDomainApi - interface
|
|
21
|
-
*
|
|
22
|
-
* @export
|
|
23
|
-
* @interface AllowedDomainApiInterface
|
|
24
|
-
*/
|
|
25
|
-
export interface AllowedDomainApiInterface {
|
|
26
|
-
/**
|
|
27
|
-
* List the email domain that are allow to join a project.
|
|
28
|
-
* @summary List allowed domains for project
|
|
29
|
-
* @param {string} projectId The project ID to search for.
|
|
30
|
-
* @param {*} [options] Override http request option.
|
|
31
|
-
* @throws {RequiredError}
|
|
32
|
-
* @memberof AllowedDomainApiInterface
|
|
33
|
-
*/
|
|
34
|
-
listAllowedDomainsForProjectRaw(requestParameters: ListAllowedDomainsForProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>>;
|
|
35
|
-
/**
|
|
36
|
-
* List the email domain that are allow to join a project.
|
|
37
|
-
* List allowed domains for project
|
|
38
|
-
*/
|
|
39
|
-
listAllowedDomainsForProject(requestParameters: ListAllowedDomainsForProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
|
|
40
|
-
/**
|
|
41
|
-
* List the projects that a user with an email address ending in the given domain would be able to join.
|
|
42
|
-
* @summary List projects allowed for domain
|
|
43
|
-
* @param {string} domain The domain to search for (e.g. \"company.com\")
|
|
44
|
-
* @param {*} [options] Override http request option.
|
|
45
|
-
* @throws {RequiredError}
|
|
46
|
-
* @memberof AllowedDomainApiInterface
|
|
47
|
-
*/
|
|
48
|
-
listAllowedProjectsForDomainRaw(requestParameters: ListAllowedProjectsForDomainRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>>;
|
|
49
|
-
/**
|
|
50
|
-
* List the projects that a user with an email address ending in the given domain would be able to join.
|
|
51
|
-
* List projects allowed for domain
|
|
52
|
-
*/
|
|
53
|
-
listAllowedProjectsForDomain(requestParameters: ListAllowedProjectsForDomainRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
export declare class AllowedDomainApi extends runtime.BaseAPI implements AllowedDomainApiInterface {
|
|
59
|
-
/**
|
|
60
|
-
* List the email domain that are allow to join a project.
|
|
61
|
-
* List allowed domains for project
|
|
62
|
-
*/
|
|
63
|
-
listAllowedDomainsForProjectRaw(requestParameters: ListAllowedDomainsForProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>>;
|
|
64
|
-
/**
|
|
65
|
-
* List the email domain that are allow to join a project.
|
|
66
|
-
* List allowed domains for project
|
|
67
|
-
*/
|
|
68
|
-
listAllowedDomainsForProject(requestParameters: ListAllowedDomainsForProjectRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
|
|
69
|
-
/**
|
|
70
|
-
* List the projects that a user with an email address ending in the given domain would be able to join.
|
|
71
|
-
* List projects allowed for domain
|
|
72
|
-
*/
|
|
73
|
-
listAllowedProjectsForDomainRaw(requestParameters: ListAllowedProjectsForDomainRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<string>>>;
|
|
74
|
-
/**
|
|
75
|
-
* List the projects that a user with an email address ending in the given domain would be able to join.
|
|
76
|
-
* List projects allowed for domain
|
|
77
|
-
*/
|
|
78
|
-
listAllowedProjectsForDomain(requestParameters: ListAllowedProjectsForDomainRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<string>>;
|
|
79
|
-
}
|
|
@@ -1,101 +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
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
-
if (k2 === undefined) k2 = k;
|
|
17
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
-
}
|
|
21
|
-
Object.defineProperty(o, k2, desc);
|
|
22
|
-
}) : (function(o, m, k, k2) {
|
|
23
|
-
if (k2 === undefined) k2 = k;
|
|
24
|
-
o[k2] = m[k];
|
|
25
|
-
}));
|
|
26
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
27
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
28
|
-
}) : function(o, v) {
|
|
29
|
-
o["default"] = v;
|
|
30
|
-
});
|
|
31
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
32
|
-
if (mod && mod.__esModule) return mod;
|
|
33
|
-
var result = {};
|
|
34
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
35
|
-
__setModuleDefault(result, mod);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.AllowedDomainApi = void 0;
|
|
40
|
-
const runtime = __importStar(require("../runtime"));
|
|
41
|
-
/**
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
class AllowedDomainApi extends runtime.BaseAPI {
|
|
45
|
-
/**
|
|
46
|
-
* List the email domain that are allow to join a project.
|
|
47
|
-
* List allowed domains for project
|
|
48
|
-
*/
|
|
49
|
-
async listAllowedDomainsForProjectRaw(requestParameters, initOverrides) {
|
|
50
|
-
if (requestParameters.projectId === null || requestParameters.projectId === undefined) {
|
|
51
|
-
throw new runtime.RequiredError('projectId', 'Required parameter requestParameters.projectId was null or undefined when calling listAllowedDomainsForProject.');
|
|
52
|
-
}
|
|
53
|
-
const queryParameters = {};
|
|
54
|
-
const headerParameters = {};
|
|
55
|
-
const response = await this.request({
|
|
56
|
-
path: `/projects/{projectId}/allowed-domains`.replace(`{${"projectId"}}`, encodeURIComponent(String(requestParameters.projectId))),
|
|
57
|
-
method: 'GET',
|
|
58
|
-
headers: headerParameters,
|
|
59
|
-
query: queryParameters,
|
|
60
|
-
}, initOverrides);
|
|
61
|
-
return new runtime.JSONApiResponse(response);
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* List the email domain that are allow to join a project.
|
|
65
|
-
* List allowed domains for project
|
|
66
|
-
*/
|
|
67
|
-
async listAllowedDomainsForProject(requestParameters, initOverrides) {
|
|
68
|
-
const response = await this.listAllowedDomainsForProjectRaw(requestParameters, initOverrides);
|
|
69
|
-
return await response.value();
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* List the projects that a user with an email address ending in the given domain would be able to join.
|
|
73
|
-
* List projects allowed for domain
|
|
74
|
-
*/
|
|
75
|
-
async listAllowedProjectsForDomainRaw(requestParameters, initOverrides) {
|
|
76
|
-
if (requestParameters.domain === null || requestParameters.domain === undefined) {
|
|
77
|
-
throw new runtime.RequiredError('domain', 'Required parameter requestParameters.domain was null or undefined when calling listAllowedProjectsForDomain.');
|
|
78
|
-
}
|
|
79
|
-
const queryParameters = {};
|
|
80
|
-
if (requestParameters.domain !== undefined) {
|
|
81
|
-
queryParameters['domain'] = requestParameters.domain;
|
|
82
|
-
}
|
|
83
|
-
const headerParameters = {};
|
|
84
|
-
const response = await this.request({
|
|
85
|
-
path: `/projects:list-allowed-for-domain`,
|
|
86
|
-
method: 'GET',
|
|
87
|
-
headers: headerParameters,
|
|
88
|
-
query: queryParameters,
|
|
89
|
-
}, initOverrides);
|
|
90
|
-
return new runtime.JSONApiResponse(response);
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* List the projects that a user with an email address ending in the given domain would be able to join.
|
|
94
|
-
* List projects allowed for domain
|
|
95
|
-
*/
|
|
96
|
-
async listAllowedProjectsForDomain(requestParameters, initOverrides) {
|
|
97
|
-
const response = await this.listAllowedProjectsForDomainRaw(requestParameters, initOverrides);
|
|
98
|
-
return await response.value();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
exports.AllowedDomainApi = AllowedDomainApi;
|
|
@@ -1,126 +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 * as runtime from '../runtime';
|
|
13
|
-
import type { ProjectMembership, UpsertProjectMembershipRequest } from '../models';
|
|
14
|
-
export interface GetProjectMembershipForBuilderRequest {
|
|
15
|
-
projectId: string;
|
|
16
|
-
builderId: string;
|
|
17
|
-
}
|
|
18
|
-
export interface ListBuilderProjectMembershipsRequest {
|
|
19
|
-
builderId: string;
|
|
20
|
-
}
|
|
21
|
-
export interface ListProjectMembershipsRequest {
|
|
22
|
-
projectId: string;
|
|
23
|
-
}
|
|
24
|
-
export interface UpsertProjectMembershipOperationRequest {
|
|
25
|
-
projectId: string;
|
|
26
|
-
membership: UpsertProjectMembershipRequest;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* ProjectMembershipApi - interface
|
|
30
|
-
*
|
|
31
|
-
* @export
|
|
32
|
-
* @interface ProjectMembershipApiInterface
|
|
33
|
-
*/
|
|
34
|
-
export interface ProjectMembershipApiInterface {
|
|
35
|
-
/**
|
|
36
|
-
*
|
|
37
|
-
* @summary Get a project membership for a builder
|
|
38
|
-
* @param {string} projectId
|
|
39
|
-
* @param {string} builderId The builder\'s ID.
|
|
40
|
-
* @param {*} [options] Override http request option.
|
|
41
|
-
* @throws {RequiredError}
|
|
42
|
-
* @memberof ProjectMembershipApiInterface
|
|
43
|
-
*/
|
|
44
|
-
getProjectMembershipForBuilderRaw(requestParameters: GetProjectMembershipForBuilderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProjectMembership>>;
|
|
45
|
-
/**
|
|
46
|
-
* Get a project membership for a builder
|
|
47
|
-
*/
|
|
48
|
-
getProjectMembershipForBuilder(requestParameters: GetProjectMembershipForBuilderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectMembership>;
|
|
49
|
-
/**
|
|
50
|
-
*
|
|
51
|
-
* @summary List project memberships for a builder
|
|
52
|
-
* @param {string} builderId The builder\'s ID.
|
|
53
|
-
* @param {*} [options] Override http request option.
|
|
54
|
-
* @throws {RequiredError}
|
|
55
|
-
* @memberof ProjectMembershipApiInterface
|
|
56
|
-
*/
|
|
57
|
-
listBuilderProjectMembershipsRaw(requestParameters: ListBuilderProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectMembership>>>;
|
|
58
|
-
/**
|
|
59
|
-
* List project memberships for a builder
|
|
60
|
-
*/
|
|
61
|
-
listBuilderProjectMemberships(requestParameters: ListBuilderProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectMembership>>;
|
|
62
|
-
/**
|
|
63
|
-
*
|
|
64
|
-
* @summary List a project\'s memberships
|
|
65
|
-
* @param {string} projectId
|
|
66
|
-
* @param {*} [options] Override http request option.
|
|
67
|
-
* @throws {RequiredError}
|
|
68
|
-
* @memberof ProjectMembershipApiInterface
|
|
69
|
-
*/
|
|
70
|
-
listProjectMembershipsRaw(requestParameters: ListProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectMembership>>>;
|
|
71
|
-
/**
|
|
72
|
-
* List a project\'s memberships
|
|
73
|
-
*/
|
|
74
|
-
listProjectMemberships(requestParameters: ListProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectMembership>>;
|
|
75
|
-
/**
|
|
76
|
-
*
|
|
77
|
-
* @summary Create or update a project membership
|
|
78
|
-
* @param {string} projectId
|
|
79
|
-
* @param {UpsertProjectMembershipRequest} membership
|
|
80
|
-
* @param {*} [options] Override http request option.
|
|
81
|
-
* @throws {RequiredError}
|
|
82
|
-
* @memberof ProjectMembershipApiInterface
|
|
83
|
-
*/
|
|
84
|
-
upsertProjectMembershipRaw(requestParameters: UpsertProjectMembershipOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProjectMembership>>;
|
|
85
|
-
/**
|
|
86
|
-
* Create or update a project membership
|
|
87
|
-
*/
|
|
88
|
-
upsertProjectMembership(requestParameters: UpsertProjectMembershipOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectMembership>;
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
*
|
|
92
|
-
*/
|
|
93
|
-
export declare class ProjectMembershipApi extends runtime.BaseAPI implements ProjectMembershipApiInterface {
|
|
94
|
-
/**
|
|
95
|
-
* Get a project membership for a builder
|
|
96
|
-
*/
|
|
97
|
-
getProjectMembershipForBuilderRaw(requestParameters: GetProjectMembershipForBuilderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProjectMembership>>;
|
|
98
|
-
/**
|
|
99
|
-
* Get a project membership for a builder
|
|
100
|
-
*/
|
|
101
|
-
getProjectMembershipForBuilder(requestParameters: GetProjectMembershipForBuilderRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectMembership>;
|
|
102
|
-
/**
|
|
103
|
-
* List project memberships for a builder
|
|
104
|
-
*/
|
|
105
|
-
listBuilderProjectMembershipsRaw(requestParameters: ListBuilderProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectMembership>>>;
|
|
106
|
-
/**
|
|
107
|
-
* List project memberships for a builder
|
|
108
|
-
*/
|
|
109
|
-
listBuilderProjectMemberships(requestParameters: ListBuilderProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectMembership>>;
|
|
110
|
-
/**
|
|
111
|
-
* List a project\'s memberships
|
|
112
|
-
*/
|
|
113
|
-
listProjectMembershipsRaw(requestParameters: ListProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<ProjectMembership>>>;
|
|
114
|
-
/**
|
|
115
|
-
* List a project\'s memberships
|
|
116
|
-
*/
|
|
117
|
-
listProjectMemberships(requestParameters: ListProjectMembershipsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ProjectMembership>>;
|
|
118
|
-
/**
|
|
119
|
-
* Create or update a project membership
|
|
120
|
-
*/
|
|
121
|
-
upsertProjectMembershipRaw(requestParameters: UpsertProjectMembershipOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ProjectMembership>>;
|
|
122
|
-
/**
|
|
123
|
-
* Create or update a project membership
|
|
124
|
-
*/
|
|
125
|
-
upsertProjectMembership(requestParameters: UpsertProjectMembershipOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ProjectMembership>;
|
|
126
|
-
}
|