@amp-labs/react 1.0.2 → 1.2.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.
- package/README.md +1 -1
- package/build/generated-sources/api/src/apis/AllowedDomainApi.d.ts +79 -0
- package/build/generated-sources/api/src/apis/AllowedDomainApi.js +101 -0
- package/build/generated-sources/api/src/apis/ConnectionApi.d.ts +82 -0
- package/build/generated-sources/api/src/apis/ConnectionApi.js +107 -0
- package/build/generated-sources/api/src/apis/ConsumerApi.d.ts +52 -0
- package/build/generated-sources/api/src/apis/ConsumerApi.js +75 -0
- package/build/generated-sources/api/src/apis/DestinationApi.d.ts +78 -0
- package/build/generated-sources/api/src/apis/DestinationApi.js +102 -0
- package/build/generated-sources/api/src/apis/GroupApi.d.ts +52 -0
- package/build/generated-sources/api/src/apis/GroupApi.js +75 -0
- package/build/generated-sources/api/src/apis/InstallationApi.d.ts +168 -0
- package/build/generated-sources/api/src/apis/InstallationApi.js +205 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.d.ts +128 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.js +154 -0
- package/build/generated-sources/api/src/apis/OAuthApi.d.ts +76 -0
- package/build/generated-sources/api/src/apis/OAuthApi.js +102 -0
- package/build/generated-sources/api/src/apis/OperationApi.d.ts +80 -0
- package/build/generated-sources/api/src/apis/OperationApi.js +104 -0
- package/build/generated-sources/api/src/apis/OperationLogApi.d.ts +55 -0
- package/build/generated-sources/api/src/apis/OperationLogApi.js +76 -0
- package/build/generated-sources/api/src/apis/ProjectApi.d.ts +124 -0
- package/build/generated-sources/api/src/apis/ProjectApi.js +148 -0
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.d.ts +126 -0
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.js +154 -0
- package/build/generated-sources/api/src/apis/ProviderAppApi.d.ts +130 -0
- package/build/generated-sources/api/src/apis/ProviderAppApi.js +158 -0
- package/build/generated-sources/api/src/apis/RevisionApi.d.ts +87 -0
- package/build/generated-sources/api/src/apis/RevisionApi.js +113 -0
- package/build/generated-sources/api/src/apis/UploadURLApi.d.ts +46 -0
- package/build/generated-sources/api/src/apis/UploadURLApi.js +68 -0
- package/build/generated-sources/api/src/apis/index.d.ts +15 -1
- package/build/generated-sources/api/src/apis/index.js +15 -1
- package/build/generated-sources/api/src/models/CreateInstallationRequest.d.ts +2 -2
- package/build/generated-sources/api/src/models/CreateInstallationRequest.js +2 -2
- package/build/generated-sources/api/src/models/CreateInstallationRequestConfig.d.ts +3 -3
- package/build/generated-sources/api/src/models/CreateInstallationRequestConfig.js +3 -4
- package/build/generated-sources/api/src/models/Destination.d.ts +44 -0
- package/build/generated-sources/api/src/models/Destination.js +57 -0
- package/build/generated-sources/api/src/models/DestinationMetadata.d.ts +39 -0
- package/build/generated-sources/api/src/models/{CreateDestinationRequestMetadata.js → DestinationMetadata.js} +11 -11
- package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/OauthConnectRequest.js +1 -2
- package/build/generated-sources/api/src/models/Operation.d.ts +6 -12
- package/build/generated-sources/api/src/models/Operation.js +3 -6
- package/build/generated-sources/api/src/models/OperationLog.d.ts +43 -0
- package/build/generated-sources/api/src/models/OperationLog.js +56 -0
- package/build/generated-sources/api/src/models/ProviderApp.d.ts +6 -0
- package/build/generated-sources/api/src/models/ProviderApp.js +2 -0
- package/build/generated-sources/api/src/models/index.d.ts +3 -2
- package/build/generated-sources/api/src/models/index.js +3 -2
- package/build/src/assets/TrashIcon.js +3 -1
- package/build/src/components/Configure/InstallIntegration.d.ts +4 -1
- package/build/src/components/Configure/InstallIntegration.js +10 -23
- package/build/src/components/Configure/actions/onSaveReadCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js} +7 -6
- package/build/src/components/Configure/actions/onSaveReadUpdateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveUpdate.js → onSaveReadUpdateInstallation.js} +13 -8
- package/build/src/components/Configure/actions/write/generateConfigWriteObjects.d.ts +26 -0
- package/build/src/components/Configure/actions/write/generateConfigWriteObjects.js +41 -0
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +85 -0
- package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.js +60 -0
- package/build/src/components/Configure/{ConfigureInstallationBase.d.ts → content/ConfigureInstallationBase.d.ts} +2 -1
- package/build/src/components/Configure/content/ConfigureInstallationBase.js +36 -0
- package/build/src/components/Configure/content/CreateInstallation.js +83 -0
- package/build/src/components/Configure/content/InstallationContent.d.ts +1 -0
- package/build/src/components/Configure/content/InstallationContent.js +20 -0
- package/build/src/components/Configure/{UninstallContent.js → content/UninstallContent.js} +15 -7
- package/build/src/components/Configure/{UpdateInstallation.d.ts → content/UpdateInstallation.d.ts} +1 -1
- package/build/src/components/Configure/{UpdateInstallation.js → content/UpdateInstallation.js} +42 -28
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.d.ts +1 -1
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.js +4 -7
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.js +10 -11
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/setFieldMapping.d.ts +1 -1
- package/build/src/components/Configure/content/fields/FieldMappings/setFieldMapping.js +21 -0
- package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.js +9 -14
- package/build/src/components/Configure/{fields → content/fields}/OptionalFields/setOptionalField.d.ts +1 -1
- package/build/src/components/Configure/content/fields/OptionalFields/setOptionalField.js +27 -0
- package/build/src/components/Configure/content/fields/ReadFields.d.ts +1 -0
- package/build/src/components/Configure/content/fields/ReadFields.js +11 -0
- package/build/src/components/Configure/content/fields/RequiredFields.js +23 -0
- package/build/src/components/Configure/content/fields/WriteFields/WriteFields.d.ts +1 -0
- package/build/src/components/Configure/content/fields/WriteFields/WriteFields.js +22 -0
- package/build/src/components/Configure/content/fields/WriteFields/index.d.ts +2 -0
- package/build/src/components/Configure/content/fields/WriteFields/index.js +5 -0
- package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.d.ts +3 -0
- package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.js +32 -0
- package/build/src/components/Configure/content/useMutateInstallation.d.ts +23 -0
- package/build/src/components/Configure/content/useMutateInstallation.js +47 -0
- package/build/src/components/Configure/content/useSelectedConfigureState.d.ts +72 -0
- package/build/src/components/Configure/content/useSelectedConfigureState.js +24 -0
- package/build/src/components/Configure/{ProtectedConnectionLayout.d.ts → layout/ProtectedConnectionLayout.d.ts} +2 -1
- package/build/src/components/Configure/layout/ProtectedConnectionLayout.js +34 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.d.ts +1 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.js +3 -3
- package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.d.ts +7 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.js +11 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.d.ts +1 -1
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.js +2 -2
- package/build/src/components/Configure/nav/ObjectManagementNav/constant.d.ts +1 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/constant.js +4 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/index.d.ts +1 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/index.js +61 -0
- package/build/src/components/Configure/state/ConfigurationStateProvider.d.ts +70 -42
- package/build/src/components/Configure/state/ConfigurationStateProvider.js +39 -17
- package/build/src/components/Configure/state/HydratedRevisionContext.js +11 -9
- package/build/src/components/Configure/state/utils.d.ts +2 -2
- package/build/src/components/Configure/state/utils.js +44 -19
- package/build/src/components/Configure/types.d.ts +22 -6
- package/build/src/components/Configure/utils.d.ts +3 -2
- package/build/src/components/Configure/utils.js +25 -5
- package/build/src/components/Connect/ConnectProvider.d.ts +3 -1
- package/build/src/components/Connect/ConnectProvider.js +6 -12
- package/build/src/components/Connect/ConnectedSuccessBox.d.ts +5 -0
- package/build/src/components/Connect/ConnectedSuccessBox.js +13 -0
- package/build/src/components/Connect/useConnectionHandler.d.ts +10 -0
- package/build/src/components/Connect/useConnectionHandler.js +24 -0
- package/build/src/components/ErrorTextBox.js +11 -0
- package/build/src/components/Oauth/NoSubdomainEntry/LandingContent.d.ts +8 -0
- package/build/src/components/Oauth/NoSubdomainEntry/LandingContent.js +11 -0
- package/build/src/components/Oauth/NoSubdomainEntry/NoSubdomainOauthFlow.d.ts +16 -0
- package/build/src/components/Oauth/NoSubdomainEntry/NoSubdomainOauthFlow.js +50 -0
- package/build/src/components/Oauth/OAuthErrorAlert.d.ts +5 -0
- package/build/src/components/Oauth/OAuthErrorAlert.js +12 -0
- package/build/src/components/{Connect → Oauth}/OAuthPopup.js +8 -10
- package/build/src/components/{Salesforce → Oauth/Salesforce}/SalesforceOauthFlow.d.ts +2 -2
- package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +57 -0
- package/build/src/components/Oauth/Salesforce/SubdomainEntry.d.ts +8 -0
- package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +12 -0
- package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -0
- package/build/src/components/Oauth/fetchOAuthCallbackURL.js +28 -0
- package/build/src/components/RedirectHandler/RedirectHandler.d.ts +15 -0
- package/build/src/components/RedirectHandler/RedirectHandler.js +31 -0
- package/build/src/components/RedirectHandler/index.d.ts +1 -0
- package/build/src/components/RedirectHandler/index.js +5 -0
- package/build/src/constants.d.ts +1 -0
- package/build/src/constants.js +2 -1
- package/build/src/{components/AmpersandProvider/AmpersandProvider.js → context/AmpersandContextProvider/AmpersandContextProvider.js} +6 -6
- package/build/src/context/AmpersandContextProvider/index.d.ts +1 -0
- package/build/src/{components/AmpersandProvider → context/AmpersandContextProvider}/index.js +1 -1
- package/build/src/context/{ConnectionsContext.js → ConnectionsContextProvider.js} +11 -10
- package/build/src/context/{InstallIntegrationContext.d.ts → InstallIntegrationContextProvider.d.ts} +7 -2
- package/build/src/context/{InstallIntegrationContext.js → InstallIntegrationContextProvider.js} +29 -14
- package/build/src/context/{IntegrationListContext.js → IntegrationListContextProvider.js} +4 -4
- package/build/src/context/{ProjectContext.js → ProjectContextProvider.js} +4 -4
- package/build/src/hooks/useIsIntegrationInstalled.js +7 -7
- package/build/src/index.d.ts +1 -2
- package/build/src/index.js +1 -2
- package/build/src/public/index.d.ts +7 -0
- package/build/src/{components → public}/index.js +7 -3
- package/build/src/services/ApiService.d.ts +27 -0
- package/build/src/services/ApiService.js +34 -0
- package/build/src/services/api.d.ts +5 -4
- package/build/src/services/api.js +11 -6
- package/package.json +3 -3
- package/build/generated-sources/api/src/apis/DefaultApi.d.ts +0 -904
- package/build/generated-sources/api/src/apis/DefaultApi.js +0 -992
- package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +0 -44
- package/build/generated-sources/api/src/models/CreateDestinationRequest.js +0 -57
- package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +0 -39
- package/build/src/components/AmpersandProvider/index.d.ts +0 -1
- package/build/src/components/CenteredTextBox/CenteredTextBox.d.ts +0 -5
- package/build/src/components/CenteredTextBox/CenteredTextBox.js +0 -8
- package/build/src/components/Configure/ConfigureInstallationBase.js +0 -29
- package/build/src/components/Configure/CreateInstallation.js +0 -70
- package/build/src/components/Configure/ErrorTextBox.js +0 -9
- package/build/src/components/Configure/ObjectManagementNav/index.js +0 -52
- package/build/src/components/Configure/ProtectedConnectionLayout.js +0 -33
- package/build/src/components/Configure/actions/onSaveCreate.d.ts +0 -3
- package/build/src/components/Configure/actions/onSaveUpdate.d.ts +0 -3
- package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.js +0 -18
- package/build/src/components/Configure/fields/OptionalFields/setOptionalField.js +0 -21
- package/build/src/components/Configure/fields/RequiredFields.js +0 -27
- package/build/src/components/Salesforce/SalesforceOauthFlow.js +0 -89
- package/build/src/components/index.d.ts +0 -3
- /package/build/src/components/Configure/{CreateInstallation.d.ts → content/CreateInstallation.d.ts} +0 -0
- /package/build/src/components/Configure/{UninstallContent.d.ts → content/UninstallContent.d.ts} +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/RequiredFields.d.ts +0 -0
- /package/build/src/components/{Configure/ErrorTextBox.d.ts → ErrorTextBox.d.ts} +0 -0
- /package/build/src/components/{Connect → Oauth}/OAuthPopup.d.ts +0 -0
- /package/build/src/{components/AmpersandProvider/AmpersandProvider.d.ts → context/AmpersandContextProvider/AmpersandContextProvider.d.ts} +0 -0
- /package/build/src/context/{ApiKeyProvider.d.ts → ApiKeyContextProvider.d.ts} +0 -0
- /package/build/src/context/{ApiKeyProvider.js → ApiKeyContextProvider.js} +0 -0
- /package/build/src/context/{ConnectionsContext.d.ts → ConnectionsContextProvider.d.ts} +0 -0
- /package/build/src/context/{IntegrationListContext.d.ts → IntegrationListContextProvider.d.ts} +0 -0
- /package/build/src/context/{ProjectContext.d.ts → ProjectContextProvider.d.ts} +0 -0
|
@@ -10,8 +10,6 @@ export * from './ConfigContentAllOf';
|
|
|
10
10
|
export * from './Connection';
|
|
11
11
|
export * from './Consumer';
|
|
12
12
|
export * from './CreateConsumerRequest';
|
|
13
|
-
export * from './CreateDestinationRequest';
|
|
14
|
-
export * from './CreateDestinationRequestMetadata';
|
|
15
13
|
export * from './CreateGroupRequest';
|
|
16
14
|
export * from './CreateInstallationRequest';
|
|
17
15
|
export * from './CreateInstallationRequestConfig';
|
|
@@ -19,6 +17,8 @@ export * from './CreateIntegrationRequest';
|
|
|
19
17
|
export * from './CreateIntegrationRequestLatestRevision';
|
|
20
18
|
export * from './CreateProjectRequest';
|
|
21
19
|
export * from './CreateProviderAppRequest';
|
|
20
|
+
export * from './Destination';
|
|
21
|
+
export * from './DestinationMetadata';
|
|
22
22
|
export * from './Group';
|
|
23
23
|
export * from './HydratedIntegration';
|
|
24
24
|
export * from './HydratedIntegrationField';
|
|
@@ -44,6 +44,7 @@ export * from './IntegrationWriteObject';
|
|
|
44
44
|
export * from './OauthConnectRequest';
|
|
45
45
|
export * from './Operation';
|
|
46
46
|
export * from './OperationError';
|
|
47
|
+
export * from './OperationLog';
|
|
47
48
|
export * from './OptionalFieldsAutoOption';
|
|
48
49
|
export * from './Project';
|
|
49
50
|
export * from './ProjectMembership';
|
|
@@ -28,8 +28,6 @@ __exportStar(require("./ConfigContentAllOf"), exports);
|
|
|
28
28
|
__exportStar(require("./Connection"), exports);
|
|
29
29
|
__exportStar(require("./Consumer"), exports);
|
|
30
30
|
__exportStar(require("./CreateConsumerRequest"), exports);
|
|
31
|
-
__exportStar(require("./CreateDestinationRequest"), exports);
|
|
32
|
-
__exportStar(require("./CreateDestinationRequestMetadata"), exports);
|
|
33
31
|
__exportStar(require("./CreateGroupRequest"), exports);
|
|
34
32
|
__exportStar(require("./CreateInstallationRequest"), exports);
|
|
35
33
|
__exportStar(require("./CreateInstallationRequestConfig"), exports);
|
|
@@ -37,6 +35,8 @@ __exportStar(require("./CreateIntegrationRequest"), exports);
|
|
|
37
35
|
__exportStar(require("./CreateIntegrationRequestLatestRevision"), exports);
|
|
38
36
|
__exportStar(require("./CreateProjectRequest"), exports);
|
|
39
37
|
__exportStar(require("./CreateProviderAppRequest"), exports);
|
|
38
|
+
__exportStar(require("./Destination"), exports);
|
|
39
|
+
__exportStar(require("./DestinationMetadata"), exports);
|
|
40
40
|
__exportStar(require("./Group"), exports);
|
|
41
41
|
__exportStar(require("./HydratedIntegration"), exports);
|
|
42
42
|
__exportStar(require("./HydratedIntegrationField"), exports);
|
|
@@ -62,6 +62,7 @@ __exportStar(require("./IntegrationWriteObject"), exports);
|
|
|
62
62
|
__exportStar(require("./OauthConnectRequest"), exports);
|
|
63
63
|
__exportStar(require("./Operation"), exports);
|
|
64
64
|
__exportStar(require("./OperationError"), exports);
|
|
65
|
+
__exportStar(require("./OperationLog"), exports);
|
|
65
66
|
__exportStar(require("./OptionalFieldsAutoOption"), exports);
|
|
66
67
|
__exportStar(require("./Project"), exports);
|
|
67
68
|
__exportStar(require("./ProjectMembership"), exports);
|
|
@@ -4,6 +4,8 @@ exports.TrashIcon = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
// red.800 trash icon
|
|
6
6
|
function TrashIcon() {
|
|
7
|
-
return ((0, jsx_runtime_1.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.25 4.5H3.75H15.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.25 4.5H3.75H15.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", {
|
|
8
|
+
// eslint-disable-next-line max-len
|
|
9
|
+
d: "M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M7.5 8.25V12.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.5 8.25V12.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
8
10
|
}
|
|
9
11
|
exports.TrashIcon = TrashIcon;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { Config } from '../../services/api';
|
|
1
2
|
interface InstallIntegrationProps {
|
|
2
3
|
integration: string;
|
|
3
4
|
consumerRef: string;
|
|
4
5
|
consumerName?: string;
|
|
5
6
|
groupRef: string;
|
|
6
7
|
groupName?: string;
|
|
8
|
+
onInstallSuccess?: (installationId: string, config: Config) => void;
|
|
9
|
+
onUpdateSuccess?: (installationId: string, config: Config) => void;
|
|
7
10
|
}
|
|
8
|
-
export declare function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, }: InstallIntegrationProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, onInstallSuccess, onUpdateSuccess, }: InstallIntegrationProps): import("react/jsx-runtime").JSX.Element;
|
|
9
12
|
export {};
|
|
@@ -2,38 +2,25 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.InstallIntegration = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
const
|
|
5
|
+
const ConnectionsContextProvider_1 = require("../../context/ConnectionsContextProvider");
|
|
6
6
|
const ErrorContextProvider_1 = require("../../context/ErrorContextProvider");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
7
|
+
const InstallIntegrationContextProvider_1 = require("../../context/InstallIntegrationContextProvider");
|
|
8
|
+
const ProjectContextProvider_1 = require("../../context/ProjectContextProvider");
|
|
9
|
+
const ErrorTextBox_1 = require("../ErrorTextBox");
|
|
10
|
+
const InstallationContent_1 = require("./content/InstallationContent");
|
|
11
|
+
const ProtectedConnectionLayout_1 = require("./layout/ProtectedConnectionLayout");
|
|
12
|
+
const ObjectManagementNav_1 = require("./nav/ObjectManagementNav");
|
|
9
13
|
const ConfigurationStateProvider_1 = require("./state/ConfigurationStateProvider");
|
|
10
14
|
const HydratedRevisionContext_1 = require("./state/HydratedRevisionContext");
|
|
11
|
-
|
|
12
|
-
const ErrorTextBox_1 = require("./ErrorTextBox");
|
|
13
|
-
const ObjectManagementNav_1 = require("./ObjectManagementNav");
|
|
14
|
-
const ProtectedConnectionLayout_1 = require("./ProtectedConnectionLayout");
|
|
15
|
-
const UpdateInstallation_1 = require("./UpdateInstallation");
|
|
16
|
-
// todo : add the install integration provider to supply these properties
|
|
17
|
-
function InstallationContent() {
|
|
18
|
-
const { integrationObj, installation } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
19
|
-
if (!integrationObj) {
|
|
20
|
-
return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "We can't load the integration" });
|
|
21
|
-
}
|
|
22
|
-
return installation && integrationObj ? (
|
|
23
|
-
// If installation exists, render update installation flow
|
|
24
|
-
(0, jsx_runtime_1.jsx)(UpdateInstallation_1.UpdateInstallation, { installation: installation, integrationObj: integrationObj })) : (
|
|
25
|
-
// No installation, render create installation flow
|
|
26
|
-
(0, jsx_runtime_1.jsx)(CreateInstallation_1.CreateInstallation, {}));
|
|
27
|
-
}
|
|
28
|
-
function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, }) {
|
|
15
|
+
function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, onInstallSuccess, onUpdateSuccess, }) {
|
|
29
16
|
var _a;
|
|
30
|
-
const { projectId } = (0,
|
|
17
|
+
const { projectId } = (0, ProjectContextProvider_1.useProject)();
|
|
31
18
|
const { errorState } = (0, ErrorContextProvider_1.useErrorState)();
|
|
32
19
|
if ((_a = errorState[ErrorContextProvider_1.ErrorBoundary.INTEGRATION_LIST]) === null || _a === void 0 ? void 0 : _a.apiError) {
|
|
33
20
|
return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "Something went wrong, couldn't find integration information" });
|
|
34
21
|
}
|
|
35
22
|
return (
|
|
36
23
|
// install integration provider provides all props, integrationObj and installation
|
|
37
|
-
(0, jsx_runtime_1.jsx)(
|
|
24
|
+
(0, jsx_runtime_1.jsx)(InstallIntegrationContextProvider_1.InstallIntegrationProvider, { integration: integration, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, onInstallSuccess: onInstallSuccess, onUpdateSuccess: onUpdateSuccess, children: (0, jsx_runtime_1.jsx)(ConnectionsContextProvider_1.ConnectionsProvider, { groupRef: groupRef, children: (0, jsx_runtime_1.jsx)(ProtectedConnectionLayout_1.ProtectedConnectionLayout, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, children: (0, jsx_runtime_1.jsx)(HydratedRevisionContext_1.HydratedRevisionProvider, { projectId: projectId, children: (0, jsx_runtime_1.jsx)(ConfigurationStateProvider_1.ConfigurationProvider, { children: (0, jsx_runtime_1.jsx)(ObjectManagementNav_1.ObjectManagementNav, { children: (0, jsx_runtime_1.jsx)(InstallationContent_1.InstallationContent, {}) }) }) }) }) }) }));
|
|
38
25
|
}
|
|
39
26
|
exports.InstallIntegration = InstallIntegration;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, HydratedRevision, Installation } from '../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../types';
|
|
3
|
+
export declare const onSaveReadCreateInstallation: (projectId: string, integrationId: string, groupRef: string, consumerRef: string, connectionId: string, objectName: string, apiKey: string, hydratedRevision: HydratedRevision, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onInstallSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.onSaveReadCreateInstallation = void 0;
|
|
4
4
|
const api_1 = require("../../../services/api");
|
|
5
5
|
const utils_1 = require("../state/utils");
|
|
6
6
|
/**
|
|
@@ -29,7 +29,7 @@ const getObjectFromHydratedRevision = (hydratedRevision, objectName) => {
|
|
|
29
29
|
* @param consumerRef
|
|
30
30
|
* @returns
|
|
31
31
|
*/
|
|
32
|
-
const
|
|
32
|
+
const generateCreateReadConfigFromConfigureState = (configureState, objectName, hydratedRevision, consumerRef) => {
|
|
33
33
|
const selectedFields = (0, utils_1.generateSelectedFieldsFromConfigureState)(configureState);
|
|
34
34
|
const selectedFieldMappings = (0, utils_1.generateSelectedFieldMappingsFromConfigureState)(configureState);
|
|
35
35
|
const obj = getObjectFromHydratedRevision(hydratedRevision, objectName);
|
|
@@ -58,8 +58,8 @@ const generateCreateConfigFromConfigureState = (configureState, objectName, hydr
|
|
|
58
58
|
};
|
|
59
59
|
return createConfigObj;
|
|
60
60
|
};
|
|
61
|
-
const
|
|
62
|
-
const createConfig =
|
|
61
|
+
const onSaveReadCreateInstallation = (projectId, integrationId, groupRef, consumerRef, connectionId, objectName, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess) => {
|
|
62
|
+
const createConfig = generateCreateReadConfigFromConfigureState(configureState, objectName, hydratedRevision, consumerRef);
|
|
63
63
|
if (!createConfig) {
|
|
64
64
|
console.error('Error when generating createConfig from configureState');
|
|
65
65
|
return Promise.resolve(null);
|
|
@@ -73,7 +73,7 @@ const onSaveCreate = (projectId, integrationId, groupRef, consumerRef, connectio
|
|
|
73
73
|
config: createConfig,
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
|
-
return (0, api_1.api)().createInstallation(createInstallationRequest, {
|
|
76
|
+
return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
|
|
77
77
|
headers: {
|
|
78
78
|
'X-Api-Key': apiKey,
|
|
79
79
|
'Content-Type': 'application/json',
|
|
@@ -82,9 +82,10 @@ const onSaveCreate = (projectId, integrationId, groupRef, consumerRef, connectio
|
|
|
82
82
|
.then((installation) => {
|
|
83
83
|
// update local installation state
|
|
84
84
|
setInstallation(installation);
|
|
85
|
+
onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
|
|
85
86
|
})
|
|
86
87
|
.catch((err) => {
|
|
87
88
|
console.error('ERROR: ', err);
|
|
88
89
|
});
|
|
89
90
|
};
|
|
90
|
-
exports.
|
|
91
|
+
exports.onSaveReadCreateInstallation = onSaveReadCreateInstallation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, HydratedIntegrationObject, Installation } from '../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../types';
|
|
3
|
+
export declare const onSaveReadUpdateInstallation: (projectId: string, integrationId: string, installationId: string, selectedObjectName: string, apiKey: string, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, hydratedObject: HydratedIntegrationObject, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
package/build/src/components/Configure/actions/{onSaveUpdate.js → onSaveReadUpdateInstallation.js}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.onSaveReadUpdateInstallation = void 0;
|
|
4
4
|
const api_1 = require("../../../services/api");
|
|
5
5
|
const utils_1 = require("../state/utils");
|
|
6
6
|
/**
|
|
@@ -19,7 +19,7 @@ const utils_1 = require("../state/utils");
|
|
|
19
19
|
* @param schedule
|
|
20
20
|
* @returns
|
|
21
21
|
*/
|
|
22
|
-
const
|
|
22
|
+
const generateUpdateReadConfigFromConfigureState = (configureState, objectName, hydratedObject, schedule) => {
|
|
23
23
|
const selectedFields = (0, utils_1.generateSelectedFieldsFromConfigureState)(configureState);
|
|
24
24
|
const selectedFieldMappings = (0, utils_1.generateSelectedFieldMappingsFromConfigureState)(configureState);
|
|
25
25
|
// config request object type needs to be fixed
|
|
@@ -41,10 +41,14 @@ const generateUpdateConfigFromConfigureState = (configureState, objectName, hydr
|
|
|
41
41
|
};
|
|
42
42
|
return updateConfigObject;
|
|
43
43
|
};
|
|
44
|
-
const
|
|
44
|
+
const onSaveReadUpdateInstallation = (projectId, integrationId, installationId, selectedObjectName, apiKey, configureState, setInstallation, hydratedObject, onUpdateSuccess) => {
|
|
45
45
|
// get configuration state
|
|
46
46
|
// transform configuration state to update shape
|
|
47
|
-
const updateConfig =
|
|
47
|
+
const updateConfig = generateUpdateReadConfigFromConfigureState(configureState, selectedObjectName || '', hydratedObject, hydratedObject.schedule);
|
|
48
|
+
if (!updateConfig) {
|
|
49
|
+
console.error('Error when generating updateConfig from configureState');
|
|
50
|
+
return Promise.resolve(null);
|
|
51
|
+
}
|
|
48
52
|
const updateInstallationRequest = {
|
|
49
53
|
projectId,
|
|
50
54
|
installationId,
|
|
@@ -59,16 +63,17 @@ const onSaveUpdate = (projectId, integrationId, installationId, selectedObjectNa
|
|
|
59
63
|
},
|
|
60
64
|
};
|
|
61
65
|
// call api.updateInstallation
|
|
62
|
-
return (0, api_1.api)().updateInstallation(updateInstallationRequest, {
|
|
66
|
+
return (0, api_1.api)().installationApi.updateInstallation(updateInstallationRequest, {
|
|
63
67
|
headers: {
|
|
64
68
|
'X-Api-Key': apiKey,
|
|
65
69
|
'Content-Type': 'application/json',
|
|
66
70
|
},
|
|
67
|
-
}).then((
|
|
71
|
+
}).then((installation) => {
|
|
68
72
|
// update local installation state
|
|
69
|
-
setInstallation(
|
|
73
|
+
setInstallation(installation);
|
|
74
|
+
onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess(installation.id, installation.config);
|
|
70
75
|
}).catch((err) => {
|
|
71
76
|
console.error('ERROR: ', err);
|
|
72
77
|
});
|
|
73
78
|
};
|
|
74
|
-
exports.
|
|
79
|
+
exports.onSaveReadUpdateInstallation = onSaveReadUpdateInstallation;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ConfigureState } from '../../types';
|
|
2
|
+
type WriteObject = {
|
|
3
|
+
objectName: string;
|
|
4
|
+
};
|
|
5
|
+
type WriteObjects = {
|
|
6
|
+
[objectName: string]: WriteObject;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* example type
|
|
10
|
+
* "objects":
|
|
11
|
+
* {
|
|
12
|
+
objects: {
|
|
13
|
+
account: {
|
|
14
|
+
objectName: 'account',
|
|
15
|
+
},
|
|
16
|
+
contact: {
|
|
17
|
+
objectName: 'contact',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
* @param writeObjects
|
|
22
|
+
* @param configureState
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare const generateConfigWriteObjects: (configureState: ConfigureState) => WriteObjects;
|
|
26
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateConfigWriteObjects = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* example type
|
|
6
|
+
* "objects":
|
|
7
|
+
* {
|
|
8
|
+
objects: {
|
|
9
|
+
account: {
|
|
10
|
+
objectName: 'account',
|
|
11
|
+
},
|
|
12
|
+
contact: {
|
|
13
|
+
objectName: 'contact',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
}
|
|
17
|
+
* @param writeObjects
|
|
18
|
+
* @param configureState
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
const generateConfigWriteObjects = (configureState) => {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const configWriteObjects = {}; // `any` is listed type in generated SDK
|
|
24
|
+
const configStateWriteObjects = (_a = configureState.write) === null || _a === void 0 ? void 0 : _a.writeObjects;
|
|
25
|
+
const selected = (_b = configureState.write) === null || _b === void 0 ? void 0 : _b.selectedNonConfigurableWriteFields;
|
|
26
|
+
const selectedKeys = selected ? Object.keys(selected) : [];
|
|
27
|
+
if (configStateWriteObjects) {
|
|
28
|
+
configStateWriteObjects.forEach((configStateWriteObject) => {
|
|
29
|
+
const obj = configStateWriteObject.objectName;
|
|
30
|
+
// object exists in config form
|
|
31
|
+
if (selectedKeys.includes(obj)) {
|
|
32
|
+
// insert objectName into configWriteObjects
|
|
33
|
+
configWriteObjects[obj] = {
|
|
34
|
+
objectName: obj,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
return configWriteObjects;
|
|
40
|
+
};
|
|
41
|
+
exports.generateConfigWriteObjects = generateConfigWriteObjects;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, HydratedRevision, Installation } from '../../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../../types';
|
|
3
|
+
export declare const onSaveWriteCreateInstallation: (projectId: string, integrationId: string, groupRef: string, consumerRef: string, connectionId: string, apiKey: string, hydratedRevision: HydratedRevision, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onInstallSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onSaveWriteCreateInstallation = void 0;
|
|
4
|
+
const api_1 = require("../../../../services/api");
|
|
5
|
+
const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
|
|
6
|
+
/**
|
|
7
|
+
* gets write objects from hydratedRevision
|
|
8
|
+
* @param hydratedRevision
|
|
9
|
+
* @param objectName
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
const getWriteObjectsFromHydratedRevision = (hydratedRevision) => {
|
|
13
|
+
const writeAction = hydratedRevision.content.write;
|
|
14
|
+
return writeAction === null || writeAction === void 0 ? void 0 : writeAction.objects;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* given a configureState, objectName, hyrdatedRevision, and consumerRef
|
|
18
|
+
* generate the config object that is need for update installation request.
|
|
19
|
+
*
|
|
20
|
+
* 1. get required fields from configureState
|
|
21
|
+
* 2. get optional fields from configureState
|
|
22
|
+
* 3. merge required fields and optional fields into selectedFields
|
|
23
|
+
* 4. get required custom map fields from configureState
|
|
24
|
+
* 5. generate create config object
|
|
25
|
+
* @param configureState
|
|
26
|
+
* @param objectName
|
|
27
|
+
* @param hydratedRevision
|
|
28
|
+
* @param consumerRef
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
const generateCreateWriteConfigFromConfigureState = (configureState, hydratedRevision, consumerRef) => {
|
|
32
|
+
const writeObjects = getWriteObjectsFromHydratedRevision(hydratedRevision);
|
|
33
|
+
if (!writeObjects) {
|
|
34
|
+
console.error('Error when getting write objects from hydratedRevision');
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const configWriteObjects = (0, generateConfigWriteObjects_1.generateConfigWriteObjects)(configureState);
|
|
38
|
+
// create config request object
|
|
39
|
+
const createConfigObj = {
|
|
40
|
+
revisionId: hydratedRevision.id,
|
|
41
|
+
createdBy: `consumer:${consumerRef}`,
|
|
42
|
+
content: {
|
|
43
|
+
provider: hydratedRevision.content.provider,
|
|
44
|
+
// need empty read.standardObjects for update read
|
|
45
|
+
read: {
|
|
46
|
+
standardObjects: {},
|
|
47
|
+
},
|
|
48
|
+
write: {
|
|
49
|
+
objects: configWriteObjects,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
return createConfigObj;
|
|
54
|
+
};
|
|
55
|
+
const onSaveWriteCreateInstallation = (projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess) => {
|
|
56
|
+
const createConfig = generateCreateWriteConfigFromConfigureState(configureState, hydratedRevision, consumerRef);
|
|
57
|
+
if (!createConfig) {
|
|
58
|
+
console.error('Error when generating createConfig from configureState');
|
|
59
|
+
return Promise.resolve(null);
|
|
60
|
+
}
|
|
61
|
+
const createInstallationRequest = {
|
|
62
|
+
projectId,
|
|
63
|
+
integrationId,
|
|
64
|
+
installation: {
|
|
65
|
+
groupRef,
|
|
66
|
+
connectionId,
|
|
67
|
+
config: createConfig,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
|
|
71
|
+
headers: {
|
|
72
|
+
'X-Api-Key': apiKey,
|
|
73
|
+
'Content-Type': 'application/json',
|
|
74
|
+
},
|
|
75
|
+
})
|
|
76
|
+
.then((installation) => {
|
|
77
|
+
// update local installation state
|
|
78
|
+
setInstallation(installation);
|
|
79
|
+
onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
|
|
80
|
+
})
|
|
81
|
+
.catch((err) => {
|
|
82
|
+
console.error('ERROR: ', err);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
exports.onSaveWriteCreateInstallation = onSaveWriteCreateInstallation;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Config, Installation } from '../../../../services/api';
|
|
2
|
+
import { ConfigureState } from '../../types';
|
|
3
|
+
export declare const onSaveWriteUpdateInstallation: (projectId: string, integrationId: string, installationId: string, apiKey: string, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.onSaveWriteUpdateInstallation = void 0;
|
|
4
|
+
const api_1 = require("../../../../services/api");
|
|
5
|
+
const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
|
|
6
|
+
/**
|
|
7
|
+
* given a configureState generate the config object that is need for
|
|
8
|
+
* update installation request.
|
|
9
|
+
*
|
|
10
|
+
* @param configureState
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
const generateUpdateWriteConfigFromConfigureState = (configureState) => {
|
|
14
|
+
const configWriteObjects = (0, generateConfigWriteObjects_1.generateConfigWriteObjects)(configureState);
|
|
15
|
+
// config request object type needs to be fixed
|
|
16
|
+
const updateConfigObject = {
|
|
17
|
+
content: {
|
|
18
|
+
write: {
|
|
19
|
+
objects: configWriteObjects,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
return updateConfigObject;
|
|
24
|
+
};
|
|
25
|
+
const onSaveWriteUpdateInstallation = (projectId, integrationId, installationId, apiKey, configureState, setInstallation, onUpdateSuccess) => {
|
|
26
|
+
// get configuration state
|
|
27
|
+
// transform configuration state to update shape
|
|
28
|
+
const updateConfig = generateUpdateWriteConfigFromConfigureState(configureState);
|
|
29
|
+
if (!updateConfig) {
|
|
30
|
+
console.error('Error when generating write updateConfig from configureState');
|
|
31
|
+
return Promise.resolve(null);
|
|
32
|
+
}
|
|
33
|
+
const updateInstallationRequest = {
|
|
34
|
+
projectId,
|
|
35
|
+
installationId,
|
|
36
|
+
integrationId,
|
|
37
|
+
installationUpdate: {
|
|
38
|
+
// update mask will recurse to the object path and replace the object at the object path
|
|
39
|
+
// this example will replace the object at the object (i.e. accounts)
|
|
40
|
+
updateMask: ['config.content.write.objects'],
|
|
41
|
+
installation: {
|
|
42
|
+
config: updateConfig,
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
// call api.updateInstallation
|
|
47
|
+
return (0, api_1.api)().installationApi.updateInstallation(updateInstallationRequest, {
|
|
48
|
+
headers: {
|
|
49
|
+
'X-Api-Key': apiKey,
|
|
50
|
+
'Content-Type': 'application/json',
|
|
51
|
+
},
|
|
52
|
+
}).then((installation) => {
|
|
53
|
+
// update local installation state
|
|
54
|
+
setInstallation(installation);
|
|
55
|
+
onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess(installation.id, installation.config);
|
|
56
|
+
}).catch((err) => {
|
|
57
|
+
console.error('ERROR: ', err);
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
exports.onSaveWriteUpdateInstallation = onSaveWriteUpdateInstallation;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { FormEventHandler } from 'react';
|
|
2
2
|
interface ConfigureInstallationBaseProps {
|
|
3
|
+
isCreateMode?: boolean;
|
|
3
4
|
onSave: FormEventHandler;
|
|
4
5
|
onReset: () => void;
|
|
5
6
|
isLoading: boolean;
|
|
6
7
|
}
|
|
7
|
-
export declare function ConfigureInstallationBase({ onSave, onReset, isLoading }: ConfigureInstallationBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function ConfigureInstallationBase({ onSave, onReset, isLoading, isCreateMode, }: ConfigureInstallationBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigureInstallationBase = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@chakra-ui/react");
|
|
6
|
+
const LoadingIcon_1 = require("../../../assets/LoadingIcon");
|
|
7
|
+
const constant_1 = require("../nav/ObjectManagementNav/constant");
|
|
8
|
+
const UninstallInstallation_1 = require("../nav/ObjectManagementNav/UninstallInstallation");
|
|
9
|
+
const HydratedRevisionContext_1 = require("../state/HydratedRevisionContext");
|
|
10
|
+
const ReadFields_1 = require("./fields/ReadFields");
|
|
11
|
+
const WriteFields_1 = require("./fields/WriteFields");
|
|
12
|
+
const UninstallContent_1 = require("./UninstallContent");
|
|
13
|
+
const useSelectedConfigureState_1 = require("./useSelectedConfigureState");
|
|
14
|
+
// Installation UI Base
|
|
15
|
+
function ConfigureInstallationBase({ onSave, onReset, isLoading, isCreateMode = false, }) {
|
|
16
|
+
var _a, _b, _c;
|
|
17
|
+
const { hydratedRevision, loading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
18
|
+
const { configureState, selectedObjectName } = (0, useSelectedConfigureState_1.useSelectedConfigureState)();
|
|
19
|
+
// has the form been modified?
|
|
20
|
+
const isReadModified = ((_a = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _a === void 0 ? void 0 : _a.isOptionalFieldsModified)
|
|
21
|
+
|| ((_b = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _b === void 0 ? void 0 : _b.isRequiredMapFieldsModified);
|
|
22
|
+
const isWriteModified = (_c = configureState === null || configureState === void 0 ? void 0 : configureState.write) === null || _c === void 0 ? void 0 : _c.isWriteModified;
|
|
23
|
+
const isModified = isReadModified || isWriteModified;
|
|
24
|
+
// is this a new state (modified or creating a new state)
|
|
25
|
+
const isStateNew = isModified || isCreateMode;
|
|
26
|
+
// should the save button be disabled?
|
|
27
|
+
const isDisabled = loading || isLoading || !configureState || !selectedObjectName
|
|
28
|
+
|| !isStateNew;
|
|
29
|
+
// is other selected?
|
|
30
|
+
const isNonConfigurableWrite = selectedObjectName === constant_1.OTHER_CONST;
|
|
31
|
+
// is the form in the uninstall case?
|
|
32
|
+
const isUninstall = selectedObjectName === UninstallInstallation_1.UNINSTALL_INSTALLATION_CONST;
|
|
33
|
+
return (isLoading ? (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {})
|
|
34
|
+
: ((0, jsx_runtime_1.jsxs)("form", { style: { width: '100%', maxWidth: '50rem' }, onSubmit: onSave, children: [(0, jsx_runtime_1.jsxs)(react_1.Stack, { direction: "row", spacing: 4, marginBottom: "20px", flexDir: "row-reverse", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { backgroundColor: "gray.800", _hover: { backgroundColor: 'gray.600' }, type: "submit", isDisabled: isDisabled, children: isCreateMode ? 'Install' : 'Save' }), (0, jsx_runtime_1.jsx)(react_1.Button, { backgroundColor: "gray.200", color: "blackAlpha.700", _hover: { backgroundColor: 'gray.300' }, isDisabled: isDisabled, onClick: onReset, children: "Reset" })] }), (0, jsx_runtime_1.jsxs)(react_1.Box, { p: 8, width: "100%", border: "1px solid #EFEFEF", borderRadius: 8, boxShadow: "md", textAlign: ['left'], margin: "auto", bgColor: "white", maxHeight: "100%", overflowY: "scroll", children: [loading && (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {}), hydratedRevision && !isUninstall && !isNonConfigurableWrite && (0, jsx_runtime_1.jsx)(ReadFields_1.ReadFields, {}), hydratedRevision && !isUninstall && isNonConfigurableWrite && (0, jsx_runtime_1.jsx)(WriteFields_1.WriteFields, {}), !loading && isUninstall && (0, jsx_runtime_1.jsx)(UninstallContent_1.UninstallContent, {})] })] })));
|
|
35
|
+
}
|
|
36
|
+
exports.ConfigureInstallationBase = ConfigureInstallationBase;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreateInstallation = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/**
|
|
6
|
+
* this page is wip: untested
|
|
7
|
+
*/
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const ErrorContextProvider_1 = require("../../../context/ErrorContextProvider");
|
|
10
|
+
const onSaveReadCreateInstallation_1 = require("../actions/onSaveReadCreateInstallation");
|
|
11
|
+
const onSaveWriteCreateInstallation_1 = require("../actions/write/onSaveWriteCreateInstallation");
|
|
12
|
+
const constant_1 = require("../nav/ObjectManagementNav/constant");
|
|
13
|
+
const utils_1 = require("../state/utils");
|
|
14
|
+
const utils_2 = require("../utils");
|
|
15
|
+
const ConfigureInstallationBase_1 = require("./ConfigureInstallationBase");
|
|
16
|
+
const useMutateInstallation_1 = require("./useMutateInstallation");
|
|
17
|
+
// the config should be undefined for create flow
|
|
18
|
+
const UNDEFINED_CONFIG = undefined;
|
|
19
|
+
// Create Installation Flow
|
|
20
|
+
function CreateInstallation() {
|
|
21
|
+
const { integrationId, groupRef, consumerRef, setInstallation, hydratedRevision, loading, selectedObjectName, selectedConnection, apiKey, projectId, resetBoundary, setErrors, resetConfigureState, objectConfigurationsState, resetPendingConfigurationState, configureState, onInstallSuccess, } = (0, useMutateInstallation_1.useMutateInstallation)();
|
|
22
|
+
const [isLoading, setLoadingState] = (0, react_1.useState)(false);
|
|
23
|
+
// is other selected?
|
|
24
|
+
const isOtherSelected = selectedObjectName === constant_1.OTHER_CONST;
|
|
25
|
+
const resetState = (0, react_1.useCallback)(() => {
|
|
26
|
+
resetBoundary(ErrorContextProvider_1.ErrorBoundary.MAPPING);
|
|
27
|
+
if ((hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) && !loading && selectedObjectName) {
|
|
28
|
+
(0, utils_1.setHydrateConfigState)(hydratedRevision, UNDEFINED_CONFIG, selectedObjectName, resetConfigureState);
|
|
29
|
+
}
|
|
30
|
+
}, [resetBoundary, hydratedRevision, loading, selectedObjectName, resetConfigureState]);
|
|
31
|
+
(0, react_1.useEffect)(() => {
|
|
32
|
+
// set configurationState when hydratedRevision is loaded
|
|
33
|
+
if (!configureState && (hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) && !loading) {
|
|
34
|
+
resetState();
|
|
35
|
+
}
|
|
36
|
+
}, [configureState, objectConfigurationsState, hydratedRevision, loading, resetState]);
|
|
37
|
+
const onSaveRead = () => {
|
|
38
|
+
// check if fields with requirements are met
|
|
39
|
+
const { requiredMapFields, selectedFieldMappings } = (configureState === null || configureState === void 0 ? void 0 : configureState.read) || {};
|
|
40
|
+
const { errorList } = (0, utils_2.validateFieldMappings)(requiredMapFields, selectedFieldMappings, setErrors);
|
|
41
|
+
if (errorList.length > 0) {
|
|
42
|
+
return;
|
|
43
|
+
} // skip if there are errors
|
|
44
|
+
if (selectedObjectName && (selectedConnection === null || selectedConnection === void 0 ? void 0 : selectedConnection.id) && apiKey && projectId
|
|
45
|
+
&& integrationId && groupRef && consumerRef && hydratedRevision) {
|
|
46
|
+
setLoadingState(true);
|
|
47
|
+
const res = (0, onSaveReadCreateInstallation_1.onSaveReadCreateInstallation)(projectId, integrationId, groupRef, consumerRef, selectedConnection.id, selectedObjectName, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess);
|
|
48
|
+
res.finally(() => {
|
|
49
|
+
setLoadingState(false);
|
|
50
|
+
resetPendingConfigurationState(selectedObjectName);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
console.error('CreateInstallallation - onSaveReadCreate: missing required props');
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const onSaveWrite = () => {
|
|
58
|
+
// check if fields with requirements are met
|
|
59
|
+
if (selectedObjectName && (selectedConnection === null || selectedConnection === void 0 ? void 0 : selectedConnection.id) && apiKey && projectId
|
|
60
|
+
&& integrationId && groupRef && consumerRef && hydratedRevision) {
|
|
61
|
+
setLoadingState(true);
|
|
62
|
+
const res = (0, onSaveWriteCreateInstallation_1.onSaveWriteCreateInstallation)(projectId, integrationId, groupRef, consumerRef, selectedConnection.id, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess);
|
|
63
|
+
res.finally(() => {
|
|
64
|
+
setLoadingState(false);
|
|
65
|
+
resetPendingConfigurationState(selectedObjectName); // reset write pending/isModified state
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
console.error('CreateInstallallation - onSaveWriteCreate: missing required props');
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
const onSave = (e) => {
|
|
73
|
+
e.preventDefault();
|
|
74
|
+
if (!isOtherSelected) {
|
|
75
|
+
onSaveRead();
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
onSaveWrite();
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return ((0, jsx_runtime_1.jsx)(ConfigureInstallationBase_1.ConfigureInstallationBase, { isCreateMode: true, isLoading: isLoading, onSave: onSave, onReset: resetState }));
|
|
82
|
+
}
|
|
83
|
+
exports.CreateInstallation = CreateInstallation;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function InstallationContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstallationContent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const InstallIntegrationContextProvider_1 = require("../../../context/InstallIntegrationContextProvider");
|
|
6
|
+
const ErrorTextBox_1 = require("../../ErrorTextBox");
|
|
7
|
+
const CreateInstallation_1 = require("./CreateInstallation");
|
|
8
|
+
const UpdateInstallation_1 = require("./UpdateInstallation");
|
|
9
|
+
function InstallationContent() {
|
|
10
|
+
const { integrationObj, installation } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
|
|
11
|
+
if (!integrationObj) {
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "We can't load the integration" });
|
|
13
|
+
}
|
|
14
|
+
return installation && integrationObj ? (
|
|
15
|
+
// If installation exists, render update installation flow
|
|
16
|
+
(0, jsx_runtime_1.jsx)(UpdateInstallation_1.UpdateInstallation, { installation: installation, integrationObj: integrationObj })) : (
|
|
17
|
+
// No installation, render create installation flow
|
|
18
|
+
(0, jsx_runtime_1.jsx)(CreateInstallation_1.CreateInstallation, {}));
|
|
19
|
+
}
|
|
20
|
+
exports.InstallationContent = InstallationContent;
|