@amp-labs/react 1.1.0 → 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/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/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/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} +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/{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/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/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 +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/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
|
@@ -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;
|
|
@@ -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";
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ObjectManagementNav = exports.useSelectedObjectName = exports.SelectedObjectNameContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const react_2 = require("@chakra-ui/react");
|
|
7
|
+
const InstallIntegrationContextProvider_1 = require("../../../../context/InstallIntegrationContextProvider");
|
|
8
|
+
const ProjectContextProvider_1 = require("../../../../context/ProjectContextProvider");
|
|
9
|
+
const utils_1 = require("../../../../utils");
|
|
10
|
+
const ConfigurationStateProvider_1 = require("../../state/ConfigurationStateProvider");
|
|
11
|
+
const HydratedRevisionContext_1 = require("../../state/HydratedRevisionContext");
|
|
12
|
+
const utils_2 = require("../../utils");
|
|
13
|
+
const NavObjectItem_1 = require("./NavObjectItem");
|
|
14
|
+
const OtherTab_1 = require("./OtherTab");
|
|
15
|
+
const UninstallInstallation_1 = require("./UninstallInstallation");
|
|
16
|
+
// Create a context for the selected navObject's name
|
|
17
|
+
exports.SelectedObjectNameContext = (0, react_1.createContext)(null);
|
|
18
|
+
// Custom hook to access the selected navObject's name
|
|
19
|
+
function useSelectedObjectName() {
|
|
20
|
+
const selectedNavObjectName = (0, react_1.useContext)(exports.SelectedObjectNameContext);
|
|
21
|
+
if (selectedNavObjectName === null) {
|
|
22
|
+
throw new Error('useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider');
|
|
23
|
+
}
|
|
24
|
+
return { selectedObjectName: selectedNavObjectName }; // Return as an object
|
|
25
|
+
}
|
|
26
|
+
exports.useSelectedObjectName = useSelectedObjectName;
|
|
27
|
+
function getSelectedObject(navObjects, tabIndex) {
|
|
28
|
+
if (navObjects === null || navObjects === void 0 ? void 0 : navObjects[tabIndex]) {
|
|
29
|
+
// read tabs
|
|
30
|
+
return navObjects[tabIndex];
|
|
31
|
+
}
|
|
32
|
+
// uninstall tab
|
|
33
|
+
return { name: UninstallInstallation_1.UNINSTALL_INSTALLATION_CONST, completed: false };
|
|
34
|
+
}
|
|
35
|
+
// note: when the object key exists in the config; the user has already completed the object before
|
|
36
|
+
function ObjectManagementNav({ children, }) {
|
|
37
|
+
var _a, _b, _c;
|
|
38
|
+
const { project } = (0, ProjectContextProvider_1.useProject)();
|
|
39
|
+
const { installation, provider } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
|
|
40
|
+
const { hydratedRevision } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
41
|
+
const { objectConfigurationsState } = (0, ConfigurationStateProvider_1.useObjectsConfigureState)();
|
|
42
|
+
// Object Nav Tab Index
|
|
43
|
+
const [tabIndex, setTabIndex] = (0, react_1.useState)(0);
|
|
44
|
+
const appName = (project === null || project === void 0 ? void 0 : project.appName) || '';
|
|
45
|
+
const config = installation === null || installation === void 0 ? void 0 : installation.config;
|
|
46
|
+
const readNavObjects = hydratedRevision && (0, utils_2.generateNavObjects)(config, hydratedRevision);
|
|
47
|
+
const isNavObjectsReady = readNavObjects !== null; // null = hydratedRevision/config is not ready
|
|
48
|
+
const isWriteSupported = !!((_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.write);
|
|
49
|
+
const otherNavObject = isWriteSupported ? (0, utils_2.generateOtherNavObject)(config) : undefined;
|
|
50
|
+
const allNavObjects = [...(readNavObjects || [])];
|
|
51
|
+
if (otherNavObject && isWriteSupported) {
|
|
52
|
+
allNavObjects.push(otherNavObject);
|
|
53
|
+
}
|
|
54
|
+
const selectedObject = getSelectedObject(allNavObjects, tabIndex);
|
|
55
|
+
return ((0, jsx_runtime_1.jsx)(exports.SelectedObjectNameContext.Provider, { value: selectedObject === null || selectedObject === void 0 ? void 0 : selectedObject.name, children: (0, jsx_runtime_1.jsxs)(react_2.Box, { p: 8, maxWidth: "55rem", border: "1px solid #EFEFEF", borderRadius: 6, boxShadow: "md", margin: "auto", bgColor: "whitesmoke", display: "flex", gap: "6", minHeight: "100%", children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { width: "20rem", children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { children: [(0, utils_1.capitalize)(provider), " integration"] }), (0, jsx_runtime_1.jsx)(react_2.Text, { marginBottom: "20px", fontSize: "1.125rem", fontWeight: "500", children: appName }), isNavObjectsReady && ((0, jsx_runtime_1.jsxs)(react_2.Tabs, { index: tabIndex, onChange: setTabIndex, orientation: "horizontal", children: [readNavObjects.map((object) => {
|
|
56
|
+
var _a, _b, _c, _d;
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(NavObjectItem_1.NavObjectItem, { objectName: object.name, completed: object.completed, pending: ((_b = (_a = objectConfigurationsState[object.name]) === null || _a === void 0 ? void 0 : _a.read) === null || _b === void 0 ? void 0 : _b.isOptionalFieldsModified)
|
|
58
|
+
|| ((_d = (_c = objectConfigurationsState[object.name]) === null || _c === void 0 ? void 0 : _c.read) === null || _d === void 0 ? void 0 : _d.isRequiredMapFieldsModified) }, object.name));
|
|
59
|
+
}), isWriteSupported && otherNavObject && ((0, jsx_runtime_1.jsx)(OtherTab_1.OtherTab, { completed: otherNavObject.completed, pending: (_c = (_b = objectConfigurationsState === null || objectConfigurationsState === void 0 ? void 0 : objectConfigurationsState.other) === null || _b === void 0 ? void 0 : _b.write) === null || _c === void 0 ? void 0 : _c.isWriteModified, displayName: (readNavObjects === null || readNavObjects === void 0 ? void 0 : readNavObjects.length) ? 'other' : 'write' })), installation && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Divider, { marginTop: 10, marginBottom: 3 }), (0, jsx_runtime_1.jsx)(UninstallInstallation_1.UninstallInstallation, { text: "Uninstall" }, "uninstall-installation")] }))] }))] }), children] }) }));
|
|
60
|
+
}
|
|
61
|
+
exports.ObjectManagementNav = ObjectManagementNav;
|
|
@@ -1,53 +1,81 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { Draft } from 'immer';
|
|
2
3
|
import { ConfigureState, ObjectConfigurationsState } from '../types';
|
|
3
|
-
export declare
|
|
4
|
+
export declare const ConfigurationContext: React.Context<{
|
|
5
|
+
objectConfigurationsState: ObjectConfigurationsState;
|
|
6
|
+
setObjectConfigurationsState: React.Dispatch<React.SetStateAction<ObjectConfigurationsState>>;
|
|
7
|
+
setConfigureState: (objectName: string, producer: (draft: Draft<ConfigureState>) => void) => void;
|
|
8
|
+
resetConfigureState: (objectName: string, configureState: ConfigureState) => void;
|
|
9
|
+
resetPendingConfigurationState: (objectName: string) => void;
|
|
10
|
+
} | undefined>;
|
|
11
|
+
/**
|
|
12
|
+
* Custom hook to access and update the configuration state for all objects
|
|
13
|
+
*/
|
|
14
|
+
export declare function useObjectsConfigureState(): {
|
|
4
15
|
objectConfigurationsState: ObjectConfigurationsState;
|
|
5
16
|
setObjectConfigurationsState: React.Dispatch<React.SetStateAction<ObjectConfigurationsState>>;
|
|
6
17
|
setConfigureState: (objectName: string, producer: (draft: {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
mapToName: string;
|
|
31
|
-
mapToDisplayName?: string | undefined;
|
|
32
|
-
_default?: string | undefined;
|
|
33
|
-
prompt?: string | undefined;
|
|
34
|
-
}[] | null;
|
|
35
|
-
selectedOptionalFields: {
|
|
36
|
-
[x: string]: boolean;
|
|
37
|
-
} | null;
|
|
38
|
-
selectedFieldMappings: {
|
|
39
|
-
[x: string]: string | undefined;
|
|
40
|
-
} | null;
|
|
41
|
-
isOptionalFieldsModified: boolean;
|
|
42
|
-
isRequiredMapFieldsModified: boolean;
|
|
43
|
-
savedConfig: {
|
|
44
|
-
optionalFields: {
|
|
45
|
-
[x: string]: boolean;
|
|
46
|
-
};
|
|
18
|
+
read: {
|
|
19
|
+
allFields: {
|
|
20
|
+
fieldName: string;
|
|
21
|
+
displayName: string;
|
|
22
|
+
}[] | null;
|
|
23
|
+
requiredFields: ({
|
|
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
|
+
optionalFields: ({
|
|
33
|
+
fieldName: string;
|
|
34
|
+
displayName: string;
|
|
35
|
+
} | {
|
|
36
|
+
mapToName: string;
|
|
37
|
+
mapToDisplayName?: string | undefined;
|
|
38
|
+
_default?: string | undefined;
|
|
39
|
+
prompt?: string | undefined;
|
|
40
|
+
})[] | null;
|
|
47
41
|
requiredMapFields: {
|
|
42
|
+
mapToName: string;
|
|
43
|
+
mapToDisplayName?: string | undefined;
|
|
44
|
+
_default?: string | undefined;
|
|
45
|
+
prompt?: string | undefined;
|
|
46
|
+
}[] | null;
|
|
47
|
+
selectedOptionalFields: {
|
|
48
|
+
[x: string]: boolean;
|
|
49
|
+
} | null;
|
|
50
|
+
selectedFieldMappings: {
|
|
48
51
|
[x: string]: string | undefined;
|
|
52
|
+
} | null;
|
|
53
|
+
isOptionalFieldsModified: boolean;
|
|
54
|
+
isRequiredMapFieldsModified: boolean;
|
|
55
|
+
savedConfig: {
|
|
56
|
+
optionalFields: {
|
|
57
|
+
[x: string]: boolean;
|
|
58
|
+
};
|
|
59
|
+
requiredMapFields: {
|
|
60
|
+
[x: string]: string | undefined;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
} | null;
|
|
64
|
+
write: {
|
|
65
|
+
writeObjects: {
|
|
66
|
+
objectName: string;
|
|
67
|
+
displayName: string;
|
|
68
|
+
}[] | null;
|
|
69
|
+
selectedNonConfigurableWriteFields: {
|
|
70
|
+
[x: string]: boolean;
|
|
71
|
+
} | null;
|
|
72
|
+
isWriteModified: boolean;
|
|
73
|
+
savedConfig: {
|
|
74
|
+
selectedNonConfigurableWriteFields: {
|
|
75
|
+
[x: string]: boolean;
|
|
76
|
+
};
|
|
49
77
|
};
|
|
50
|
-
};
|
|
78
|
+
} | null;
|
|
51
79
|
}) => void) => void;
|
|
52
80
|
resetConfigureState: (objectName: string, configureState: ConfigureState) => void;
|
|
53
81
|
resetPendingConfigurationState: (objectName: string) => void;
|