@amp-labs/react 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/generated-sources/api/src/apis/AllowedDomainApi.d.ts +79 -0
- package/build/generated-sources/api/src/apis/AllowedDomainApi.js +101 -0
- package/build/generated-sources/api/src/apis/ConnectionApi.d.ts +82 -0
- package/build/generated-sources/api/src/apis/ConnectionApi.js +107 -0
- package/build/generated-sources/api/src/apis/ConsumerApi.d.ts +52 -0
- package/build/generated-sources/api/src/apis/ConsumerApi.js +75 -0
- package/build/generated-sources/api/src/apis/DestinationApi.d.ts +102 -0
- package/build/generated-sources/api/src/apis/DestinationApi.js +126 -0
- package/build/generated-sources/api/src/apis/GroupApi.d.ts +52 -0
- package/build/generated-sources/api/src/apis/GroupApi.js +75 -0
- package/build/generated-sources/api/src/apis/InstallationApi.d.ts +196 -0
- package/build/generated-sources/api/src/apis/InstallationApi.js +235 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.d.ts +128 -0
- package/build/generated-sources/api/src/apis/IntegrationApi.js +151 -0
- package/build/generated-sources/api/src/apis/OAuthApi.d.ts +76 -0
- package/build/generated-sources/api/src/apis/OAuthApi.js +102 -0
- package/build/generated-sources/api/src/apis/OperationApi.d.ts +80 -0
- package/build/generated-sources/api/src/apis/OperationApi.js +104 -0
- package/build/generated-sources/api/src/apis/OperationLogApi.d.ts +55 -0
- package/build/generated-sources/api/src/apis/OperationLogApi.js +76 -0
- package/build/generated-sources/api/src/apis/ProjectApi.d.ts +124 -0
- package/build/generated-sources/api/src/apis/ProjectApi.js +148 -0
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.d.ts +126 -0
- package/build/generated-sources/api/src/apis/ProjectMembershipApi.js +154 -0
- package/build/generated-sources/api/src/apis/ProviderAppApi.d.ts +130 -0
- package/build/generated-sources/api/src/apis/ProviderAppApi.js +158 -0
- package/build/generated-sources/api/src/apis/RevisionApi.d.ts +87 -0
- package/build/generated-sources/api/src/apis/RevisionApi.js +113 -0
- package/build/generated-sources/api/src/apis/UploadURLApi.d.ts +46 -0
- package/build/generated-sources/api/src/apis/UploadURLApi.js +68 -0
- package/build/generated-sources/api/src/apis/index.d.ts +15 -1
- package/build/generated-sources/api/src/apis/index.js +15 -1
- package/build/generated-sources/api/src/models/BaseConfigContent.d.ts +7 -0
- package/build/generated-sources/api/src/models/BaseConfigContent.js +3 -0
- package/build/generated-sources/api/src/models/BaseProxyConfig.d.ts +31 -0
- package/build/generated-sources/api/src/models/BaseProxyConfig.js +50 -0
- package/build/generated-sources/api/src/models/ConfigContent.d.ts +7 -0
- package/build/generated-sources/api/src/models/ConfigContent.js +3 -0
- package/build/generated-sources/api/src/models/Destination.d.ts +44 -0
- package/build/generated-sources/api/src/models/Destination.js +57 -0
- package/build/generated-sources/api/src/models/DestinationMetadata.d.ts +39 -0
- package/build/generated-sources/api/src/models/{CreateDestinationRequestMetadata.js → DestinationMetadata.js} +11 -11
- package/build/generated-sources/api/src/models/HydratedIntegration.d.ts +7 -0
- package/build/generated-sources/api/src/models/HydratedIntegration.js +3 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationProxy.d.ts +31 -0
- package/build/generated-sources/api/src/models/HydratedIntegrationProxy.js +50 -0
- package/build/generated-sources/api/src/models/ImportConnectionRequest.d.ts +1 -1
- package/build/generated-sources/api/src/models/Integration1.d.ts +7 -0
- package/build/generated-sources/api/src/models/Integration1.js +3 -0
- package/build/generated-sources/api/src/models/IntegrationProxy.d.ts +31 -0
- package/build/generated-sources/api/src/models/IntegrationProxy.js +50 -0
- package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +6 -6
- package/build/generated-sources/api/src/models/OauthConnectRequest.js +1 -2
- package/build/generated-sources/api/src/models/Operation.d.ts +26 -9
- package/build/generated-sources/api/src/models/Operation.js +14 -7
- package/build/generated-sources/api/src/models/OperationLog.d.ts +43 -0
- package/build/generated-sources/api/src/models/OperationLog.js +56 -0
- package/build/generated-sources/api/src/models/ProviderApp.d.ts +6 -0
- package/build/generated-sources/api/src/models/ProviderApp.js +2 -0
- package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.d.ts +7 -0
- package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.js +3 -0
- package/build/generated-sources/api/src/models/index.d.ts +6 -3
- package/build/generated-sources/api/src/models/index.js +6 -3
- package/build/src/assets/SuccessIcon.d.ts +1 -0
- package/build/src/assets/SuccessIcon.js +8 -0
- package/build/src/assets/TrashIcon.js +3 -1
- package/build/src/components/Configure/InstallIntegration.d.ts +4 -1
- package/build/src/components/Configure/InstallIntegration.js +11 -23
- package/build/src/components/Configure/actions/createInstallationReducer.d.ts +15 -0
- package/build/src/components/Configure/actions/createInstallationReducer.js +30 -0
- package/build/src/components/Configure/actions/onSaveReadCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js} +13 -25
- package/build/src/components/Configure/actions/onSaveReadUpdateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/{onSaveUpdate.js → onSaveReadUpdateInstallation.js} +13 -8
- package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.d.ts +8 -0
- package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.js +44 -0
- package/build/src/components/Configure/actions/write/generateConfigWriteObjects.d.ts +26 -0
- package/build/src/components/Configure/actions/write/generateConfigWriteObjects.js +41 -0
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +72 -0
- package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.d.ts +3 -0
- package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.js +60 -0
- package/build/src/components/Configure/{ConfigureInstallationBase.d.ts → content/ConfigureInstallationBase.d.ts} +2 -1
- package/build/src/components/Configure/content/ConfigureInstallationBase.js +36 -0
- package/build/src/components/Configure/content/CreateInstallation.js +83 -0
- package/build/src/components/Configure/content/InstallationContent.d.ts +1 -0
- package/build/src/components/Configure/content/InstallationContent.js +20 -0
- package/build/src/components/Configure/{UninstallContent.js → content/UninstallContent.js} +10 -9
- package/build/src/components/Configure/{UpdateInstallation.d.ts → content/UpdateInstallation.d.ts} +1 -1
- package/build/src/components/Configure/{UpdateInstallation.js → content/UpdateInstallation.js} +42 -28
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.d.ts +1 -1
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.js +4 -7
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.js +10 -11
- package/build/src/components/Configure/{fields → content/fields}/FieldMappings/setFieldMapping.d.ts +1 -1
- package/build/src/components/Configure/content/fields/FieldMappings/setFieldMapping.js +21 -0
- package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.js +9 -14
- package/build/src/components/Configure/{fields → content/fields}/OptionalFields/setOptionalField.d.ts +1 -1
- package/build/src/components/Configure/content/fields/OptionalFields/setOptionalField.js +27 -0
- package/build/src/components/Configure/content/fields/ReadFields.d.ts +1 -0
- package/build/src/components/Configure/content/fields/ReadFields.js +11 -0
- package/build/src/components/Configure/content/fields/RequiredFields.js +23 -0
- package/build/src/components/Configure/content/fields/WriteFields/WriteFields.d.ts +1 -0
- package/build/src/components/Configure/content/fields/WriteFields/WriteFields.js +22 -0
- package/build/src/components/Configure/content/fields/WriteFields/index.d.ts +2 -0
- package/build/src/components/Configure/content/fields/WriteFields/index.js +5 -0
- package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.d.ts +3 -0
- package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.js +32 -0
- package/build/src/components/Configure/content/useMutateInstallation.d.ts +23 -0
- package/build/src/components/Configure/content/useMutateInstallation.js +47 -0
- package/build/src/components/Configure/content/useSelectedConfigureState.d.ts +72 -0
- package/build/src/components/Configure/content/useSelectedConfigureState.js +24 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.d.ts +11 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js +67 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.d.ts +5 -0
- package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.js +11 -0
- package/build/src/components/Configure/{ProtectedConnectionLayout.d.ts → layout/ProtectedConnectionLayout.d.ts} +2 -1
- package/build/src/components/Configure/{ProtectedConnectionLayout.js → layout/ProtectedConnectionLayout.js} +13 -13
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.d.ts +1 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.js +3 -3
- package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.d.ts +7 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.js +11 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.d.ts +1 -1
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.js +2 -2
- package/build/src/components/Configure/nav/ObjectManagementNav/constant.d.ts +1 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/constant.js +4 -0
- package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/index.d.ts +1 -0
- package/build/src/components/Configure/nav/ObjectManagementNav/index.js +61 -0
- package/build/src/components/Configure/state/ConfigurationStateProvider.d.ts +70 -42
- package/build/src/components/Configure/state/ConfigurationStateProvider.js +39 -17
- package/build/src/components/Configure/state/HydratedRevisionContext.js +11 -9
- package/build/src/components/Configure/state/utils.d.ts +2 -2
- package/build/src/components/Configure/state/utils.js +44 -19
- package/build/src/components/Configure/types.d.ts +22 -6
- package/build/src/components/Configure/utils.d.ts +3 -2
- package/build/src/components/Configure/utils.js +25 -5
- package/build/src/components/Connect/ConnectProvider.d.ts +3 -1
- package/build/src/components/Connect/ConnectProvider.js +6 -12
- package/build/src/components/Connect/ConnectedSuccessBox.d.ts +5 -0
- package/build/src/components/Connect/ConnectedSuccessBox.js +13 -0
- package/build/src/components/Connect/useConnectionHandler.d.ts +10 -0
- package/build/src/components/Connect/useConnectionHandler.js +24 -0
- package/build/src/components/ErrorTextBox.js +11 -0
- package/build/src/components/Oauth/NoSubdomainEntry/LandingContent.d.ts +8 -0
- package/build/src/components/Oauth/{Hubspot/HubspotLandingContent.js → NoSubdomainEntry/LandingContent.js} +5 -4
- package/build/src/components/Oauth/NoSubdomainEntry/NoSubdomainOauthFlow.d.ts +16 -0
- package/build/src/components/Oauth/{Hubspot/HubspotOauthFlow.js → NoSubdomainEntry/NoSubdomainOauthFlow.js} +14 -14
- package/build/src/components/{Connect → Oauth}/OAuthPopup.js +8 -10
- package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +5 -5
- package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +1 -1
- package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -1
- package/build/src/components/Oauth/fetchOAuthCallbackURL.js +3 -4
- package/build/src/components/RedirectHandler/RedirectHandler.d.ts +15 -0
- package/build/src/components/RedirectHandler/RedirectHandler.js +31 -0
- package/build/src/components/RedirectHandler/index.d.ts +1 -0
- package/build/src/components/RedirectHandler/index.js +5 -0
- package/build/src/components/SuccessTextBox.d.ts +5 -0
- package/build/src/components/SuccessTextBox.js +10 -0
- package/build/src/{components/AmpersandProvider/AmpersandProvider.js → context/AmpersandContextProvider/AmpersandContextProvider.js} +6 -6
- package/build/src/context/AmpersandContextProvider/index.d.ts +1 -0
- package/build/src/{components/AmpersandProvider → context/AmpersandContextProvider}/index.js +1 -1
- package/build/src/context/{ConnectionsContext.js → ConnectionsContextProvider.js} +11 -10
- package/build/src/context/{InstallIntegrationContext.d.ts → InstallIntegrationContextProvider.d.ts} +7 -2
- package/build/src/context/{InstallIntegrationContext.js → InstallIntegrationContextProvider.js} +29 -14
- package/build/src/context/{IntegrationListContext.js → IntegrationListContextProvider.js} +4 -4
- package/build/src/context/{ProjectContext.js → ProjectContextProvider.js} +4 -4
- package/build/src/hooks/useIsIntegrationInstalled.js +7 -7
- package/build/src/index.d.ts +1 -2
- package/build/src/index.js +1 -2
- package/build/src/public/index.d.ts +7 -0
- package/build/src/{components → public}/index.js +7 -3
- package/build/src/services/ApiService.d.ts +27 -0
- package/build/src/services/ApiService.js +34 -0
- package/build/src/services/api.d.ts +5 -4
- package/build/src/services/api.js +26 -19
- package/package.json +2 -2
- package/build/generated-sources/api/src/apis/DefaultApi.d.ts +0 -930
- package/build/generated-sources/api/src/apis/DefaultApi.js +0 -1019
- package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +0 -44
- package/build/generated-sources/api/src/models/CreateDestinationRequest.js +0 -57
- package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +0 -39
- package/build/generated-sources/api/src/models/OperationError.d.ts +0 -49
- package/build/generated-sources/api/src/models/OperationError.js +0 -56
- package/build/src/components/AmpersandProvider/index.d.ts +0 -1
- package/build/src/components/CenteredTextBox/CenteredTextBox.d.ts +0 -5
- package/build/src/components/CenteredTextBox/CenteredTextBox.js +0 -8
- package/build/src/components/Configure/ConfigureInstallationBase.js +0 -29
- package/build/src/components/Configure/CreateInstallation.js +0 -70
- package/build/src/components/Configure/ErrorTextBox.js +0 -9
- package/build/src/components/Configure/ObjectManagementNav/index.js +0 -53
- package/build/src/components/Configure/actions/onSaveCreate.d.ts +0 -3
- package/build/src/components/Configure/actions/onSaveUpdate.d.ts +0 -3
- package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.js +0 -18
- package/build/src/components/Configure/fields/OptionalFields/setOptionalField.js +0 -21
- package/build/src/components/Configure/fields/RequiredFields.js +0 -27
- package/build/src/components/Oauth/Hubspot/HubspotLandingContent.d.ts +0 -7
- package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.d.ts +0 -15
- package/build/src/components/index.d.ts +0 -3
- /package/build/src/components/Configure/{CreateInstallation.d.ts → content/CreateInstallation.d.ts} +0 -0
- /package/build/src/components/Configure/{UninstallContent.d.ts → content/UninstallContent.d.ts} +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.d.ts +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.js +0 -0
- /package/build/src/components/Configure/{fields → content/fields}/RequiredFields.d.ts +0 -0
- /package/build/src/components/{Configure/ErrorTextBox.d.ts → ErrorTextBox.d.ts} +0 -0
- /package/build/src/components/{Connect → Oauth}/OAuthPopup.d.ts +0 -0
- /package/build/src/{components/AmpersandProvider/AmpersandProvider.d.ts → context/AmpersandContextProvider/AmpersandContextProvider.d.ts} +0 -0
- /package/build/src/context/{ApiKeyProvider.d.ts → ApiKeyContextProvider.d.ts} +0 -0
- /package/build/src/context/{ApiKeyProvider.js → ApiKeyContextProvider.js} +0 -0
- /package/build/src/context/{ConnectionsContext.d.ts → ConnectionsContextProvider.d.ts} +0 -0
- /package/build/src/context/{IntegrationListContext.d.ts → IntegrationListContextProvider.d.ts} +0 -0
- /package/build/src/context/{ProjectContext.d.ts → ProjectContextProvider.d.ts} +0 -0
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useIsIntegrationInstalled = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
5
|
+
const ApiKeyContextProvider_1 = require("../context/ApiKeyContextProvider");
|
|
6
|
+
const IntegrationListContextProvider_1 = require("../context/IntegrationListContextProvider");
|
|
7
|
+
const ProjectContextProvider_1 = require("../context/ProjectContextProvider");
|
|
8
8
|
const api_1 = require("../services/api");
|
|
9
9
|
const useIsIntegrationInstalled = (integration, groupRef) => {
|
|
10
|
-
const apiKey = (0,
|
|
11
|
-
const { projectId } = (0,
|
|
12
|
-
const { integrations } = (0,
|
|
10
|
+
const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
|
|
11
|
+
const { projectId } = (0, ProjectContextProvider_1.useProject)();
|
|
12
|
+
const { integrations } = (0, IntegrationListContextProvider_1.useIntegrationList)();
|
|
13
13
|
const [isLoaded, setIsLoaded] = (0, react_1.useState)(false);
|
|
14
14
|
const [isIntegrationInstalled, setIsIntegrationInstalled] = (0, react_1.useState)(null);
|
|
15
15
|
if (!apiKey || !projectId) {
|
|
@@ -27,7 +27,7 @@ const useIsIntegrationInstalled = (integration, groupRef) => {
|
|
|
27
27
|
(0, react_1.useEffect)(() => {
|
|
28
28
|
if (!integrationToCheck)
|
|
29
29
|
return;
|
|
30
|
-
(0, api_1.api)().listInstallations({
|
|
30
|
+
(0, api_1.api)().installationApi.listInstallations({
|
|
31
31
|
projectId,
|
|
32
32
|
integrationId: integrationToCheck.id,
|
|
33
33
|
groupRef,
|
package/build/src/index.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
export * from './hooks';
|
|
1
|
+
export * from './public';
|
package/build/src/index.js
CHANGED
|
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./
|
|
18
|
-
__exportStar(require("./hooks"), exports);
|
|
17
|
+
__exportStar(require("./public"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Contains all the features to be exported out of the library
|
|
3
|
+
*/
|
|
4
|
+
export * from '../context/AmpersandContextProvider';
|
|
5
|
+
export * from '../components/Configure';
|
|
6
|
+
export * from '../components/Connect/ConnectProvider';
|
|
7
|
+
export * from '../hooks/useIsIntegrationInstalled';
|
|
@@ -14,6 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* Contains all the features to be exported out of the library
|
|
19
|
+
*/
|
|
20
|
+
__exportStar(require("../context/AmpersandContextProvider"), exports);
|
|
21
|
+
__exportStar(require("../components/Configure"), exports);
|
|
22
|
+
__exportStar(require("../components/Connect/ConnectProvider"), exports);
|
|
23
|
+
__exportStar(require("../hooks/useIsIntegrationInstalled"), exports);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { AllowedDomainApi, Configuration, ConnectionApi, ConsumerApi, DestinationApi, GroupApi, InstallationApi, IntegrationApi, OAuthApi, OperationApi, OperationLogApi, ProjectApi, ProjectMembershipApi, ProviderAppApi, RevisionApi, UploadURLApi } from '../../generated-sources/api/src';
|
|
2
|
+
/**
|
|
3
|
+
* ApiService is a wrapper around the generated API client, which exposes
|
|
4
|
+
* all generated api services as properties.
|
|
5
|
+
* This allows us to inject the configuration object into every api service.
|
|
6
|
+
*
|
|
7
|
+
* New or legacy services need to be added or deleted here after services are generated.
|
|
8
|
+
* Note: some services are not used in this repo.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ApiService {
|
|
11
|
+
allowedDomainApi: AllowedDomainApi;
|
|
12
|
+
connectionApi: ConnectionApi;
|
|
13
|
+
consumerApi: ConsumerApi;
|
|
14
|
+
destinationApi: DestinationApi;
|
|
15
|
+
groupApi: GroupApi;
|
|
16
|
+
installationApi: InstallationApi;
|
|
17
|
+
integrationApi: IntegrationApi;
|
|
18
|
+
oAuthApi: OAuthApi;
|
|
19
|
+
operationApi: OperationApi;
|
|
20
|
+
operationLogApi: OperationLogApi;
|
|
21
|
+
projectApi: ProjectApi;
|
|
22
|
+
projectMembershipApi: ProjectMembershipApi;
|
|
23
|
+
providerAppApi: ProviderAppApi;
|
|
24
|
+
revisionApi: RevisionApi;
|
|
25
|
+
uploadURLApi: UploadURLApi;
|
|
26
|
+
constructor(config: Configuration);
|
|
27
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiService = void 0;
|
|
4
|
+
/* eslint-disable import/no-relative-packages */
|
|
5
|
+
// currently not using a bundler to support alias imports
|
|
6
|
+
const src_1 = require("../../generated-sources/api/src");
|
|
7
|
+
/**
|
|
8
|
+
* ApiService is a wrapper around the generated API client, which exposes
|
|
9
|
+
* all generated api services as properties.
|
|
10
|
+
* This allows us to inject the configuration object into every api service.
|
|
11
|
+
*
|
|
12
|
+
* New or legacy services need to be added or deleted here after services are generated.
|
|
13
|
+
* Note: some services are not used in this repo.
|
|
14
|
+
*/
|
|
15
|
+
class ApiService {
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.allowedDomainApi = new src_1.AllowedDomainApi(config);
|
|
18
|
+
this.connectionApi = new src_1.ConnectionApi(config);
|
|
19
|
+
this.consumerApi = new src_1.ConsumerApi(config);
|
|
20
|
+
this.destinationApi = new src_1.DestinationApi(config);
|
|
21
|
+
this.groupApi = new src_1.GroupApi(config);
|
|
22
|
+
this.installationApi = new src_1.InstallationApi(config);
|
|
23
|
+
this.integrationApi = new src_1.IntegrationApi(config);
|
|
24
|
+
this.oAuthApi = new src_1.OAuthApi(config);
|
|
25
|
+
this.operationApi = new src_1.OperationApi(config);
|
|
26
|
+
this.operationLogApi = new src_1.OperationLogApi(config);
|
|
27
|
+
this.projectApi = new src_1.ProjectApi(config);
|
|
28
|
+
this.projectMembershipApi = new src_1.ProjectMembershipApi(config);
|
|
29
|
+
this.providerAppApi = new src_1.ProviderAppApi(config);
|
|
30
|
+
this.revisionApi = new src_1.RevisionApi(config);
|
|
31
|
+
this.uploadURLApi = new src_1.UploadURLApi(config);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.ApiService = ApiService;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig,
|
|
1
|
+
import { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationField, HydratedIntegrationFieldExistent, HydratedIntegrationObject, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedRevision, Installation, Integration, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig } from '../../generated-sources/api/src';
|
|
2
|
+
import { ApiService } from './ApiService';
|
|
2
3
|
export declare const AMP_SERVER: string;
|
|
3
4
|
export declare const AMP_API_ROOT: string;
|
|
4
|
-
export declare const setApi: (api:
|
|
5
|
-
export declare const api: () =>
|
|
5
|
+
export declare const setApi: (api: ApiService) => void;
|
|
6
|
+
export declare const api: () => ApiService;
|
|
6
7
|
/**
|
|
7
8
|
* Types exported from generated api
|
|
8
9
|
*/
|
|
9
|
-
export type { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationRead, HydratedIntegrationObject, HydratedIntegrationField, HydratedRevision, Installation, Integration, HydratedIntegrationFieldExistent, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig, };
|
|
10
|
+
export type { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedIntegrationObject, HydratedIntegrationField, HydratedRevision, Installation, Integration, HydratedIntegrationFieldExistent, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig, };
|
|
@@ -4,6 +4,7 @@ exports.api = exports.setApi = exports.AMP_API_ROOT = exports.AMP_SERVER = void
|
|
|
4
4
|
/* eslint-disable import/no-relative-packages */
|
|
5
5
|
// currently not using a bundler to support alias imports
|
|
6
6
|
const src_1 = require("../../generated-sources/api/src");
|
|
7
|
+
const ApiService_1 = require("./ApiService");
|
|
7
8
|
/**
|
|
8
9
|
* To update the api you need to
|
|
9
10
|
* 1. git clone `https://github.com/amp-labs/server` into a sibling directory
|
|
@@ -16,25 +17,31 @@ const src_1 = require("../../generated-sources/api/src");
|
|
|
16
17
|
*
|
|
17
18
|
* */
|
|
18
19
|
const VERSION = 'v1';
|
|
20
|
+
const prodEndpoint = 'https://api.withampersand.com';
|
|
19
21
|
function getApiEndpoint() {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
try {
|
|
23
|
+
const ENV_SERVER = process.env.REACT_APP_AMP_SERVER;
|
|
24
|
+
switch (ENV_SERVER) {
|
|
25
|
+
case 'local':
|
|
26
|
+
return 'http://localhost:8080';
|
|
27
|
+
case 'dev':
|
|
28
|
+
return 'https://dev-api.withampersand.com';
|
|
29
|
+
case 'staging':
|
|
30
|
+
return 'https://staging-api.withampersand.com';
|
|
31
|
+
case 'prod':
|
|
32
|
+
return prodEndpoint;
|
|
33
|
+
case 'mock':
|
|
34
|
+
return 'http://127.0.0.1:4010';
|
|
35
|
+
case '':
|
|
36
|
+
return prodEndpoint;
|
|
37
|
+
default:
|
|
38
|
+
// The user may provide an arbitrary URL here if they want to, or else the
|
|
39
|
+
// default prod url will be used.
|
|
40
|
+
return ENV_SERVER !== null && ENV_SERVER !== void 0 ? ENV_SERVER : prodEndpoint;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return prodEndpoint;
|
|
38
45
|
}
|
|
39
46
|
}
|
|
40
47
|
const getApiRoot = (server, version) => `${server}/${version}`;
|
|
@@ -54,7 +61,7 @@ exports.AMP_API_ROOT = assignRoot();
|
|
|
54
61
|
const config = new src_1.Configuration({
|
|
55
62
|
basePath: exports.AMP_API_ROOT,
|
|
56
63
|
});
|
|
57
|
-
let apiValue = new
|
|
64
|
+
let apiValue = new ApiService_1.ApiService(config);
|
|
58
65
|
// For testing, etc. we may want to use a different API configuration than the default
|
|
59
66
|
const setApi = (api) => {
|
|
60
67
|
apiValue = api;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amp-labs/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Ampersand React library.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ampersand Labs",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"eslint-plugin-promise": "^6.1.1",
|
|
62
62
|
"eslint-plugin-react": "^7.33.2",
|
|
63
63
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
64
|
-
"eslint-plugin-simple-import-sort": "^
|
|
64
|
+
"eslint-plugin-simple-import-sort": "^12.0.0",
|
|
65
65
|
"jest": "^29.7.0",
|
|
66
66
|
"react-test-renderer": "^18.2.0",
|
|
67
67
|
"typescript": "^5.2.2"
|