@amp-labs/react 1.1.0 → 1.3.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/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 +102 -0
- package/build/generated-sources/api/src/apis/DestinationApi.js +126 -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 +196 -0
- package/build/generated-sources/api/src/apis/InstallationApi.js +235 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.d.ts +128 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.js +151 -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/BaseConfigContent.d.ts +7 -0
- package/build/generated-sources/api/src/models/BaseConfigContent.js +3 -0
- package/build/generated-sources/api/src/models/BaseProxyConfig.d.ts +31 -0
- package/build/generated-sources/api/src/models/BaseProxyConfig.js +50 -0
- package/build/generated-sources/api/src/models/ConfigContent.d.ts +7 -0
- package/build/generated-sources/api/src/models/ConfigContent.js +3 -0
- 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/HydratedIntegration.d.ts +7 -0
- package/build/generated-sources/api/src/models/HydratedIntegration.js +3 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationProxy.d.ts +31 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationProxy.js +50 -0
- package/build/generated-sources/api/src/models/ImportConnectionRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/Integration1.d.ts +7 -0
- package/build/generated-sources/api/src/models/Integration1.js +3 -0
- package/build/generated-sources/api/src/models/IntegrationProxy.d.ts +31 -0
- package/build/generated-sources/api/src/models/IntegrationProxy.js +50 -0
- package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +6 -6
- package/build/generated-sources/api/src/models/OauthConnectRequest.js +1 -2
- package/build/generated-sources/api/src/models/Operation.d.ts +26 -9
- package/build/generated-sources/api/src/models/Operation.js +14 -7
- 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/UpdateInstallationConfigContent.d.ts +7 -0
- package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.js +3 -0
- package/build/generated-sources/api/src/models/index.d.ts +6 -3
- package/build/generated-sources/api/src/models/index.js +6 -3
- package/build/src/assets/SuccessIcon.d.ts +1 -0
- package/build/src/assets/SuccessIcon.js +8 -0
- 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 +11 -23
- package/build/src/components/Configure/actions/createInstallationReducer.d.ts +15 -0
- package/build/src/components/Configure/actions/createInstallationReducer.js +30 -0
- package/build/src/components/Configure/actions/onSaveReadCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js} +13 -25
- 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/proxy/createInstallationProxyOnly.d.ts +8 -0
- package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.js +44 -0
- 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 +72 -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} +10 -9
- 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/layout/ConditionalProxyLayout/ConditionalProxyLayout.d.ts +11 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js +67 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.d.ts +5 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.js +11 -0
- package/build/src/components/Configure/{ProtectedConnectionLayout.d.ts → layout/ProtectedConnectionLayout.d.ts} +2 -1
- package/build/src/components/Configure/{ProtectedConnectionLayout.js → layout/ProtectedConnectionLayout.js} +13 -13
- 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/{Hubspot/HubspotLandingContent.js → NoSubdomainEntry/LandingContent.js} +5 -4
- package/build/src/components/Oauth/NoSubdomainEntry/NoSubdomainOauthFlow.d.ts +16 -0
- package/build/src/components/Oauth/{Hubspot/HubspotOauthFlow.js → NoSubdomainEntry/NoSubdomainOauthFlow.js} +14 -14
- package/build/src/components/{Connect → Oauth}/OAuthPopup.js +8 -10
- package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +5 -5
- package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +1 -1
- package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -1
- package/build/src/components/Oauth/fetchOAuthCallbackURL.js +3 -4
- 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/components/SuccessTextBox.d.ts +5 -0
- package/build/src/components/SuccessTextBox.js +10 -0
- 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 +26 -19
- package/package.json +2 -2
- package/build/generated-sources/api/src/apis/DefaultApi.d.ts +0 -930
- package/build/generated-sources/api/src/apis/DefaultApi.js +0 -1019
- 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/generated-sources/api/src/models/OperationError.d.ts +0 -49
- package/build/generated-sources/api/src/models/OperationError.js +0 -56
- 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 -53
- 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/Oauth/Hubspot/HubspotLandingContent.d.ts +0 -7
- package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.d.ts +0 -15
- 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
package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.js
RENAMED
|
@@ -3,29 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.OptionalFields = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("@chakra-ui/react");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const ConfigurationStateProvider_1 = require("../../state/ConfigurationStateProvider");
|
|
9
|
-
const utils_1 = require("../../state/utils");
|
|
10
|
-
const utils_2 = require("../../utils");
|
|
6
|
+
const utils_1 = require("../../../utils");
|
|
7
|
+
const useSelectedConfigureState_1 = require("../../useSelectedConfigureState");
|
|
11
8
|
const FieldHeader_1 = require("../FieldHeader");
|
|
12
9
|
const setOptionalField_1 = require("./setOptionalField");
|
|
13
10
|
function OptionalFields() {
|
|
14
|
-
var _a;
|
|
15
|
-
const { appName } = (0,
|
|
16
|
-
const
|
|
17
|
-
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
18
|
-
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
19
|
-
const { selectedOptionalFields } = configureState || {};
|
|
11
|
+
var _a, _b, _c, _d, _e;
|
|
12
|
+
const { appName, configureState, setConfigureState, selectedObjectName, } = (0, useSelectedConfigureState_1.useSelectedConfigureState)();
|
|
13
|
+
const selectedOptionalFields = (_a = configureState === null || configureState === void 0 ? void 0 : configureState.read) === null || _a === void 0 ? void 0 : _a.selectedOptionalFields;
|
|
20
14
|
const onCheckboxChange = (e) => {
|
|
21
15
|
const { name, checked } = e.target;
|
|
22
16
|
if (selectedObjectName && configureState) {
|
|
23
17
|
(0, setOptionalField_1.setOptionalField)(selectedObjectName, setConfigureState, name, checked);
|
|
24
18
|
}
|
|
25
19
|
};
|
|
26
|
-
const shouldRender = !!((configureState === null || configureState === void 0 ? void 0 : configureState.
|
|
27
|
-
|
|
28
|
-
|
|
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, height: 300, overflowY: "scroll", border: "2px solid #EFEFEF", borderRadius: 8, padding: 4, 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)) {
|
|
29
24
|
return ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "flex", gap: "5px", 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));
|
|
30
25
|
}
|
|
31
26
|
return null; // fallback for customed mapped fields
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Draft } from 'immer';
|
|
2
|
-
import { ConfigureState } from '
|
|
2
|
+
import { ConfigureState } from '../../../types';
|
|
3
3
|
export declare function setOptionalField(selectedObjectName: string, setConfigureState: (objectName: string, producer: (draft: Draft<ConfigureState>) => void) => void, fieldKey: string, checked: boolean): void;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setOptionalField = void 0;
|
|
4
|
+
const utils_1 = require("../../../state/utils");
|
|
5
|
+
function setOptionalFieldProducer(draft, fieldKey, checked) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
const draftSelectedOptionalFields = ((_a = draft === null || draft === void 0 ? void 0 : draft.read) === null || _a === void 0 ? void 0 : _a.selectedOptionalFields) || {};
|
|
8
|
+
draftSelectedOptionalFields[fieldKey] = checked;
|
|
9
|
+
if (!checked) {
|
|
10
|
+
delete draftSelectedOptionalFields[fieldKey];
|
|
11
|
+
}
|
|
12
|
+
if ((_b = draft.read) === null || _b === void 0 ? void 0 : _b.savedConfig.optionalFields) {
|
|
13
|
+
const savedFields = draft.read.savedConfig.optionalFields;
|
|
14
|
+
const updatedFields = draftSelectedOptionalFields;
|
|
15
|
+
const isModified = !(0, utils_1.isFieldObjectEqual)(savedFields, updatedFields);
|
|
16
|
+
// immer exception if we try to set a value
|
|
17
|
+
// eslint-disable-next-line no-param-reassign
|
|
18
|
+
draft.read.isOptionalFieldsModified = isModified;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
console.warn('read.savedConfig.optionalFields is undefined');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function setOptionalField(selectedObjectName, setConfigureState, fieldKey, checked) {
|
|
25
|
+
setConfigureState(selectedObjectName, (draft) => setOptionalFieldProducer(draft, fieldKey, checked));
|
|
26
|
+
}
|
|
27
|
+
exports.setOptionalField = setOptionalField;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function ReadFields(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ReadFields = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const FieldMappings_1 = require("./FieldMappings");
|
|
6
|
+
const OptionalFields_1 = require("./OptionalFields");
|
|
7
|
+
const RequiredFields_1 = require("./RequiredFields");
|
|
8
|
+
function ReadFields() {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(RequiredFields_1.RequiredFields, {}), (0, jsx_runtime_1.jsx)(FieldMappings_1.RequiredFieldMappings, {}), (0, jsx_runtime_1.jsx)(OptionalFields_1.OptionalFields, {})] }));
|
|
10
|
+
}
|
|
11
|
+
exports.ReadFields = ReadFields;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequiredFields = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@chakra-ui/react");
|
|
6
|
+
const ProjectContextProvider_1 = require("../../../../context/ProjectContextProvider");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
const useSelectedConfigureState_1 = require("../useSelectedConfigureState");
|
|
9
|
+
const FieldHeader_1 = require("./FieldHeader");
|
|
10
|
+
function RequiredFields() {
|
|
11
|
+
var _a, _b, _c;
|
|
12
|
+
const { configureState, selectedObjectName } = (0, useSelectedConfigureState_1.useSelectedConfigureState)();
|
|
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)
|
|
15
|
+
? ((_c = configureState.read) === null || _c === void 0 ? void 0 : _c.requiredFields.map((field) => {
|
|
16
|
+
if (!(0, utils_1.isIntegrationFieldMapping)(field)) {
|
|
17
|
+
return (0, jsx_runtime_1.jsx)(react_1.Tag, { children: field.displayName }, field.fieldName);
|
|
18
|
+
}
|
|
19
|
+
return null; // fallback for customed mapped fields
|
|
20
|
+
}))
|
|
21
|
+
: 'There are no required fields.' })] }));
|
|
22
|
+
}
|
|
23
|
+
exports.RequiredFields = RequiredFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function WriteFields(): false | import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WriteFields = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@chakra-ui/react");
|
|
6
|
+
const useSelectedConfigureState_1 = require("../../useSelectedConfigureState");
|
|
7
|
+
const FieldHeader_1 = require("../FieldHeader");
|
|
8
|
+
const setNonConfigurableWriteField_1 = require("./setNonConfigurableWriteField");
|
|
9
|
+
function WriteFields() {
|
|
10
|
+
var _a, _b, _c, _d;
|
|
11
|
+
const { appName, selectedObjectName, configureState, setConfigureState, } = (0, useSelectedConfigureState_1.useSelectedConfigureState)();
|
|
12
|
+
const selectedWriteFields = (_a = configureState === null || configureState === void 0 ? void 0 : configureState.write) === null || _a === void 0 ? void 0 : _a.selectedNonConfigurableWriteFields;
|
|
13
|
+
const onCheckboxChange = (e) => {
|
|
14
|
+
const { name, checked } = e.target;
|
|
15
|
+
if (selectedObjectName && configureState) {
|
|
16
|
+
(0, setNonConfigurableWriteField_1.setNonConfigurableWriteField)(selectedObjectName, setConfigureState, name, checked);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const shouldRender = !!((_b = configureState === null || configureState === void 0 ? void 0 : configureState.write) === null || _b === void 0 ? void 0 : _b.writeObjects);
|
|
20
|
+
return (shouldRender && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(FieldHeader_1.FieldHeader, { string: `Allow ${appName} to write to these object` }), (0, jsx_runtime_1.jsx)(react_1.Stack, { marginBottom: 10, height: 300, overflowY: "scroll", border: "2px solid #EFEFEF", borderRadius: 8, padding: 4, children: (_d = (_c = configureState === null || configureState === void 0 ? void 0 : configureState.write) === null || _c === void 0 ? void 0 : _c.writeObjects) === null || _d === void 0 ? void 0 : _d.map((field) => ((0, jsx_runtime_1.jsx)(react_1.Box, { display: "flex", gap: "5px", borderBottom: "1px", borderColor: "gray.100", children: (0, jsx_runtime_1.jsx)(react_1.Checkbox, { name: field.objectName, id: field.objectName, onChange: onCheckboxChange, isChecked: !!(selectedWriteFields === null || selectedWriteFields === void 0 ? void 0 : selectedWriteFields[field.objectName]), children: field.displayName }) }, field.objectName))) })] })));
|
|
21
|
+
}
|
|
22
|
+
exports.WriteFields = WriteFields;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WriteFields = void 0;
|
|
4
|
+
const WriteFields_1 = require("./WriteFields");
|
|
5
|
+
Object.defineProperty(exports, "WriteFields", { enumerable: true, get: function () { return WriteFields_1.WriteFields; } });
|
package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Draft } from 'immer';
|
|
2
|
+
import { ConfigureState } from '../../../types';
|
|
3
|
+
export declare function setNonConfigurableWriteField(selectedObjectName: string, setConfigureState: (objectName: string, producer: (draft: Draft<ConfigureState>) => void) => void, fieldKey: string, checked: boolean): void;
|
package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setNonConfigurableWriteField = void 0;
|
|
4
|
+
const utils_1 = require("../../../state/utils");
|
|
5
|
+
function setNonConfigurableWriteFieldProducer(draft, fieldKey, checked) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
if (((_a = draft === null || draft === void 0 ? void 0 : draft.write) === null || _a === void 0 ? void 0 : _a.selectedNonConfigurableWriteFields) === null) {
|
|
8
|
+
// immer syntax to set a value
|
|
9
|
+
// eslint-disable-next-line no-param-reassign
|
|
10
|
+
draft.write.selectedNonConfigurableWriteFields = {};
|
|
11
|
+
}
|
|
12
|
+
if (draft === null || draft === void 0 ? void 0 : draft.write) {
|
|
13
|
+
const draftSelectedWriteFields = draft.write.selectedNonConfigurableWriteFields;
|
|
14
|
+
draftSelectedWriteFields[fieldKey] = checked;
|
|
15
|
+
if (!checked) {
|
|
16
|
+
delete draftSelectedWriteFields[fieldKey];
|
|
17
|
+
}
|
|
18
|
+
// check is modified
|
|
19
|
+
if ((_c = (_b = draft === null || draft === void 0 ? void 0 : draft.write) === null || _b === void 0 ? void 0 : _b.savedConfig) === null || _c === void 0 ? void 0 : _c.selectedNonConfigurableWriteFields) {
|
|
20
|
+
const savedFields = draft.write.savedConfig.selectedNonConfigurableWriteFields;
|
|
21
|
+
const updatedFields = draftSelectedWriteFields;
|
|
22
|
+
const isModified = !(0, utils_1.isFieldObjectEqual)(savedFields, updatedFields);
|
|
23
|
+
// immer syntax to set a value
|
|
24
|
+
// eslint-disable-next-line no-param-reassign
|
|
25
|
+
draft.write.isWriteModified = isModified;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function setNonConfigurableWriteField(selectedObjectName, setConfigureState, fieldKey, checked) {
|
|
30
|
+
setConfigureState(selectedObjectName, (draft) => { setNonConfigurableWriteFieldProducer(draft, fieldKey, checked); });
|
|
31
|
+
}
|
|
32
|
+
exports.setNonConfigurableWriteField = setNonConfigurableWriteField;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* state hook for installation flows (Create/Update)
|
|
3
|
+
* */
|
|
4
|
+
export declare const useMutateInstallation: () => {
|
|
5
|
+
integrationId: string;
|
|
6
|
+
groupRef: string;
|
|
7
|
+
consumerRef: string;
|
|
8
|
+
setInstallation: (installationObj: import("../../../services/api").Installation) => void;
|
|
9
|
+
hydratedRevision: import("../../../services/api").HydratedRevision | null;
|
|
10
|
+
loading: boolean;
|
|
11
|
+
selectedObjectName: string | undefined;
|
|
12
|
+
selectedConnection: import("../../../services/api").Connection | null;
|
|
13
|
+
apiKey: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
resetBoundary: (boundary: import("../../../context/ErrorContextProvider").ErrorBoundary) => void;
|
|
16
|
+
setErrors: (boundary: import("../../../context/ErrorContextProvider").ErrorBoundary, keys: string[]) => void;
|
|
17
|
+
resetConfigureState: (objectName: string, configureState: import("../types").ConfigureState) => void;
|
|
18
|
+
objectConfigurationsState: import("../types").ObjectConfigurationsState;
|
|
19
|
+
resetPendingConfigurationState: (objectName: string) => void;
|
|
20
|
+
configureState: import("../types").ConfigureState;
|
|
21
|
+
onInstallSuccess: ((installationId: string, config: import("../../../services/api").Config) => void) | undefined;
|
|
22
|
+
onUpdateSuccess: ((installationId: string, config: import("../../../services/api").Config) => void) | undefined;
|
|
23
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useMutateInstallation = void 0;
|
|
4
|
+
const ApiKeyContextProvider_1 = require("../../../context/ApiKeyContextProvider");
|
|
5
|
+
const ConnectionsContextProvider_1 = require("../../../context/ConnectionsContextProvider");
|
|
6
|
+
const ErrorContextProvider_1 = require("../../../context/ErrorContextProvider");
|
|
7
|
+
const InstallIntegrationContextProvider_1 = require("../../../context/InstallIntegrationContextProvider");
|
|
8
|
+
const ProjectContextProvider_1 = require("../../../context/ProjectContextProvider");
|
|
9
|
+
const ObjectManagementNav_1 = require("../nav/ObjectManagementNav");
|
|
10
|
+
const ConfigurationStateProvider_1 = require("../state/ConfigurationStateProvider");
|
|
11
|
+
const HydratedRevisionContext_1 = require("../state/HydratedRevisionContext");
|
|
12
|
+
const utils_1 = require("../state/utils");
|
|
13
|
+
/**
|
|
14
|
+
* state hook for installation flows (Create/Update)
|
|
15
|
+
* */
|
|
16
|
+
const useMutateInstallation = () => {
|
|
17
|
+
const { integrationId, groupRef, consumerRef, setInstallation, onInstallSuccess, onUpdateSuccess, } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
|
|
18
|
+
const { hydratedRevision, loading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
19
|
+
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
20
|
+
const { selectedConnection } = (0, ConnectionsContextProvider_1.useConnections)();
|
|
21
|
+
const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
|
|
22
|
+
const { projectId } = (0, ProjectContextProvider_1.useProject)();
|
|
23
|
+
const { resetBoundary, setErrors } = (0, ErrorContextProvider_1.useErrorState)();
|
|
24
|
+
const { resetConfigureState, objectConfigurationsState, resetPendingConfigurationState, } = (0, ConfigurationStateProvider_1.useObjectsConfigureState)();
|
|
25
|
+
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
26
|
+
return {
|
|
27
|
+
integrationId,
|
|
28
|
+
groupRef,
|
|
29
|
+
consumerRef,
|
|
30
|
+
setInstallation,
|
|
31
|
+
hydratedRevision,
|
|
32
|
+
loading,
|
|
33
|
+
selectedObjectName,
|
|
34
|
+
selectedConnection,
|
|
35
|
+
apiKey,
|
|
36
|
+
projectId,
|
|
37
|
+
resetBoundary,
|
|
38
|
+
setErrors,
|
|
39
|
+
resetConfigureState,
|
|
40
|
+
objectConfigurationsState,
|
|
41
|
+
resetPendingConfigurationState,
|
|
42
|
+
configureState,
|
|
43
|
+
onInstallSuccess,
|
|
44
|
+
onUpdateSuccess,
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
exports.useMutateInstallation = useMutateInstallation;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @returns {object} configureState for the selected object in nav
|
|
4
|
+
*/
|
|
5
|
+
export declare const useSelectedConfigureState: () => {
|
|
6
|
+
appName: string;
|
|
7
|
+
configureState: import("../types").ConfigureState;
|
|
8
|
+
setConfigureState: (objectName: string, producer: (draft: {
|
|
9
|
+
read: {
|
|
10
|
+
allFields: {
|
|
11
|
+
fieldName: string;
|
|
12
|
+
displayName: string;
|
|
13
|
+
}[] | null;
|
|
14
|
+
requiredFields: ({
|
|
15
|
+
fieldName: string;
|
|
16
|
+
displayName: string;
|
|
17
|
+
} | {
|
|
18
|
+
mapToName: string;
|
|
19
|
+
mapToDisplayName?: string | undefined;
|
|
20
|
+
_default?: string | undefined;
|
|
21
|
+
prompt?: string | undefined;
|
|
22
|
+
})[] | null;
|
|
23
|
+
optionalFields: ({
|
|
24
|
+
fieldName: string;
|
|
25
|
+
displayName: string;
|
|
26
|
+
} | {
|
|
27
|
+
mapToName: string;
|
|
28
|
+
mapToDisplayName?: string | undefined;
|
|
29
|
+
_default?: string | undefined;
|
|
30
|
+
prompt?: string | undefined;
|
|
31
|
+
})[] | null;
|
|
32
|
+
requiredMapFields: {
|
|
33
|
+
mapToName: string;
|
|
34
|
+
mapToDisplayName?: string | undefined;
|
|
35
|
+
_default?: string | undefined;
|
|
36
|
+
prompt?: string | undefined;
|
|
37
|
+
}[] | null;
|
|
38
|
+
selectedOptionalFields: {
|
|
39
|
+
[x: string]: boolean;
|
|
40
|
+
} | null;
|
|
41
|
+
selectedFieldMappings: {
|
|
42
|
+
[x: string]: string | undefined;
|
|
43
|
+
} | null;
|
|
44
|
+
isOptionalFieldsModified: boolean;
|
|
45
|
+
isRequiredMapFieldsModified: boolean;
|
|
46
|
+
savedConfig: {
|
|
47
|
+
optionalFields: {
|
|
48
|
+
[x: string]: boolean;
|
|
49
|
+
};
|
|
50
|
+
requiredMapFields: {
|
|
51
|
+
[x: string]: string | undefined;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
} | null;
|
|
55
|
+
write: {
|
|
56
|
+
writeObjects: {
|
|
57
|
+
objectName: string;
|
|
58
|
+
displayName: string;
|
|
59
|
+
}[] | null;
|
|
60
|
+
selectedNonConfigurableWriteFields: {
|
|
61
|
+
[x: string]: boolean;
|
|
62
|
+
} | null;
|
|
63
|
+
isWriteModified: boolean;
|
|
64
|
+
savedConfig: {
|
|
65
|
+
selectedNonConfigurableWriteFields: {
|
|
66
|
+
[x: string]: boolean;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
} | null;
|
|
70
|
+
}) => void) => void;
|
|
71
|
+
selectedObjectName: string | undefined;
|
|
72
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSelectedConfigureState = void 0;
|
|
4
|
+
const ProjectContextProvider_1 = require("../../../context/ProjectContextProvider");
|
|
5
|
+
const ObjectManagementNav_1 = require("../nav/ObjectManagementNav");
|
|
6
|
+
const ConfigurationStateProvider_1 = require("../state/ConfigurationStateProvider");
|
|
7
|
+
const utils_1 = require("../state/utils");
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @returns {object} configureState for the selected object in nav
|
|
11
|
+
*/
|
|
12
|
+
const useSelectedConfigureState = () => {
|
|
13
|
+
const { appName } = (0, ProjectContextProvider_1.useProject)();
|
|
14
|
+
const { objectConfigurationsState, setConfigureState } = (0, ConfigurationStateProvider_1.useObjectsConfigureState)();
|
|
15
|
+
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
16
|
+
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
17
|
+
return {
|
|
18
|
+
appName,
|
|
19
|
+
configureState,
|
|
20
|
+
setConfigureState,
|
|
21
|
+
selectedObjectName,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.useSelectedConfigureState = useSelectedConfigureState;
|
package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface ConditionalProxyLayoutProps {
|
|
3
|
+
children: React.ReactNode;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* if the hydratedRevision only has proxy actions,
|
|
7
|
+
* then it will not render the ConfigureInstallation
|
|
8
|
+
* @returns
|
|
9
|
+
*/
|
|
10
|
+
export declare function ConditionalProxyLayout({ children }: ConditionalProxyLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConditionalProxyLayout = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const LoadingIcon_1 = require("../../../../assets/LoadingIcon");
|
|
7
|
+
const ApiKeyContextProvider_1 = require("../../../../context/ApiKeyContextProvider");
|
|
8
|
+
const ConnectionsContextProvider_1 = require("../../../../context/ConnectionsContextProvider");
|
|
9
|
+
const InstallIntegrationContextProvider_1 = require("../../../../context/InstallIntegrationContextProvider");
|
|
10
|
+
const ProjectContextProvider_1 = require("../../../../context/ProjectContextProvider");
|
|
11
|
+
const ErrorTextBox_1 = require("../../../ErrorTextBox");
|
|
12
|
+
const createInstallationProxyOnly_1 = require("../../actions/proxy/createInstallationProxyOnly");
|
|
13
|
+
const HydratedRevisionContext_1 = require("../../state/HydratedRevisionContext");
|
|
14
|
+
const InstalledSuccessBox_1 = require("./InstalledSuccessBox");
|
|
15
|
+
// explicity check other actions (i.e. read, write) to determine if it's proxy only
|
|
16
|
+
// returns false if it's not proxy only or no hydratedRevision
|
|
17
|
+
const getIsProxyOnly = (hydratedRevision) => {
|
|
18
|
+
var _a;
|
|
19
|
+
const { read, write, proxy } = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) !== null && _a !== void 0 ? _a : {};
|
|
20
|
+
return (!read && !write && (proxy === null || proxy === void 0 ? void 0 : proxy.enabled)) || false;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* if the hydratedRevision only has proxy actions,
|
|
24
|
+
* then it will not render the ConfigureInstallation
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
function ConditionalProxyLayout({ children }) {
|
|
28
|
+
var _a;
|
|
29
|
+
const { projectId } = (0, ProjectContextProvider_1.useProject)();
|
|
30
|
+
const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
|
|
31
|
+
const { hydratedRevision, loading: hydratedRevisionLoading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
32
|
+
const { integrationObj, installation, groupRef, consumerRef, setInstallation, } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
|
|
33
|
+
const { selectedConnection } = (0, ConnectionsContextProvider_1.useConnections)();
|
|
34
|
+
const [createInstallLoading, setCreateInstallLoading] = (0, react_1.useState)(false);
|
|
35
|
+
const isLoading = hydratedRevisionLoading || createInstallLoading;
|
|
36
|
+
const provider = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.provider;
|
|
37
|
+
const isProxyOnly = getIsProxyOnly(hydratedRevision);
|
|
38
|
+
(0, react_1.useEffect)(() => {
|
|
39
|
+
if (hydratedRevision && isProxyOnly && !installation && selectedConnection && apiKey && (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id)) {
|
|
40
|
+
setCreateInstallLoading(true);
|
|
41
|
+
(0, createInstallationProxyOnly_1.createInstallationProxyOnly)({
|
|
42
|
+
apiKey,
|
|
43
|
+
projectId,
|
|
44
|
+
integrationId: integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id,
|
|
45
|
+
groupRef,
|
|
46
|
+
consumerRef,
|
|
47
|
+
connectionId: selectedConnection === null || selectedConnection === void 0 ? void 0 : selectedConnection.id,
|
|
48
|
+
hydratedRevision,
|
|
49
|
+
setInstallation,
|
|
50
|
+
}).then(() => {
|
|
51
|
+
setCreateInstallLoading(false);
|
|
52
|
+
}).catch((e) => {
|
|
53
|
+
setCreateInstallLoading(false);
|
|
54
|
+
console.error('Error when creating proxy installation:', e);
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}, [hydratedRevision, isProxyOnly, installation,
|
|
58
|
+
selectedConnection, apiKey, projectId, integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id, groupRef, consumerRef, setInstallation]);
|
|
59
|
+
if (!integrationObj)
|
|
60
|
+
return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "We can't load the integration" });
|
|
61
|
+
if (isLoading)
|
|
62
|
+
return (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {});
|
|
63
|
+
if (isProxyOnly && provider && installation)
|
|
64
|
+
return (0, jsx_runtime_1.jsx)(InstalledSuccessBox_1.InstalledSuccessBox, { provider: provider });
|
|
65
|
+
return ((0, jsx_runtime_1.jsx)("div", { children: children }));
|
|
66
|
+
}
|
|
67
|
+
exports.ConditionalProxyLayout = ConditionalProxyLayout;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstalledSuccessBox = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const utils_1 = require("../../../../utils");
|
|
6
|
+
const SuccessTextBox_1 = require("../../../SuccessTextBox");
|
|
7
|
+
function InstalledSuccessBox({ provider }) {
|
|
8
|
+
const text = `You have successfully installed your ${(0, utils_1.capitalize)(provider)} integration.`;
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(SuccessTextBox_1.SuccessTextBox, { text: text }));
|
|
10
|
+
}
|
|
11
|
+
exports.InstalledSuccessBox = InstalledSuccessBox;
|
|
@@ -5,7 +5,8 @@ interface ProtectedConnectionLayoutProps {
|
|
|
5
5
|
consumerName?: string;
|
|
6
6
|
groupRef: string;
|
|
7
7
|
groupName?: string;
|
|
8
|
+
onSuccess?: (connectionID: string) => void;
|
|
8
9
|
children: JSX.Element;
|
|
9
10
|
}
|
|
10
|
-
export declare function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupRef, groupName, children, }: ProtectedConnectionLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupRef, groupName, children, onSuccess, }: ProtectedConnectionLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -3,32 +3,32 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.ProtectedConnectionLayout = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const constants_1 = require("
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const constants_1 = require("../../../constants");
|
|
7
|
+
const ConnectionsContextProvider_1 = require("../../../context/ConnectionsContextProvider");
|
|
8
|
+
const InstallIntegrationContextProvider_1 = require("../../../context/InstallIntegrationContextProvider");
|
|
9
|
+
const useConnectionHandler_1 = require("../../Connect/useConnectionHandler");
|
|
10
|
+
const NoSubdomainOauthFlow_1 = require("../../Oauth/NoSubdomainEntry/NoSubdomainOauthFlow");
|
|
11
|
+
const SalesforceOauthFlow_1 = require("../../Oauth/Salesforce/SalesforceOauthFlow");
|
|
12
|
+
function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupRef, groupName, children, onSuccess, }) {
|
|
13
|
+
const { provider: providerFromProps } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
|
|
14
|
+
const { selectedConnection, setSelectedConnection, connections } = (0, ConnectionsContextProvider_1.useConnections)();
|
|
15
|
+
(0, useConnectionHandler_1.useConnectionHandler)({ onSuccess });
|
|
13
16
|
(0, react_1.useEffect)(() => {
|
|
14
17
|
if (!selectedConnection && connections && connections.length > 0) {
|
|
15
18
|
const [connection] = connections;
|
|
16
19
|
setSelectedConnection(connection);
|
|
17
20
|
}
|
|
18
21
|
}, [connections, selectedConnection, setSelectedConnection]);
|
|
19
|
-
const { provider: providerFromProps } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
20
22
|
if (!provider && !providerFromProps) {
|
|
21
23
|
throw new Error('ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider');
|
|
22
24
|
}
|
|
23
25
|
// a selected connection exists, render children
|
|
24
26
|
if (selectedConnection)
|
|
25
27
|
return children;
|
|
26
|
-
|
|
28
|
+
const selectedProvider = provider || providerFromProps;
|
|
29
|
+
if (selectedProvider === constants_1.PROVIDER_SALESFORCE) {
|
|
27
30
|
return ((0, jsx_runtime_1.jsx)(SalesforceOauthFlow_1.SalesforceOauthFlow, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
|
|
28
31
|
}
|
|
29
|
-
|
|
30
|
-
return ((0, jsx_runtime_1.jsx)(HubspotOauthFlow_1.HubspotOauthFlow, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
|
|
31
|
-
}
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)("div", { children: "Unsupported provider" }));
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(NoSubdomainOauthFlow_1.NoSubdomainOauthFlow, { provider: selectedProvider, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
|
|
33
33
|
}
|
|
34
34
|
exports.ProtectedConnectionLayout = ProtectedConnectionLayout;
|
|
@@ -3,6 +3,7 @@ interface NavObjectItemProps {
|
|
|
3
3
|
objectName: string;
|
|
4
4
|
completed: boolean;
|
|
5
5
|
pending?: boolean;
|
|
6
|
+
displayName?: string;
|
|
6
7
|
}
|
|
7
8
|
export declare const NavObjectItem: import("react").ForwardRefExoticComponent<NavObjectItemProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
8
9
|
export {};
|
|
@@ -4,11 +4,11 @@ exports.NavObjectItem = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_2 = require("@chakra-ui/react");
|
|
7
|
-
const NavIcon_1 = require("
|
|
8
|
-
exports.NavObjectItem = (0, react_1.forwardRef)(({ objectName, completed, pending }, ref) => {
|
|
7
|
+
const NavIcon_1 = require("../../../../assets/NavIcon");
|
|
8
|
+
exports.NavObjectItem = (0, react_1.forwardRef)(({ objectName, completed, pending, displayName, }, ref) => {
|
|
9
9
|
// 1. Reuse the `useTab` hook
|
|
10
10
|
const tabProps = (0, react_2.useTab)({ ref });
|
|
11
11
|
// 2. Hook into the Tabs `size`, `variant`, props
|
|
12
12
|
const styles = (0, react_2.useMultiStyleConfig)('Tabs', tabProps);
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Button, Object.assign({ __css: styles.tab }, tabProps, { variant: "outline", minHeight: 15, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { as: "span", display: "flex", alignItems: "center", gap: 2, mr: "3", children: [(0, NavIcon_1.NavIcon)(completed, pending), (0, jsx_runtime_1.jsxs)(react_2.Box, { textAlign: "left", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { children: objectName }), pending && (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: 10, fontStyle: "italic", children: "pending" })] })] }), tabProps.children] })));
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Button, Object.assign({ __css: styles.tab }, tabProps, { variant: "outline", minHeight: 15, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { as: "span", display: "flex", alignItems: "center", gap: 2, mr: "3", children: [(0, NavIcon_1.NavIcon)(completed, pending), (0, jsx_runtime_1.jsxs)(react_2.Box, { textAlign: "left", children: [(0, jsx_runtime_1.jsx)(react_2.Text, { children: displayName || objectName }), pending && (0, jsx_runtime_1.jsx)(react_2.Text, { fontSize: 10, fontStyle: "italic", children: "pending" })] })] }), tabProps.children] })));
|
|
14
14
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OtherTab = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("@chakra-ui/react");
|
|
6
|
+
const constant_1 = require("./constant");
|
|
7
|
+
const NavObjectItem_1 = require("./NavObjectItem");
|
|
8
|
+
function OtherTab({ pending, completed, displayName }) {
|
|
9
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_1.Divider, { marginY: 3 }), (0, jsx_runtime_1.jsx)(NavObjectItem_1.NavObjectItem, { objectName: constant_1.OTHER_CONST, completed: completed, pending: pending, displayName: displayName }, "other-write")] }));
|
|
10
|
+
}
|
|
11
|
+
exports.OtherTab = OtherTab;
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
interface NavObjectItemProps {
|
|
3
3
|
text?: string;
|
|
4
4
|
}
|
|
5
|
-
export declare const UNINSTALL_INSTALLATION_CONST = "uninstall-
|
|
5
|
+
export declare const UNINSTALL_INSTALLATION_CONST = "uninstall-installation";
|
|
6
6
|
export declare const UninstallInstallation: import("react").ForwardRefExoticComponent<NavObjectItemProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
7
|
export {};
|
|
@@ -4,8 +4,8 @@ exports.UninstallInstallation = exports.UNINSTALL_INSTALLATION_CONST = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
6
|
const react_2 = require("@chakra-ui/react");
|
|
7
|
-
const TrashIcon_1 = require("
|
|
8
|
-
exports.UNINSTALL_INSTALLATION_CONST = 'uninstall-
|
|
7
|
+
const TrashIcon_1 = require("../../../../assets/TrashIcon");
|
|
8
|
+
exports.UNINSTALL_INSTALLATION_CONST = 'uninstall-installation';
|
|
9
9
|
exports.UninstallInstallation = (0, react_1.forwardRef)(({ text = 'Uninstall' }, ref) => {
|
|
10
10
|
// 1. Reuse the `useTab` hook
|
|
11
11
|
const tabProps = (0, react_2.useTab)({ ref });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const OTHER_CONST = "other";
|