@amp-labs/react 1.0.1 → 1.1.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/DefaultApi.d.ts +78 -6
- package/build/generated-sources/api/src/apis/DefaultApi.js +80 -3
- package/build/generated-sources/api/src/models/BaseConfigContent.d.ts +8 -1
- package/build/generated-sources/api/src/models/BaseConfigContent.js +4 -1
- package/build/generated-sources/api/src/models/BaseReadConfig.d.ts +1 -1
- package/build/generated-sources/api/src/models/BaseReadConfig.js +1 -1
- package/build/generated-sources/api/src/models/BaseReadConfigStandardObject.d.ts +2 -2
- package/build/generated-sources/api/src/models/BaseReadConfigStandardObject.js +1 -1
- package/build/generated-sources/api/src/models/BaseWriteConfig.d.ts +34 -0
- package/build/generated-sources/api/src/models/BaseWriteConfig.js +51 -0
- package/build/generated-sources/api/src/models/BaseWriteConfigObject.d.ts +31 -0
- package/build/generated-sources/api/src/models/BaseWriteConfigObject.js +50 -0
- package/build/generated-sources/api/src/models/BatchUpsertIntegrationsRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/BatchUpsertIntegrationsRequest.js +1 -1
- package/build/generated-sources/api/src/models/Config.d.ts +1 -1
- package/build/generated-sources/api/src/models/Config.js +1 -1
- package/build/generated-sources/api/src/models/ConfigContent.d.ts +7 -1
- package/build/generated-sources/api/src/models/ConfigContent.js +3 -1
- package/build/generated-sources/api/src/models/ConfigContentAllOf.d.ts +7 -1
- package/build/generated-sources/api/src/models/ConfigContentAllOf.js +3 -1
- package/build/generated-sources/api/src/models/Connection.d.ts +1 -1
- package/build/generated-sources/api/src/models/Connection.js +1 -1
- package/build/generated-sources/api/src/models/Consumer.d.ts +1 -1
- package/build/generated-sources/api/src/models/Consumer.js +1 -1
- package/build/generated-sources/api/src/models/CreateConsumerRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateConsumerRequest.js +1 -1
- package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateDestinationRequest.js +1 -1
- package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.js +1 -1
- package/build/generated-sources/api/src/models/CreateGroupRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateGroupRequest.js +1 -1
- package/build/generated-sources/api/src/models/CreateInstallationRequest.d.ts +3 -3
- package/build/generated-sources/api/src/models/CreateInstallationRequest.js +3 -3
- package/build/generated-sources/api/src/models/CreateInstallationRequestConfig.d.ts +4 -4
- package/build/generated-sources/api/src/models/CreateInstallationRequestConfig.js +4 -5
- package/build/generated-sources/api/src/models/CreateIntegrationRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateIntegrationRequest.js +1 -1
- package/build/generated-sources/api/src/models/CreateIntegrationRequestLatestRevision.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateIntegrationRequestLatestRevision.js +1 -1
- package/build/generated-sources/api/src/models/CreateProjectRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/CreateProjectRequest.js +1 -1
- package/build/generated-sources/api/src/models/CreateProviderAppRequest.d.ts +7 -1
- package/build/generated-sources/api/src/models/CreateProviderAppRequest.js +3 -1
- package/build/generated-sources/api/src/models/Group.d.ts +1 -1
- package/build/generated-sources/api/src/models/Group.js +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegration.d.ts +8 -1
- package/build/generated-sources/api/src/models/HydratedIntegration.js +4 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationField.d.ts +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationField.js +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationFieldExistent.d.ts +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationFieldExistent.js +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationObject.d.ts +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationObject.js +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationRead.d.ts +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationRead.js +1 -1
- package/build/generated-sources/api/src/models/HydratedIntegrationWrite.d.ts +32 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationWrite.js +51 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationWriteObject.d.ts +37 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationWriteObject.js +53 -0
- package/build/generated-sources/api/src/models/HydratedRevision.d.ts +1 -1
- package/build/generated-sources/api/src/models/HydratedRevision.js +1 -1
- package/build/generated-sources/api/src/models/ImportConnectionRequest.d.ts +1 -7
- package/build/generated-sources/api/src/models/ImportConnectionRequest.js +1 -4
- package/build/generated-sources/api/src/models/ImportInstallationRequest.d.ts +7 -1
- package/build/generated-sources/api/src/models/ImportInstallationRequest.js +4 -1
- package/build/generated-sources/api/src/models/ImportInstallationRequestConfig.d.ts +1 -1
- package/build/generated-sources/api/src/models/ImportInstallationRequestConfig.js +1 -1
- package/build/generated-sources/api/src/models/Installation.d.ts +1 -1
- package/build/generated-sources/api/src/models/Installation.js +1 -1
- package/build/generated-sources/api/src/models/Integration.d.ts +1 -1
- package/build/generated-sources/api/src/models/Integration.js +1 -1
- package/build/generated-sources/api/src/models/Integration1.d.ts +8 -1
- package/build/generated-sources/api/src/models/Integration1.js +4 -1
- package/build/generated-sources/api/src/models/IntegrationField.d.ts +1 -1
- package/build/generated-sources/api/src/models/IntegrationField.js +1 -1
- package/build/generated-sources/api/src/models/IntegrationFieldExistent.d.ts +1 -1
- package/build/generated-sources/api/src/models/IntegrationFieldExistent.js +1 -1
- package/build/generated-sources/api/src/models/IntegrationFieldMapping.d.ts +1 -1
- package/build/generated-sources/api/src/models/IntegrationFieldMapping.js +1 -1
- package/build/generated-sources/api/src/models/IntegrationObject.d.ts +1 -1
- package/build/generated-sources/api/src/models/IntegrationObject.js +1 -1
- package/build/generated-sources/api/src/models/IntegrationRead.d.ts +1 -1
- package/build/generated-sources/api/src/models/IntegrationRead.js +1 -1
- package/build/generated-sources/api/src/models/IntegrationWrite.d.ts +32 -0
- package/build/generated-sources/api/src/models/IntegrationWrite.js +51 -0
- package/build/generated-sources/api/src/models/IntegrationWriteObject.d.ts +31 -0
- package/build/generated-sources/api/src/models/IntegrationWriteObject.js +50 -0
- package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +2 -2
- package/build/generated-sources/api/src/models/OauthConnectRequest.js +2 -3
- package/build/generated-sources/api/src/models/Operation.d.ts +7 -13
- package/build/generated-sources/api/src/models/Operation.js +4 -7
- package/build/generated-sources/api/src/models/OperationError.d.ts +1 -1
- package/build/generated-sources/api/src/models/OperationError.js +1 -1
- package/build/generated-sources/api/src/models/OptionalFieldsAutoOption.d.ts +1 -1
- package/build/generated-sources/api/src/models/OptionalFieldsAutoOption.js +1 -1
- package/build/generated-sources/api/src/models/Project.d.ts +1 -1
- package/build/generated-sources/api/src/models/Project.js +1 -1
- package/build/generated-sources/api/src/models/ProjectMembership.d.ts +1 -1
- package/build/generated-sources/api/src/models/ProjectMembership.js +1 -1
- package/build/generated-sources/api/src/models/ProviderApp.d.ts +1 -1
- package/build/generated-sources/api/src/models/ProviderApp.js +1 -1
- package/build/generated-sources/api/src/models/Revision.d.ts +1 -1
- package/build/generated-sources/api/src/models/Revision.js +1 -1
- package/build/generated-sources/api/src/models/SignedUrl.d.ts +43 -0
- package/build/generated-sources/api/src/models/SignedUrl.js +56 -0
- package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.d.ts +8 -1
- package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.js +4 -1
- package/build/generated-sources/api/src/models/UpdateInstallationRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpdateInstallationRequest.js +1 -1
- package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallation.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallation.js +1 -1
- package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallationConfig.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallationConfig.js +1 -1
- package/build/generated-sources/api/src/models/UpdateProjectRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpdateProjectRequest.js +1 -1
- package/build/generated-sources/api/src/models/UpdateProjectRequestProject.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpdateProjectRequestProject.js +1 -1
- package/build/generated-sources/api/src/models/UpdateProviderAppRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpdateProviderAppRequest.js +1 -1
- package/build/generated-sources/api/src/models/UpdateProviderAppRequestProviderApp.d.ts +7 -1
- package/build/generated-sources/api/src/models/UpdateProviderAppRequestProviderApp.js +3 -1
- package/build/generated-sources/api/src/models/UpsertProjectMembershipRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/UpsertProjectMembershipRequest.js +1 -1
- package/build/generated-sources/api/src/models/index.d.ts +7 -0
- package/build/generated-sources/api/src/models/index.js +7 -0
- package/build/generated-sources/api/src/runtime.d.ts +1 -1
- package/build/generated-sources/api/src/runtime.js +1 -1
- package/build/src/assets/NavIcon.d.ts +1 -0
- package/build/src/assets/NavIcon.js +3 -2
- package/build/src/assets/TrashIcon.d.ts +1 -0
- package/build/src/assets/TrashIcon.js +9 -0
- package/build/src/components/AmpersandProvider/AmpersandProvider.js +2 -2
- package/build/src/components/Configure/ConfigureInstallationBase.js +14 -2
- package/build/src/components/Configure/CreateInstallation.js +11 -14
- package/build/src/components/Configure/InstallIntegration.js +1 -2
- package/build/src/components/Configure/ObjectManagementNav/UninstallInstallation.d.ts +7 -0
- package/build/src/components/Configure/ObjectManagementNav/UninstallInstallation.js +15 -0
- package/build/src/components/Configure/ObjectManagementNav/index.js +17 -9
- package/build/src/components/Configure/ProtectedConnectionLayout.d.ts +7 -2
- package/build/src/components/Configure/ProtectedConnectionLayout.js +15 -9
- package/build/src/components/Configure/UninstallContent.d.ts +1 -0
- package/build/src/components/Configure/UninstallContent.js +44 -0
- package/build/src/components/Configure/UpdateInstallation.js +10 -21
- package/build/src/components/Configure/fields/{FieldMapping.d.ts → FieldMappings/FieldMapping.d.ts} +2 -3
- package/build/src/components/Configure/fields/{FieldMapping.js → FieldMappings/FieldMapping.js} +12 -11
- package/build/src/components/Configure/fields/{RequiredFieldMappings.js → FieldMappings/RequiredFieldMappings.js} +9 -9
- package/build/src/components/Configure/fields/FieldMappings/index.d.ts +3 -0
- package/build/src/components/Configure/fields/FieldMappings/index.js +7 -0
- package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.d.ts +3 -0
- package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.js +18 -0
- package/build/src/components/Configure/fields/{OptionalFields.js → OptionalFields/OptionalFields.js} +8 -19
- package/build/src/components/Configure/fields/OptionalFields/index.d.ts +2 -0
- package/build/src/components/Configure/fields/OptionalFields/index.js +5 -0
- package/build/src/components/Configure/fields/OptionalFields/setOptionalField.d.ts +3 -0
- package/build/src/components/Configure/fields/OptionalFields/setOptionalField.js +21 -0
- package/build/src/components/Configure/state/ConfigurationStateProvider.d.ts +47 -1
- package/build/src/components/Configure/state/ConfigurationStateProvider.js +28 -6
- package/build/src/components/Configure/state/HydratedRevisionContext.js +3 -6
- package/build/src/components/Configure/state/utils.d.ts +4 -16
- package/build/src/components/Configure/state/utils.js +28 -63
- package/build/src/components/Configure/types.d.ts +6 -9
- package/build/src/components/Configure/utils.d.ts +6 -4
- package/build/src/components/Configure/utils.js +17 -16
- package/build/src/components/Connect/ConnectProvider.d.ts +9 -0
- package/build/src/components/Connect/ConnectProvider.js +18 -0
- package/build/src/components/{OAuthPopup → Connect}/OAuthPopup.js +3 -3
- package/build/src/components/Oauth/Hubspot/HubspotLandingContent.d.ts +7 -0
- package/build/src/components/Oauth/Hubspot/HubspotLandingContent.js +10 -0
- package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.d.ts +15 -0
- package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.js +50 -0
- package/build/src/components/Oauth/OAuthErrorAlert.d.ts +5 -0
- package/build/src/components/Oauth/OAuthErrorAlert.js +12 -0
- package/build/src/components/{Salesforce → Oauth/Salesforce}/SalesforceOauthFlow.d.ts +2 -2
- package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +57 -0
- package/build/src/components/Oauth/Salesforce/SubdomainEntry.d.ts +8 -0
- package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +12 -0
- package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -0
- package/build/src/components/Oauth/fetchOAuthCallbackURL.js +29 -0
- package/build/src/components/ThemeProvider/Button/buttonTheme.d.ts +13 -0
- package/build/src/components/ThemeProvider/Button/buttonTheme.js +17 -0
- package/build/src/components/ThemeProvider/Button/index.d.ts +2 -0
- package/build/src/components/ThemeProvider/Button/index.js +5 -0
- package/build/src/components/ThemeProvider/index.js +21 -0
- package/build/src/components/index.d.ts +1 -0
- package/build/src/components/index.js +1 -0
- package/build/src/constants.d.ts +1 -0
- package/build/src/constants.js +2 -1
- package/build/src/context/{ApiKeyContext.d.ts → ApiKeyProvider.d.ts} +1 -0
- package/build/src/context/ApiKeyProvider.js +14 -0
- package/build/src/context/ConnectionsContext.d.ts +5 -4
- package/build/src/context/ConnectionsContext.js +13 -5
- package/build/src/context/InstallIntegrationContext.d.ts +1 -0
- package/build/src/context/InstallIntegrationContext.js +15 -10
- package/build/src/context/IntegrationListContext.js +3 -3
- package/build/src/context/ProjectContext.js +3 -3
- package/build/src/hooks/useIsIntegrationInstalled.js +2 -2
- package/package.json +3 -2
- package/build/src/components/Salesforce/SalesforceOauthFlow.js +0 -78
- package/build/src/context/ApiKeyContext.js +0 -6
- /package/build/src/components/Configure/fields/{RequiredFieldMappings.d.ts → FieldMappings/RequiredFieldMappings.d.ts} +0 -0
- /package/build/src/components/Configure/fields/{OptionalFields.d.ts → OptionalFields/OptionalFields.d.ts} +0 -0
- /package/build/src/components/{OAuthPopup → Connect}/OAuthPopup.d.ts +0 -0
|
@@ -19,6 +19,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
__exportStar(require("./BaseConfigContent"), exports);
|
|
20
20
|
__exportStar(require("./BaseReadConfig"), exports);
|
|
21
21
|
__exportStar(require("./BaseReadConfigStandardObject"), exports);
|
|
22
|
+
__exportStar(require("./BaseWriteConfig"), exports);
|
|
23
|
+
__exportStar(require("./BaseWriteConfigObject"), exports);
|
|
22
24
|
__exportStar(require("./BatchUpsertIntegrationsRequest"), exports);
|
|
23
25
|
__exportStar(require("./Config"), exports);
|
|
24
26
|
__exportStar(require("./ConfigContent"), exports);
|
|
@@ -41,6 +43,8 @@ __exportStar(require("./HydratedIntegrationField"), exports);
|
|
|
41
43
|
__exportStar(require("./HydratedIntegrationFieldExistent"), exports);
|
|
42
44
|
__exportStar(require("./HydratedIntegrationObject"), exports);
|
|
43
45
|
__exportStar(require("./HydratedIntegrationRead"), exports);
|
|
46
|
+
__exportStar(require("./HydratedIntegrationWrite"), exports);
|
|
47
|
+
__exportStar(require("./HydratedIntegrationWriteObject"), exports);
|
|
44
48
|
__exportStar(require("./HydratedRevision"), exports);
|
|
45
49
|
__exportStar(require("./ImportConnectionRequest"), exports);
|
|
46
50
|
__exportStar(require("./ImportInstallationRequest"), exports);
|
|
@@ -53,6 +57,8 @@ __exportStar(require("./IntegrationFieldExistent"), exports);
|
|
|
53
57
|
__exportStar(require("./IntegrationFieldMapping"), exports);
|
|
54
58
|
__exportStar(require("./IntegrationObject"), exports);
|
|
55
59
|
__exportStar(require("./IntegrationRead"), exports);
|
|
60
|
+
__exportStar(require("./IntegrationWrite"), exports);
|
|
61
|
+
__exportStar(require("./IntegrationWriteObject"), exports);
|
|
56
62
|
__exportStar(require("./OauthConnectRequest"), exports);
|
|
57
63
|
__exportStar(require("./Operation"), exports);
|
|
58
64
|
__exportStar(require("./OperationError"), exports);
|
|
@@ -61,6 +67,7 @@ __exportStar(require("./Project"), exports);
|
|
|
61
67
|
__exportStar(require("./ProjectMembership"), exports);
|
|
62
68
|
__exportStar(require("./ProviderApp"), exports);
|
|
63
69
|
__exportStar(require("./Revision"), exports);
|
|
70
|
+
__exportStar(require("./SignedUrl"), exports);
|
|
64
71
|
__exportStar(require("./UpdateInstallationConfigContent"), exports);
|
|
65
72
|
__exportStar(require("./UpdateInstallationRequest"), exports);
|
|
66
73
|
__exportStar(require("./UpdateInstallationRequestInstallation"), exports);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Ampersand public API
|
|
3
3
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
4
4
|
*
|
|
5
|
-
* The version of the OpenAPI document:
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
6
|
*
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Ampersand public API
|
|
6
6
|
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
7
|
*
|
|
8
|
-
* The version of the OpenAPI document:
|
|
8
|
+
* The version of the OpenAPI document: 1.0.0
|
|
9
9
|
*
|
|
10
10
|
*
|
|
11
11
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
@@ -3,9 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.NavIcon = void 0;
|
|
6
|
+
exports.NavIcon = exports.CheckMarkIcon = void 0;
|
|
7
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const react_1 = __importDefault(require("react"));
|
|
9
|
+
exports.CheckMarkIcon = ((0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "9", r: "9", fill: "#BBF7D0" }), (0, jsx_runtime_1.jsx)("path", { d: "M13 7L7.5 12L5 9.72727", stroke: "#16A34A", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
9
10
|
function NavIcon(completed, pending) {
|
|
10
11
|
if (pending) {
|
|
11
12
|
return (react_1.default.createElement('svg', {
|
|
@@ -15,7 +16,7 @@ function NavIcon(completed, pending) {
|
|
|
15
16
|
})));
|
|
16
17
|
}
|
|
17
18
|
if (completed) {
|
|
18
|
-
return
|
|
19
|
+
return exports.CheckMarkIcon;
|
|
19
20
|
}
|
|
20
21
|
// default to empty icon
|
|
21
22
|
return ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", children: (0, jsx_runtime_1.jsx)("circle", { cx: "9", cy: "9", r: "5", fill: "#BFDBFE" }) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TrashIcon(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrashIcon = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
// red.800 trash icon
|
|
6
|
+
function TrashIcon() {
|
|
7
|
+
return ((0, jsx_runtime_1.jsxs)("svg", { width: "18", height: "18", viewBox: "0 0 18 18", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", { d: "M2.25 4.5H3.75H15.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M7.5 8.25V12.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M10.5 8.25V12.75", stroke: "#991B1B", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })] }));
|
|
8
|
+
}
|
|
9
|
+
exports.TrashIcon = TrashIcon;
|
|
@@ -9,14 +9,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
9
9
|
* Also optionally accepts theme styles object with CSS values.
|
|
10
10
|
*/
|
|
11
11
|
const react_1 = require("react");
|
|
12
|
-
const
|
|
12
|
+
const ApiKeyProvider_1 = require("../../context/ApiKeyProvider");
|
|
13
13
|
const ErrorContextProvider_1 = require("../../context/ErrorContextProvider");
|
|
14
14
|
const IntegrationListContext_1 = require("../../context/IntegrationListContext");
|
|
15
15
|
const ProjectContext_1 = require("../../context/ProjectContext");
|
|
16
16
|
const ThemeProvider_1 = require("../ThemeProvider");
|
|
17
17
|
function AmpersandProvider(props) {
|
|
18
18
|
const { options: { apiKey, projectId }, children } = props;
|
|
19
|
-
return ((0, jsx_runtime_1.jsx)(ThemeProvider_1.ThemeProvider, { children: (0, jsx_runtime_1.jsx)(ErrorContextProvider_1.ErrorStateProvider, { children: (0, jsx_runtime_1.jsx)(
|
|
19
|
+
return ((0, jsx_runtime_1.jsx)(ThemeProvider_1.ThemeProvider, { children: (0, jsx_runtime_1.jsx)(ErrorContextProvider_1.ErrorStateProvider, { children: (0, jsx_runtime_1.jsx)(ApiKeyProvider_1.ApiKeyProvider, { value: apiKey, children: (0, jsx_runtime_1.jsx)(ProjectContext_1.ProjectProvider, { projectId: projectId, children: (0, jsx_runtime_1.jsx)(IntegrationListContext_1.IntegrationListProvider, { projectId: projectId, children: children }) }) }) }) }));
|
|
20
20
|
}
|
|
21
21
|
exports.AmpersandProvider = AmpersandProvider;
|
|
22
22
|
exports.AmpersandContext = (0, react_1.createContext)(null);
|
|
@@ -4,14 +4,26 @@ exports.ConfigureInstallationBase = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("@chakra-ui/react");
|
|
6
6
|
const LoadingIcon_1 = require("../../assets/LoadingIcon");
|
|
7
|
+
const FieldMappings_1 = require("./fields/FieldMappings");
|
|
7
8
|
const OptionalFields_1 = require("./fields/OptionalFields");
|
|
8
|
-
const RequiredFieldMappings_1 = require("./fields/RequiredFieldMappings");
|
|
9
9
|
const RequiredFields_1 = require("./fields/RequiredFields");
|
|
10
|
+
const UninstallInstallation_1 = require("./ObjectManagementNav/UninstallInstallation");
|
|
11
|
+
const ConfigurationStateProvider_1 = require("./state/ConfigurationStateProvider");
|
|
10
12
|
const HydratedRevisionContext_1 = require("./state/HydratedRevisionContext");
|
|
13
|
+
const utils_1 = require("./state/utils");
|
|
14
|
+
const ObjectManagementNav_1 = require("./ObjectManagementNav");
|
|
15
|
+
const UninstallContent_1 = require("./UninstallContent");
|
|
11
16
|
// Installation UI Base
|
|
12
17
|
function ConfigureInstallationBase({ onSave, onReset, isLoading }) {
|
|
13
18
|
const { hydratedRevision, loading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
19
|
+
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
20
|
+
const { objectConfigurationsState } = (0, ConfigurationStateProvider_1.useConfigureState)();
|
|
21
|
+
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
22
|
+
const isPending = (configureState === null || configureState === void 0 ? void 0 : configureState.isOptionalFieldsModified)
|
|
23
|
+
|| (configureState === null || configureState === void 0 ? void 0 : configureState.isRequiredMapFieldsModified);
|
|
24
|
+
const isDisabled = loading || isLoading || !configureState || !selectedObjectName || !isPending;
|
|
25
|
+
const isUninstall = selectedObjectName === UninstallInstallation_1.UNINSTALL_INSTALLATION_CONST;
|
|
14
26
|
return (isLoading ? (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {})
|
|
15
|
-
: ((0, jsx_runtime_1.jsxs)("form", { style: { width: '100%', maxWidth: '50rem' }, onSubmit: onSave, children: [(0, jsx_runtime_1.jsxs)(react_1.Stack, { direction: "row", spacing: 4, marginBottom: "20px", flexDir: "row-reverse", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { backgroundColor: "gray.800", _hover: { backgroundColor: 'gray.600' }, type: "submit", isDisabled:
|
|
27
|
+
: ((0, jsx_runtime_1.jsxs)("form", { style: { width: '100%', maxWidth: '50rem' }, onSubmit: onSave, children: [(0, jsx_runtime_1.jsxs)(react_1.Stack, { direction: "row", spacing: 4, marginBottom: "20px", flexDir: "row-reverse", children: [(0, jsx_runtime_1.jsx)(react_1.Button, { backgroundColor: "gray.800", _hover: { backgroundColor: 'gray.600' }, type: "submit", isDisabled: isDisabled, children: "Save" }), (0, jsx_runtime_1.jsx)(react_1.Button, { backgroundColor: "gray.200", color: "blackAlpha.700", _hover: { backgroundColor: 'gray.300' }, isDisabled: isDisabled, onClick: onReset, children: "Reset" })] }), (0, jsx_runtime_1.jsxs)(react_1.Box, { p: 8, width: "100%", border: "1px solid #EFEFEF", borderRadius: 8, boxShadow: "md", textAlign: ['left'], margin: "auto", bgColor: "white", maxHeight: "100%", overflowY: "scroll", children: [loading && (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {}), hydratedRevision && !isUninstall && ((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, {})] })), !loading && isUninstall && (0, jsx_runtime_1.jsx)(UninstallContent_1.UninstallContent, {})] })] })));
|
|
16
28
|
}
|
|
17
29
|
exports.ConfigureInstallationBase = ConfigureInstallationBase;
|
|
@@ -6,7 +6,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
* this page is wip: untested
|
|
7
7
|
*/
|
|
8
8
|
const react_1 = require("react");
|
|
9
|
-
const
|
|
9
|
+
const ApiKeyProvider_1 = require("../../context/ApiKeyProvider");
|
|
10
10
|
const ConnectionsContext_1 = require("../../context/ConnectionsContext");
|
|
11
11
|
const ErrorContextProvider_1 = require("../../context/ErrorContextProvider");
|
|
12
12
|
const InstallIntegrationContext_1 = require("../../context/InstallIntegrationContext");
|
|
@@ -17,6 +17,7 @@ const HydratedRevisionContext_1 = require("./state/HydratedRevisionContext");
|
|
|
17
17
|
const utils_1 = require("./state/utils");
|
|
18
18
|
const ConfigureInstallationBase_1 = require("./ConfigureInstallationBase");
|
|
19
19
|
const ObjectManagementNav_1 = require("./ObjectManagementNav");
|
|
20
|
+
const utils_2 = require("./utils");
|
|
20
21
|
// the config should be undefined for create flow
|
|
21
22
|
const UNDEFINED_CONFIG = undefined;
|
|
22
23
|
// Create Installation Flow
|
|
@@ -25,18 +26,18 @@ function CreateInstallation() {
|
|
|
25
26
|
const { hydratedRevision, loading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
26
27
|
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
27
28
|
const { selectedConnection } = (0, ConnectionsContext_1.useConnections)();
|
|
28
|
-
const apiKey = (0,
|
|
29
|
+
const apiKey = (0, ApiKeyProvider_1.useApiKey)();
|
|
29
30
|
const { projectId } = (0, ProjectContext_1.useProject)();
|
|
30
31
|
const { resetBoundary, setErrors } = (0, ErrorContextProvider_1.useErrorState)();
|
|
31
|
-
const {
|
|
32
|
+
const { resetConfigureState, objectConfigurationsState, resetPendingConfigurationState, } = (0, ConfigurationStateProvider_1.useConfigureState)();
|
|
32
33
|
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
33
34
|
const [isLoading, setLoadingState] = (0, react_1.useState)(false);
|
|
34
35
|
const resetState = (0, react_1.useCallback)(() => {
|
|
35
36
|
resetBoundary(ErrorContextProvider_1.ErrorBoundary.MAPPING);
|
|
36
37
|
if ((hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) && !loading && selectedObjectName) {
|
|
37
|
-
(0, utils_1.
|
|
38
|
+
(0, utils_1.setHydrateConfigState)(hydratedRevision, UNDEFINED_CONFIG, selectedObjectName, resetConfigureState);
|
|
38
39
|
}
|
|
39
|
-
}, [hydratedRevision, loading, selectedObjectName,
|
|
40
|
+
}, [resetBoundary, hydratedRevision, loading, selectedObjectName, resetConfigureState]);
|
|
40
41
|
(0, react_1.useEffect)(() => {
|
|
41
42
|
// set configurationState when hydratedRevision is loaded
|
|
42
43
|
if (!configureState && (hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) && !loading) {
|
|
@@ -45,16 +46,12 @@ function CreateInstallation() {
|
|
|
45
46
|
}, [configureState, objectConfigurationsState, hydratedRevision, loading, resetState]);
|
|
46
47
|
const onSave = (e) => {
|
|
47
48
|
e.preventDefault();
|
|
48
|
-
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
setErrors(ErrorContextProvider_1.ErrorBoundary.MAPPING, errList);
|
|
53
|
-
// if requires fields are not met, set error fields and return
|
|
54
|
-
if (fieldsWithRequirementsNotMet === null || fieldsWithRequirementsNotMet === void 0 ? void 0 : fieldsWithRequirementsNotMet.length) {
|
|
55
|
-
console.error('required fields not met', fieldsWithRequirementsNotMet.map((field) => field.mapToDisplayName));
|
|
49
|
+
// check if fields with requirements are met
|
|
50
|
+
const { requiredMapFields, selectedFieldMappings } = configureState || {};
|
|
51
|
+
const { errorList } = (0, utils_2.validateFieldMappings)(requiredMapFields, selectedFieldMappings, setErrors);
|
|
52
|
+
if (errorList.length > 0) {
|
|
56
53
|
return;
|
|
57
|
-
}
|
|
54
|
+
} // skip if there are errors
|
|
58
55
|
if (selectedObjectName && (selectedConnection === null || selectedConnection === void 0 ? void 0 : selectedConnection.id) && apiKey && projectId
|
|
59
56
|
&& integrationId && groupRef && consumerRef && hydratedRevision) {
|
|
60
57
|
setLoadingState(true);
|
|
@@ -25,7 +25,6 @@ function InstallationContent() {
|
|
|
25
25
|
// No installation, render create installation flow
|
|
26
26
|
(0, jsx_runtime_1.jsx)(CreateInstallation_1.CreateInstallation, {}));
|
|
27
27
|
}
|
|
28
|
-
// TODO consider creating an integration obj context
|
|
29
28
|
function InstallIntegration({ integration, consumerRef, consumerName, groupRef, groupName, }) {
|
|
30
29
|
var _a;
|
|
31
30
|
const { projectId } = (0, ProjectContext_1.useProject)();
|
|
@@ -35,6 +34,6 @@ function InstallIntegration({ integration, consumerRef, consumerName, groupRef,
|
|
|
35
34
|
}
|
|
36
35
|
return (
|
|
37
36
|
// install integration provider provides all props, integrationObj and installation
|
|
38
|
-
(0, jsx_runtime_1.jsx)(InstallIntegrationContext_1.InstallIntegrationProvider, { integration: integration, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, children: (0, jsx_runtime_1.jsx)(ConnectionsContext_1.ConnectionsProvider, {
|
|
37
|
+
(0, jsx_runtime_1.jsx)(InstallIntegrationContext_1.InstallIntegrationProvider, { integration: integration, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, children: (0, jsx_runtime_1.jsx)(ConnectionsContext_1.ConnectionsProvider, { groupRef: groupRef, children: (0, jsx_runtime_1.jsx)(ProtectedConnectionLayout_1.ProtectedConnectionLayout, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, children: (0, jsx_runtime_1.jsx)(HydratedRevisionContext_1.HydratedRevisionProvider, { projectId: projectId, children: (0, jsx_runtime_1.jsx)(ConfigurationStateProvider_1.ConfigurationProvider, { children: (0, jsx_runtime_1.jsx)(ObjectManagementNav_1.ObjectManagementNav, { children: (0, jsx_runtime_1.jsx)(InstallationContent, {}) }) }) }) }) }) }));
|
|
39
38
|
}
|
|
40
39
|
exports.InstallIntegration = InstallIntegration;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
interface NavObjectItemProps {
|
|
3
|
+
text?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const UNINSTALL_INSTALLATION_CONST = "uninstall-intallation";
|
|
6
|
+
export declare const UninstallInstallation: import("react").ForwardRefExoticComponent<NavObjectItemProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UninstallInstallation = exports.UNINSTALL_INSTALLATION_CONST = 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 TrashIcon_1 = require("../../../assets/TrashIcon");
|
|
8
|
+
exports.UNINSTALL_INSTALLATION_CONST = 'uninstall-intallation';
|
|
9
|
+
exports.UninstallInstallation = (0, react_1.forwardRef)(({ text = 'Uninstall' }, ref) => {
|
|
10
|
+
// 1. Reuse the `useTab` hook
|
|
11
|
+
const tabProps = (0, react_2.useTab)({ ref });
|
|
12
|
+
// 2. Hook into the Tabs `size`, `variant`, props
|
|
13
|
+
const styles = (0, react_2.useMultiStyleConfig)('Tabs', tabProps);
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Button, Object.assign({ __css: styles.warningTab }, tabProps, { minHeight: 15, children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { as: "span", display: "flex", alignItems: "center", gap: 2, my: 2, mx: 4, children: [(0, TrashIcon_1.TrashIcon)(), (0, jsx_runtime_1.jsx)(react_2.Box, { textAlign: "left", children: (0, jsx_runtime_1.jsx)(react_2.Text, { color: "red.800", children: text }) })] }), tabProps.children] })));
|
|
15
|
+
});
|
|
@@ -6,10 +6,12 @@ const react_1 = require("react");
|
|
|
6
6
|
const react_2 = require("@chakra-ui/react");
|
|
7
7
|
const InstallIntegrationContext_1 = require("../../../context/InstallIntegrationContext");
|
|
8
8
|
const ProjectContext_1 = require("../../../context/ProjectContext");
|
|
9
|
+
const utils_1 = require("../../../utils");
|
|
9
10
|
const ConfigurationStateProvider_1 = require("../state/ConfigurationStateProvider");
|
|
10
11
|
const HydratedRevisionContext_1 = require("../state/HydratedRevisionContext");
|
|
11
|
-
const
|
|
12
|
+
const utils_2 = require("../utils");
|
|
12
13
|
const NavObjectItem_1 = require("./NavObjectItem");
|
|
14
|
+
const UninstallInstallation_1 = require("./UninstallInstallation");
|
|
13
15
|
// Create a context for the selected navObject's name
|
|
14
16
|
const SelectedObjectNameContext = (0, react_1.createContext)(null);
|
|
15
17
|
// Custom hook to access the selected navObject's name
|
|
@@ -22,24 +24,30 @@ function useSelectedObjectName() {
|
|
|
22
24
|
}
|
|
23
25
|
exports.useSelectedObjectName = useSelectedObjectName;
|
|
24
26
|
function getSelectedObject(navObjects, tabIndex) {
|
|
25
|
-
|
|
27
|
+
if (navObjects === null || navObjects === void 0 ? void 0 : navObjects[tabIndex]) {
|
|
28
|
+
return navObjects[tabIndex];
|
|
29
|
+
}
|
|
30
|
+
if (tabIndex > navObjects.length - 1) {
|
|
31
|
+
return { name: UninstallInstallation_1.UNINSTALL_INSTALLATION_CONST, completed: false };
|
|
32
|
+
}
|
|
33
|
+
return undefined;
|
|
26
34
|
}
|
|
27
35
|
// note: when the object key exists in the config; the user has already completed the object before
|
|
28
36
|
function ObjectManagementNav({ children, }) {
|
|
29
|
-
const { installation } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
37
|
+
const { installation, provider } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
30
38
|
const { hydratedRevision } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
31
39
|
const { objectConfigurationsState } = (0, ConfigurationStateProvider_1.useConfigureState)();
|
|
32
40
|
const config = installation === null || installation === void 0 ? void 0 : installation.config;
|
|
33
|
-
const navObjects = hydratedRevision && (0,
|
|
41
|
+
const navObjects = hydratedRevision && (0, utils_2.generateNavObjects)(config, hydratedRevision);
|
|
34
42
|
const [tabIndex, setTabIndex] = (0, react_1.useState)(0);
|
|
35
43
|
const handleTabsChange = (index) => { setTabIndex(index); };
|
|
36
44
|
const selectedObject = getSelectedObject(navObjects || [], tabIndex);
|
|
37
45
|
const { project } = (0, ProjectContext_1.useProject)();
|
|
38
46
|
const appName = (project === null || project === void 0 ? void 0 : project.appName) || '';
|
|
39
|
-
return ((0, jsx_runtime_1.jsx)(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.
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
47
|
+
return ((0, jsx_runtime_1.jsx)(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 }), navObjects && ((0, jsx_runtime_1.jsxs)(react_2.Tabs, { index: tabIndex, onChange: handleTabsChange, orientation: "horizontal", children: [navObjects.map((object) => {
|
|
48
|
+
var _a, _b;
|
|
49
|
+
return ((0, jsx_runtime_1.jsx)(NavObjectItem_1.NavObjectItem, { objectName: object.name, completed: object.completed, pending: ((_a = objectConfigurationsState[object.name]) === null || _a === void 0 ? void 0 : _a.isOptionalFieldsModified)
|
|
50
|
+
|| ((_b = objectConfigurationsState[object.name]) === null || _b === void 0 ? void 0 : _b.isRequiredMapFieldsModified) }, object.name));
|
|
51
|
+
}), installation && ((0, jsx_runtime_1.jsx)(UninstallInstallation_1.UninstallInstallation, { text: "Uninstall" }, "uninstall-intallation"))] }))] }), children] }) }));
|
|
44
52
|
}
|
|
45
53
|
exports.ObjectManagementNav = ObjectManagementNav;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
interface
|
|
2
|
+
interface ProtectedConnectionLayoutProps {
|
|
3
|
+
provider?: string;
|
|
4
|
+
consumerRef: string;
|
|
5
|
+
consumerName?: string;
|
|
6
|
+
groupRef: string;
|
|
7
|
+
groupName?: string;
|
|
3
8
|
children: JSX.Element;
|
|
4
9
|
}
|
|
5
|
-
export declare function ProtectedConnectionLayout({ children }:
|
|
10
|
+
export declare function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupRef, groupName, children, }: ProtectedConnectionLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
6
11
|
export {};
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.ProtectedConnectionLayout = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
5
|
const react_1 = require("react");
|
|
6
|
+
const constants_1 = require("../../constants");
|
|
9
7
|
const ConnectionsContext_1 = require("../../context/ConnectionsContext");
|
|
10
8
|
const InstallIntegrationContext_1 = require("../../context/InstallIntegrationContext");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
function ProtectedConnectionLayout({ children }) {
|
|
14
|
-
const { consumerRef, consumerName, groupRef, groupName, } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
9
|
+
const HubspotOauthFlow_1 = require("../Oauth/Hubspot/HubspotOauthFlow");
|
|
10
|
+
const SalesforceOauthFlow_1 = require("../Oauth/Salesforce/SalesforceOauthFlow");
|
|
11
|
+
function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupRef, groupName, children, }) {
|
|
15
12
|
const { selectedConnection, setSelectedConnection, connections } = (0, ConnectionsContext_1.useConnections)();
|
|
16
13
|
(0, react_1.useEffect)(() => {
|
|
17
14
|
if (!selectedConnection && connections && connections.length > 0) {
|
|
@@ -19,10 +16,19 @@ function ProtectedConnectionLayout({ children }) {
|
|
|
19
16
|
setSelectedConnection(connection);
|
|
20
17
|
}
|
|
21
18
|
}, [connections, selectedConnection, setSelectedConnection]);
|
|
19
|
+
const { provider: providerFromProps } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
20
|
+
if (!provider && !providerFromProps) {
|
|
21
|
+
throw new Error('ProtectedConnectionLayout must be given a provider prop or be used within InstallIntegrationProvider');
|
|
22
|
+
}
|
|
22
23
|
// a selected connection exists, render children
|
|
23
24
|
if (selectedConnection)
|
|
24
25
|
return children;
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
if (provider === constants_1.PROVIDER_SALESFORCE || providerFromProps === constants_1.PROVIDER_SALESFORCE) {
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(SalesforceOauthFlow_1.SalesforceOauthFlow, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
|
|
28
|
+
}
|
|
29
|
+
if (provider === constants_1.PROVIDER_HUBSPOT || providerFromProps === constants_1.PROVIDER_HUBSPOT) {
|
|
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" }));
|
|
27
33
|
}
|
|
28
34
|
exports.ProtectedConnectionLayout = ProtectedConnectionLayout;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function UninstallContent(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.UninstallContent = 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 ApiKeyProvider_1 = require("../../context/ApiKeyProvider");
|
|
8
|
+
const InstallIntegrationContext_1 = require("../../context/InstallIntegrationContext");
|
|
9
|
+
const ProjectContext_1 = require("../../context/ProjectContext");
|
|
10
|
+
const api_1 = require("../../services/api");
|
|
11
|
+
function UninstallContent() {
|
|
12
|
+
const apiKey = (0, ApiKeyProvider_1.useApiKey)();
|
|
13
|
+
const { projectId, appName } = (0, ProjectContext_1.useProject)();
|
|
14
|
+
const { integrationId, installation, resetInstallations } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
15
|
+
const [loading, setLoading] = (0, react_1.useState)(false);
|
|
16
|
+
const isDisabled = !projectId || !integrationId || !(installation === null || installation === void 0 ? void 0 : installation.id) || loading;
|
|
17
|
+
const onDelete = async () => {
|
|
18
|
+
if (!isDisabled) {
|
|
19
|
+
setLoading(true);
|
|
20
|
+
console.warn('uninstalling installation', { projectId, integrationId, installationId: installation.id });
|
|
21
|
+
try {
|
|
22
|
+
await (0, api_1.api)().deleteInstallation({ projectId, integrationId, installationId: installation.id }, {
|
|
23
|
+
headers: {
|
|
24
|
+
'X-Api-Key': apiKey,
|
|
25
|
+
'Content-Type': 'application/json',
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
resetInstallations();
|
|
29
|
+
console.warn('successfully uninstalled installation: ', installation.id);
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
console.error('error uninstalling installation', e);
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
setLoading(false);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const buttonContent = loading ? 'Uninstalling...' : 'Yes, uninstall';
|
|
40
|
+
const content = (installation === null || installation === void 0 ? void 0 : installation.id) ? `Once you uninstall this integration, all your configuration will be lost, and "${appName}" may stop working.`
|
|
41
|
+
: "You've successfully uninstalled the integration.";
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Stack, { children: [(0, jsx_runtime_1.jsx)(react_2.Text, { paddingBottom: 3, children: content }), (installation === null || installation === void 0 ? void 0 : installation.id) && ((0, jsx_runtime_1.jsx)(react_2.Button, { onClick: onDelete, variant: "warning", isDisabled: isDisabled, children: buttonContent }))] }));
|
|
43
|
+
}
|
|
44
|
+
exports.UninstallContent = UninstallContent;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.UpdateInstallation = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const react_1 = require("react");
|
|
6
|
-
const
|
|
6
|
+
const ApiKeyProvider_1 = require("../../context/ApiKeyProvider");
|
|
7
7
|
const ErrorContextProvider_1 = require("../../context/ErrorContextProvider");
|
|
8
8
|
const InstallIntegrationContext_1 = require("../../context/InstallIntegrationContext");
|
|
9
9
|
const ProjectContext_1 = require("../../context/ProjectContext");
|
|
@@ -13,36 +13,30 @@ const HydratedRevisionContext_1 = require("./state/HydratedRevisionContext");
|
|
|
13
13
|
const utils_1 = require("./state/utils");
|
|
14
14
|
const ConfigureInstallationBase_1 = require("./ConfigureInstallationBase");
|
|
15
15
|
const ObjectManagementNav_1 = require("./ObjectManagementNav");
|
|
16
|
+
const utils_2 = require("./utils");
|
|
16
17
|
// Update Installation Flow
|
|
17
18
|
function UpdateInstallation({ installation, integrationObj }) {
|
|
19
|
+
const apiKey = (0, ApiKeyProvider_1.useApiKey)();
|
|
18
20
|
const { setInstallation } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
|
|
19
21
|
const { hydratedRevision, loading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
|
|
20
22
|
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
21
|
-
const apiKey = (0, react_1.useContext)(ApiKeyContext_1.ApiKeyContext);
|
|
22
23
|
const { projectId } = (0, ProjectContext_1.useProject)();
|
|
24
|
+
const [isLoading, setLoadingState] = (0, react_1.useState)(false);
|
|
23
25
|
// when no installation or config exists, render create flow
|
|
24
26
|
const { config } = installation;
|
|
25
|
-
const [isLoading, setLoadingState] = (0, react_1.useState)(false);
|
|
26
27
|
// 1. get config from installations (contains form selection state)
|
|
27
28
|
// 2. get the hydrated revision (contains full form)
|
|
28
29
|
// 3. generate the configuration state from the hydrated revision and config
|
|
29
30
|
const { resetBoundary, setErrors } = (0, ErrorContextProvider_1.useErrorState)();
|
|
30
|
-
const {
|
|
31
|
+
const { resetConfigureState, objectConfigurationsState, resetPendingConfigurationState, } = (0, ConfigurationStateProvider_1.useConfigureState)();
|
|
31
32
|
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
32
33
|
const resetState = (0, react_1.useCallback)(() => {
|
|
33
34
|
resetBoundary(ErrorContextProvider_1.ErrorBoundary.MAPPING);
|
|
34
35
|
// set configurationState when hydratedRevision is loaded
|
|
35
36
|
if ((hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) && !loading && selectedObjectName) {
|
|
36
|
-
(0, utils_1.
|
|
37
|
+
(0, utils_1.setHydrateConfigState)(hydratedRevision, config, selectedObjectName, resetConfigureState);
|
|
37
38
|
}
|
|
38
|
-
}, [
|
|
39
|
-
hydratedRevision,
|
|
40
|
-
loading,
|
|
41
|
-
config,
|
|
42
|
-
selectedObjectName,
|
|
43
|
-
setConfigureState,
|
|
44
|
-
resetBoundary,
|
|
45
|
-
]);
|
|
39
|
+
}, [resetBoundary, hydratedRevision, loading, selectedObjectName, config, resetConfigureState]);
|
|
46
40
|
(0, react_1.useEffect)(() => {
|
|
47
41
|
if (!configureState) {
|
|
48
42
|
resetState();
|
|
@@ -56,14 +50,9 @@ function UpdateInstallation({ installation, integrationObj }) {
|
|
|
56
50
|
const onSave = (e) => {
|
|
57
51
|
e.preventDefault();
|
|
58
52
|
// check if fields with requirements are met
|
|
59
|
-
const { requiredMapFields } = configureState;
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const errList = fieldsWithRequirementsNotMet.map((field) => field.mapToName);
|
|
63
|
-
setErrors(ErrorContextProvider_1.ErrorBoundary.MAPPING, errList);
|
|
64
|
-
// if requires fields are not met, set error fields and return
|
|
65
|
-
if (fieldsWithRequirementsNotMet === null || fieldsWithRequirementsNotMet === void 0 ? void 0 : fieldsWithRequirementsNotMet.length) {
|
|
66
|
-
console.error('required fields not met', fieldsWithRequirementsNotMet.map((field) => field.mapToDisplayName));
|
|
53
|
+
const { requiredMapFields, selectedFieldMappings } = configureState || {};
|
|
54
|
+
const { errorList } = (0, utils_2.validateFieldMappings)(requiredMapFields, selectedFieldMappings, setErrors);
|
|
55
|
+
if (errorList.length > 0) {
|
|
67
56
|
return;
|
|
68
57
|
}
|
|
69
58
|
if (installation
|
package/build/src/components/Configure/fields/{FieldMapping.d.ts → FieldMappings/FieldMapping.d.ts}
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { HydratedIntegrationFieldExistent } from '
|
|
3
|
-
import { ConfigureStateMappingIntegrationField } from '../types';
|
|
2
|
+
import { HydratedIntegrationFieldExistent, IntegrationFieldMapping } from '../../../../services/api';
|
|
4
3
|
interface FieldMappingProps {
|
|
5
|
-
field:
|
|
4
|
+
field: IntegrationFieldMapping;
|
|
6
5
|
onSelectChange: (e: React.ChangeEvent<HTMLSelectElement>) => void;
|
|
7
6
|
allFields: HydratedIntegrationFieldExistent[];
|
|
8
7
|
}
|
package/build/src/components/Configure/fields/{FieldMapping.js → FieldMappings/FieldMapping.js}
RENAMED
|
@@ -4,25 +4,26 @@ exports.FieldMapping = 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 ObjectManagementNav_1 = require("
|
|
8
|
-
const ConfigurationStateProvider_1 = require("
|
|
9
|
-
const utils_1 = require("
|
|
7
|
+
const ObjectManagementNav_1 = require("../../ObjectManagementNav");
|
|
8
|
+
const ConfigurationStateProvider_1 = require("../../state/ConfigurationStateProvider");
|
|
9
|
+
const utils_1 = require("../../state/utils");
|
|
10
|
+
const setFieldMapping_1 = require("./setFieldMapping");
|
|
10
11
|
function FieldMapping({ field, onSelectChange, allFields }) {
|
|
11
12
|
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
12
13
|
const { objectConfigurationsState, setConfigureState } = (0, ConfigurationStateProvider_1.useConfigureState)();
|
|
13
|
-
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
14
14
|
const [disabled, setDisabled] = (0, react_1.useState)(true);
|
|
15
|
+
const configureState = (0, utils_1.getConfigureState)(selectedObjectName || '', objectConfigurationsState);
|
|
16
|
+
const { selectedFieldMappings: selectedRequiredMapFields } = configureState || {};
|
|
17
|
+
const fieldValue = selectedRequiredMapFields === null || selectedRequiredMapFields === void 0 ? void 0 : selectedRequiredMapFields[field.mapToName];
|
|
15
18
|
(0, react_1.useEffect)(() => {
|
|
16
19
|
/* eslint no-underscore-dangle: ["error", { "allow": ["_default"] }] */
|
|
17
|
-
if (!!field._default && !
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
setConfigureState(selectedObjectName, newState);
|
|
21
|
-
}
|
|
20
|
+
if (!!field._default && !fieldValue && selectedObjectName && !!configureState) {
|
|
21
|
+
// set field mapping default value if no value exists
|
|
22
|
+
(0, setFieldMapping_1.setFieldMapping)(selectedObjectName, setConfigureState, field.mapToName, field._default);
|
|
22
23
|
}
|
|
23
24
|
setDisabled(false);
|
|
24
|
-
}, [field,
|
|
25
|
+
}, [field, setConfigureState, selectedObjectName, fieldValue, configureState]);
|
|
25
26
|
const options = (0, react_1.useMemo)(() => allFields === null || allFields === void 0 ? void 0 : allFields.map((f) => (0, jsx_runtime_1.jsx)("option", { value: f.fieldName, children: f.displayName }, f.fieldName)), [allFields]);
|
|
26
|
-
return ((0, jsx_runtime_1.jsxs)(react_2.Stack, { children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontWeight: "500", children: field.mapToDisplayName }), (0, jsx_runtime_1.jsx)(react_2.Text, { marginBottom: "5px", fontSize: 14, children: field === null || field === void 0 ? void 0 : field.prompt }), (0, jsx_runtime_1.jsx)(react_2.Select, { name: field.mapToName, variant: "flushed", value:
|
|
27
|
+
return ((0, jsx_runtime_1.jsxs)(react_2.Stack, { children: [(0, jsx_runtime_1.jsx)(react_2.Text, { fontWeight: "500", children: field.mapToDisplayName }), (0, jsx_runtime_1.jsx)(react_2.Text, { marginBottom: "5px", fontSize: 14, children: field === null || field === void 0 ? void 0 : field.prompt }), (0, jsx_runtime_1.jsx)(react_2.Select, { name: field.mapToName, variant: "flushed", value: fieldValue || undefined, onChange: onSelectChange, placeholder: !fieldValue ? 'Please select one' : undefined, disabled: disabled, children: options })] }, field.mapToName));
|
|
27
28
|
}
|
|
28
29
|
exports.FieldMapping = FieldMapping;
|
|
@@ -4,13 +4,14 @@ exports.RequiredFieldMappings = 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 ErrorContextProvider_1 = require("
|
|
8
|
-
const ObjectManagementNav_1 = require("
|
|
9
|
-
const ConfigurationStateProvider_1 = require("
|
|
10
|
-
const utils_1 = require("
|
|
11
|
-
const utils_2 = require("
|
|
12
|
-
const FieldHeader_1 = require("
|
|
7
|
+
const ErrorContextProvider_1 = require("../../../../context/ErrorContextProvider");
|
|
8
|
+
const ObjectManagementNav_1 = require("../../ObjectManagementNav");
|
|
9
|
+
const ConfigurationStateProvider_1 = require("../../state/ConfigurationStateProvider");
|
|
10
|
+
const utils_1 = require("../../state/utils");
|
|
11
|
+
const utils_2 = require("../../utils");
|
|
12
|
+
const FieldHeader_1 = require("../FieldHeader");
|
|
13
13
|
const FieldMapping_1 = require("./FieldMapping");
|
|
14
|
+
const setFieldMapping_1 = require("./setFieldMapping");
|
|
14
15
|
function RequiredFieldMappings() {
|
|
15
16
|
const { selectedObjectName } = (0, ObjectManagementNav_1.useSelectedObjectName)();
|
|
16
17
|
const { objectConfigurationsState, setConfigureState } = (0, ConfigurationStateProvider_1.useConfigureState)();
|
|
@@ -22,9 +23,8 @@ function RequiredFieldMappings() {
|
|
|
22
23
|
// if place holder value is chosen, we don't change state
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
setConfigureState(selectedObjectName, newState);
|
|
26
|
+
if (selectedObjectName) {
|
|
27
|
+
(0, setFieldMapping_1.setFieldMapping)(selectedObjectName, setConfigureState, name, value);
|
|
28
28
|
}
|
|
29
29
|
if (isError(ErrorContextProvider_1.ErrorBoundary.MAPPING, name)) {
|
|
30
30
|
removeError(ErrorContextProvider_1.ErrorBoundary.MAPPING, name);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequiredFieldMappings = exports.FieldMapping = void 0;
|
|
4
|
+
const FieldMapping_1 = require("./FieldMapping");
|
|
5
|
+
Object.defineProperty(exports, "FieldMapping", { enumerable: true, get: function () { return FieldMapping_1.FieldMapping; } });
|
|
6
|
+
const RequiredFieldMappings_1 = require("./RequiredFieldMappings");
|
|
7
|
+
Object.defineProperty(exports, "RequiredFieldMappings", { enumerable: true, get: function () { return RequiredFieldMappings_1.RequiredFieldMappings; } });
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Draft } from 'immer';
|
|
2
|
+
import { ConfigureState } from '../../types';
|
|
3
|
+
export declare function setFieldMapping(selectedObjectName: string, setConfigureState: (objectName: string, producer: (draft: Draft<ConfigureState>) => void) => void, fieldKey: string, newValue: string): void;
|