@amp-labs/react 1.3.0 → 1.4.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.
Files changed (101) hide show
  1. package/build/generated-sources/api/src/apis/APIKeyApi.d.ts +158 -0
  2. package/build/generated-sources/api/src/apis/APIKeyApi.js +188 -0
  3. package/build/generated-sources/api/src/apis/DestinationApi.d.ts +62 -8
  4. package/build/generated-sources/api/src/apis/DestinationApi.js +62 -3
  5. package/build/generated-sources/api/src/apis/OperationApi.d.ts +27 -1
  6. package/build/generated-sources/api/src/apis/OperationApi.js +27 -0
  7. package/build/generated-sources/api/src/apis/OperationEventApi.d.ts +84 -0
  8. package/build/generated-sources/api/src/apis/OperationEventApi.js +110 -0
  9. package/build/generated-sources/api/src/apis/ProviderApi.d.ts +78 -0
  10. package/build/generated-sources/api/src/apis/{OperationLogApi.js → ProviderApi.js} +33 -17
  11. package/build/generated-sources/api/src/apis/index.d.ts +3 -1
  12. package/build/generated-sources/api/src/apis/index.js +3 -1
  13. package/build/generated-sources/api/src/models/ApiKey.d.ts +49 -0
  14. package/build/generated-sources/api/src/models/ApiKey.js +59 -0
  15. package/build/generated-sources/api/src/models/ApiKeyRequest.d.ts +31 -0
  16. package/build/generated-sources/api/src/models/ApiKeyRequest.js +50 -0
  17. package/build/generated-sources/api/src/models/AuthType.d.ts +22 -0
  18. package/build/generated-sources/api/src/models/AuthType.js +35 -0
  19. package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +44 -0
  20. package/build/generated-sources/api/src/models/CreateDestinationRequest.js +57 -0
  21. package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +39 -0
  22. package/build/generated-sources/api/src/models/{DestinationMetadata.js → CreateDestinationRequestMetadata.js} +11 -11
  23. package/build/generated-sources/api/src/models/Destination.d.ts +22 -4
  24. package/build/generated-sources/api/src/models/Destination.js +12 -3
  25. package/build/generated-sources/api/src/models/{OperationLog.d.ts → Log.d.ts} +12 -12
  26. package/build/generated-sources/api/src/models/{OperationLog.js → Log.js} +11 -11
  27. package/build/generated-sources/api/src/models/OauthOpts.d.ts +56 -0
  28. package/build/generated-sources/api/src/models/OauthOpts.js +63 -0
  29. package/build/generated-sources/api/src/models/OperationEvent.d.ts +61 -0
  30. package/build/generated-sources/api/src/models/OperationEvent.js +64 -0
  31. package/build/generated-sources/api/src/models/PatchApiKeyRequest.d.ts +38 -0
  32. package/build/generated-sources/api/src/models/PatchApiKeyRequest.js +54 -0
  33. package/build/generated-sources/api/src/models/PatchApiKeyRequestApiKey.d.ts +37 -0
  34. package/build/generated-sources/api/src/models/PatchApiKeyRequestApiKey.js +52 -0
  35. package/build/generated-sources/api/src/models/ProviderInfo.d.ts +60 -0
  36. package/build/generated-sources/api/src/models/ProviderInfo.js +65 -0
  37. package/build/generated-sources/api/src/models/Support.d.ts +55 -0
  38. package/build/generated-sources/api/src/models/Support.js +62 -0
  39. package/build/generated-sources/api/src/models/TokenMetadataFields.d.ts +43 -0
  40. package/build/generated-sources/api/src/models/TokenMetadataFields.js +54 -0
  41. package/build/generated-sources/api/src/models/UpdateDestinationRequest.d.ts +38 -0
  42. package/build/generated-sources/api/src/models/UpdateDestinationRequest.js +54 -0
  43. package/build/generated-sources/api/src/models/UpdateDestinationRequestDestination.d.ts +38 -0
  44. package/build/generated-sources/api/src/models/UpdateDestinationRequestDestination.js +53 -0
  45. package/build/generated-sources/api/src/models/index.d.ts +15 -2
  46. package/build/generated-sources/api/src/models/index.js +15 -2
  47. package/build/src/components/Configure/actions/{createInstallationReducer.d.ts → mutateAndSetState/createInstallationAndSetState.d.ts} +3 -3
  48. package/build/src/components/Configure/actions/{createInstallationReducer.js → mutateAndSetState/createInstallationAndSetState.js} +4 -4
  49. package/build/src/components/Configure/actions/mutateAndSetState/updateInstallationAndSetState.d.ts +15 -0
  50. package/build/src/components/Configure/actions/mutateAndSetState/updateInstallationAndSetState.js +33 -0
  51. package/build/src/components/Configure/actions/proxy/isProxyEnabled.d.ts +2 -0
  52. package/build/src/components/Configure/actions/proxy/isProxyEnabled.js +8 -0
  53. package/build/src/components/Configure/actions/proxy/onCreateInstallationProxyOnly.d.ts +8 -0
  54. package/build/src/components/Configure/actions/proxy/{createInstallationProxyOnly.js → onCreateInstallationProxyOnly.js} +5 -5
  55. package/build/src/components/Configure/actions/{onSaveReadCreateInstallation.d.ts → read/onSaveReadCreateInstallation.d.ts} +2 -2
  56. package/build/src/components/Configure/actions/{onSaveReadCreateInstallation.js → read/onSaveReadCreateInstallation.js} +9 -3
  57. package/build/src/components/Configure/actions/read/onSaveReadUpdateInstallation.d.ts +3 -0
  58. package/build/src/components/Configure/actions/{onSaveReadUpdateInstallation.js → read/onSaveReadUpdateInstallation.js} +20 -28
  59. package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +10 -3
  60. package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.d.ts +2 -2
  61. package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.js +11 -3
  62. package/build/src/components/Configure/content/CreateInstallation.js +1 -1
  63. package/build/src/components/Configure/content/UpdateInstallation.js +5 -5
  64. package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js +2 -2
  65. package/build/src/components/Configure/layout/ProtectedConnectionLayout.js +2 -7
  66. package/build/src/components/Configure/state/utils.js +5 -5
  67. package/build/src/components/Oauth/NoWorkspaceEntry/LandingContent.js +12 -0
  68. package/build/src/components/Oauth/{NoSubdomainEntry/NoSubdomainOauthFlow.d.ts → NoWorkspaceEntry/NoWorkspaceOauthFlow.d.ts} +4 -4
  69. package/build/src/components/Oauth/{NoSubdomainEntry/NoSubdomainOauthFlow.js → NoWorkspaceEntry/NoWorkspaceOauthFlow.js} +6 -8
  70. package/build/src/components/Oauth/OAuthPopup.js +1 -5
  71. package/build/src/components/Oauth/OauthCardLayout.d.ts +6 -0
  72. package/build/src/components/Oauth/OauthCardLayout.js +9 -0
  73. package/build/src/components/Oauth/OauthFlow/OauthFlow.d.ts +9 -0
  74. package/build/src/components/Oauth/OauthFlow/OauthFlow.js +33 -0
  75. package/build/src/components/Oauth/Salesforce/SalesforceSubdomainEntry.d.ts +13 -0
  76. package/build/src/components/Oauth/Salesforce/SalesforceSubdomainEntry.js +18 -0
  77. package/build/src/components/Oauth/WorkspaceEntry/WorkspaceEntry.d.ts +9 -0
  78. package/build/src/components/Oauth/WorkspaceEntry/WorkspaceEntry.js +12 -0
  79. package/build/src/components/Oauth/WorkspaceEntry/WorkspaceOauthFlow.d.ts +14 -0
  80. package/build/src/components/Oauth/WorkspaceEntry/WorkspaceOauthFlow.js +58 -0
  81. package/build/src/components/ThemeProvider/Button/buttonTheme.js +3 -3
  82. package/build/src/components/ThemeProvider/index.js +6 -6
  83. package/build/src/services/ApiService.d.ts +2 -2
  84. package/build/src/services/ApiService.js +1 -1
  85. package/build/src/services/api.d.ts +2 -2
  86. package/build/src/services/api.js +5 -0
  87. package/build/src/services/version.d.ts +1 -0
  88. package/build/src/services/version.js +4 -0
  89. package/package.json +2 -2
  90. package/build/generated-sources/api/src/apis/OperationLogApi.d.ts +0 -55
  91. package/build/generated-sources/api/src/models/DestinationMetadata.d.ts +0 -39
  92. package/build/src/components/Configure/actions/onSaveReadUpdateInstallation.d.ts +0 -3
  93. package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.d.ts +0 -8
  94. package/build/src/components/Oauth/NoSubdomainEntry/LandingContent.js +0 -11
  95. package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.d.ts +0 -16
  96. package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +0 -57
  97. package/build/src/components/Oauth/Salesforce/SubdomainEntry.d.ts +0 -8
  98. package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +0 -12
  99. package/build/src/constants.d.ts +0 -2
  100. package/build/src/constants.js +0 -5
  101. /package/build/src/components/Oauth/{NoSubdomainEntry → NoWorkspaceEntry}/LandingContent.d.ts +0 -0
@@ -1,3 +1,6 @@
1
+ export * from './ApiKey';
2
+ export * from './ApiKeyRequest';
3
+ export * from './AuthType';
1
4
  export * from './BaseConfigContent';
2
5
  export * from './BaseProxyConfig';
3
6
  export * from './BaseReadConfig';
@@ -11,6 +14,8 @@ export * from './ConfigContentAllOf';
11
14
  export * from './Connection';
12
15
  export * from './Consumer';
13
16
  export * from './CreateConsumerRequest';
17
+ export * from './CreateDestinationRequest';
18
+ export * from './CreateDestinationRequestMetadata';
14
19
  export * from './CreateGroupRequest';
15
20
  export * from './CreateInstallationRequest';
16
21
  export * from './CreateInstallationRequestConfig';
@@ -19,7 +24,6 @@ export * from './CreateIntegrationRequestLatestRevision';
19
24
  export * from './CreateProjectRequest';
20
25
  export * from './CreateProviderAppRequest';
21
26
  export * from './Destination';
22
- export * from './DestinationMetadata';
23
27
  export * from './Group';
24
28
  export * from './HydratedIntegration';
25
29
  export * from './HydratedIntegrationField';
@@ -44,15 +48,24 @@ export * from './IntegrationProxy';
44
48
  export * from './IntegrationRead';
45
49
  export * from './IntegrationWrite';
46
50
  export * from './IntegrationWriteObject';
51
+ export * from './Log';
47
52
  export * from './OauthConnectRequest';
53
+ export * from './OauthOpts';
48
54
  export * from './Operation';
49
- export * from './OperationLog';
55
+ export * from './OperationEvent';
50
56
  export * from './OptionalFieldsAutoOption';
57
+ export * from './PatchApiKeyRequest';
58
+ export * from './PatchApiKeyRequestApiKey';
51
59
  export * from './Project';
52
60
  export * from './ProjectMembership';
53
61
  export * from './ProviderApp';
62
+ export * from './ProviderInfo';
54
63
  export * from './Revision';
55
64
  export * from './SignedUrl';
65
+ export * from './Support';
66
+ export * from './TokenMetadataFields';
67
+ export * from './UpdateDestinationRequest';
68
+ export * from './UpdateDestinationRequestDestination';
56
69
  export * from './UpdateInstallationConfigContent';
57
70
  export * from './UpdateInstallationRequest';
58
71
  export * from './UpdateInstallationRequestInstallation';
@@ -16,6 +16,9 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* tslint:disable */
18
18
  /* eslint-disable */
19
+ __exportStar(require("./ApiKey"), exports);
20
+ __exportStar(require("./ApiKeyRequest"), exports);
21
+ __exportStar(require("./AuthType"), exports);
19
22
  __exportStar(require("./BaseConfigContent"), exports);
20
23
  __exportStar(require("./BaseProxyConfig"), exports);
21
24
  __exportStar(require("./BaseReadConfig"), exports);
@@ -29,6 +32,8 @@ __exportStar(require("./ConfigContentAllOf"), exports);
29
32
  __exportStar(require("./Connection"), exports);
30
33
  __exportStar(require("./Consumer"), exports);
31
34
  __exportStar(require("./CreateConsumerRequest"), exports);
35
+ __exportStar(require("./CreateDestinationRequest"), exports);
36
+ __exportStar(require("./CreateDestinationRequestMetadata"), exports);
32
37
  __exportStar(require("./CreateGroupRequest"), exports);
33
38
  __exportStar(require("./CreateInstallationRequest"), exports);
34
39
  __exportStar(require("./CreateInstallationRequestConfig"), exports);
@@ -37,7 +42,6 @@ __exportStar(require("./CreateIntegrationRequestLatestRevision"), exports);
37
42
  __exportStar(require("./CreateProjectRequest"), exports);
38
43
  __exportStar(require("./CreateProviderAppRequest"), exports);
39
44
  __exportStar(require("./Destination"), exports);
40
- __exportStar(require("./DestinationMetadata"), exports);
41
45
  __exportStar(require("./Group"), exports);
42
46
  __exportStar(require("./HydratedIntegration"), exports);
43
47
  __exportStar(require("./HydratedIntegrationField"), exports);
@@ -62,15 +66,24 @@ __exportStar(require("./IntegrationProxy"), exports);
62
66
  __exportStar(require("./IntegrationRead"), exports);
63
67
  __exportStar(require("./IntegrationWrite"), exports);
64
68
  __exportStar(require("./IntegrationWriteObject"), exports);
69
+ __exportStar(require("./Log"), exports);
65
70
  __exportStar(require("./OauthConnectRequest"), exports);
71
+ __exportStar(require("./OauthOpts"), exports);
66
72
  __exportStar(require("./Operation"), exports);
67
- __exportStar(require("./OperationLog"), exports);
73
+ __exportStar(require("./OperationEvent"), exports);
68
74
  __exportStar(require("./OptionalFieldsAutoOption"), exports);
75
+ __exportStar(require("./PatchApiKeyRequest"), exports);
76
+ __exportStar(require("./PatchApiKeyRequestApiKey"), exports);
69
77
  __exportStar(require("./Project"), exports);
70
78
  __exportStar(require("./ProjectMembership"), exports);
71
79
  __exportStar(require("./ProviderApp"), exports);
80
+ __exportStar(require("./ProviderInfo"), exports);
72
81
  __exportStar(require("./Revision"), exports);
73
82
  __exportStar(require("./SignedUrl"), exports);
83
+ __exportStar(require("./Support"), exports);
84
+ __exportStar(require("./TokenMetadataFields"), exports);
85
+ __exportStar(require("./UpdateDestinationRequest"), exports);
86
+ __exportStar(require("./UpdateDestinationRequestDestination"), exports);
74
87
  __exportStar(require("./UpdateInstallationConfigContent"), exports);
75
88
  __exportStar(require("./UpdateInstallationRequest"), exports);
76
89
  __exportStar(require("./UpdateInstallationRequestInstallation"), exports);
@@ -1,4 +1,4 @@
1
- import { Config, CreateInstallationRequestConfig, Installation } from '../../../services/api';
1
+ import { Config, CreateInstallationRequestConfig, Installation } from '../../../../services/api';
2
2
  export type CreateInstallationSharedProps = {
3
3
  projectId: string;
4
4
  integrationId: string;
@@ -8,8 +8,8 @@ export type CreateInstallationSharedProps = {
8
8
  setInstallation: (installationObj: Installation) => void;
9
9
  onInstallSuccess?: (installationId: string, config: Config) => void;
10
10
  };
11
- type CreateInstallationReducer = CreateInstallationSharedProps & {
11
+ type CreateInstallationAndSetStateProps = CreateInstallationSharedProps & {
12
12
  createConfig: CreateInstallationRequestConfig;
13
13
  };
14
- export declare function createInstallationReducer({ createConfig, projectId, integrationId, groupRef, connectionId, apiKey, setInstallation, onInstallSuccess, }: CreateInstallationReducer): Promise<void>;
14
+ export declare function createInstallationAndSetState({ createConfig, projectId, integrationId, groupRef, connectionId, apiKey, setInstallation, onInstallSuccess, }: CreateInstallationAndSetStateProps): Promise<void>;
15
15
  export {};
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createInstallationReducer = void 0;
4
- const api_1 = require("../../../services/api");
5
- function createInstallationReducer({ createConfig, projectId, integrationId, groupRef, connectionId, apiKey, setInstallation, onInstallSuccess, }) {
3
+ exports.createInstallationAndSetState = void 0;
4
+ const api_1 = require("../../../../services/api");
5
+ function createInstallationAndSetState({ createConfig, projectId, integrationId, groupRef, connectionId, apiKey, setInstallation, onInstallSuccess, }) {
6
6
  const createInstallationRequest = {
7
7
  projectId,
8
8
  integrationId,
@@ -27,4 +27,4 @@ function createInstallationReducer({ createConfig, projectId, integrationId, gro
27
27
  console.error('ERROR: ', err);
28
28
  });
29
29
  }
30
- exports.createInstallationReducer = createInstallationReducer;
30
+ exports.createInstallationAndSetState = createInstallationAndSetState;
@@ -0,0 +1,15 @@
1
+ import { Config, Installation, UpdateInstallationRequestInstallationConfig } from '../../../../services/api';
2
+ type UpdateInstallationSharedProps = {
3
+ projectId: string;
4
+ integrationId: string;
5
+ installationId: string;
6
+ apiKey: string;
7
+ selectedObjectName: string;
8
+ setInstallation: (installationObj: Installation) => void;
9
+ onUpdateSuccess?: (installationId: string, config: Config) => void;
10
+ };
11
+ type UpdateInstallationAndSetStateProps = UpdateInstallationSharedProps & {
12
+ updateConfig: UpdateInstallationRequestInstallationConfig;
13
+ };
14
+ export declare function updateInstallationAndSetState({ updateConfig, projectId, integrationId, installationId, apiKey, selectedObjectName, setInstallation, onUpdateSuccess, }: UpdateInstallationAndSetStateProps): Promise<void>;
15
+ export {};
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateInstallationAndSetState = void 0;
4
+ const api_1 = require("../../../../services/api");
5
+ function updateInstallationAndSetState({ updateConfig, projectId, integrationId, installationId, apiKey, selectedObjectName, setInstallation, onUpdateSuccess, }) {
6
+ const updateInstallationRequest = {
7
+ projectId,
8
+ installationId,
9
+ integrationId,
10
+ installationUpdate: {
11
+ // update mask will recurse to the object path and replace the object at the object path
12
+ // this example will replace the object at the object (i.e. accounts)
13
+ updateMask: [`config.content.read.standardObjects.${selectedObjectName}`],
14
+ installation: {
15
+ config: updateConfig,
16
+ },
17
+ },
18
+ };
19
+ // call api.updateInstallation
20
+ return (0, api_1.api)().installationApi.updateInstallation(updateInstallationRequest, {
21
+ headers: {
22
+ 'X-Api-Key': apiKey,
23
+ 'Content-Type': 'application/json',
24
+ },
25
+ }).then((installation) => {
26
+ // update local installation state
27
+ setInstallation(installation);
28
+ onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess(installation.id, installation.config);
29
+ }).catch((err) => {
30
+ console.error('ERROR: ', err);
31
+ });
32
+ }
33
+ exports.updateInstallationAndSetState = updateInstallationAndSetState;
@@ -0,0 +1,2 @@
1
+ import { HydratedRevision } from '../../../../services/api';
2
+ export declare function getIsProxyEnabled(hydratedRevision: HydratedRevision): boolean | undefined;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getIsProxyEnabled = void 0;
4
+ function getIsProxyEnabled(hydratedRevision) {
5
+ var _a;
6
+ return (_a = hydratedRevision.content.proxy) === null || _a === void 0 ? void 0 : _a.enabled;
7
+ }
8
+ exports.getIsProxyEnabled = getIsProxyEnabled;
@@ -0,0 +1,8 @@
1
+ import { HydratedRevision } from '../../../../services/api';
2
+ import { CreateInstallationSharedProps } from '../mutateAndSetState/createInstallationAndSetState';
3
+ type CreateInstallationProxyOnlyProps = CreateInstallationSharedProps & {
4
+ hydratedRevision: HydratedRevision;
5
+ consumerRef: string;
6
+ };
7
+ export declare function onCreateInstallationProxyOnly({ projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, setInstallation, onInstallSuccess, }: CreateInstallationProxyOnlyProps): Promise<void> | Promise<null>;
8
+ export {};
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createInstallationProxyOnly = void 0;
4
- const createInstallationReducer_1 = require("../createInstallationReducer");
3
+ exports.onCreateInstallationProxyOnly = void 0;
4
+ const createInstallationAndSetState_1 = require("../mutateAndSetState/createInstallationAndSetState");
5
5
  /**
6
6
  * given a hydratedRevision and consumerRef,
7
7
  * generate the config object that is need for create installation request with proxy only.
@@ -24,13 +24,13 @@ const generateProxyOnlyConfig = (hydratedRevision, consumerRef) => {
24
24
  };
25
25
  return createConfigObj;
26
26
  };
27
- function createInstallationProxyOnly({ projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, setInstallation, onInstallSuccess, }) {
27
+ function onCreateInstallationProxyOnly({ projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, setInstallation, onInstallSuccess, }) {
28
28
  const createConfig = generateProxyOnlyConfig(hydratedRevision, consumerRef);
29
29
  if (!createConfig) {
30
30
  console.error('Error when generating createConfig from configureState');
31
31
  return Promise.resolve(null);
32
32
  }
33
- return (0, createInstallationReducer_1.createInstallationReducer)({
33
+ return (0, createInstallationAndSetState_1.createInstallationAndSetState)({
34
34
  createConfig,
35
35
  projectId,
36
36
  integrationId,
@@ -41,4 +41,4 @@ function createInstallationProxyOnly({ projectId, integrationId, groupRef, consu
41
41
  onInstallSuccess,
42
42
  });
43
43
  }
44
- exports.createInstallationProxyOnly = createInstallationProxyOnly;
44
+ exports.onCreateInstallationProxyOnly = onCreateInstallationProxyOnly;
@@ -1,3 +1,3 @@
1
- import { Config, HydratedRevision, Installation } from '../../../services/api';
2
- import { ConfigureState } from '../types';
1
+ import { Config, HydratedRevision, Installation } from '../../../../services/api';
2
+ import { ConfigureState } from '../../types';
3
3
  export declare const onSaveReadCreateInstallation: (projectId: string, integrationId: string, groupRef: string, consumerRef: string, connectionId: string, objectName: string, apiKey: string, hydratedRevision: HydratedRevision, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onInstallSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onSaveReadCreateInstallation = void 0;
4
- const utils_1 = require("../state/utils");
5
- const createInstallationReducer_1 = require("./createInstallationReducer");
4
+ const utils_1 = require("../../state/utils");
5
+ const createInstallationAndSetState_1 = require("../mutateAndSetState/createInstallationAndSetState");
6
+ const isProxyEnabled_1 = require("../proxy/isProxyEnabled");
6
7
  /**
7
8
  * gets matching object from hydratedRevision
8
9
  * @param hydratedRevision
@@ -56,6 +57,11 @@ const generateCreateReadConfigFromConfigureState = (configureState, objectName,
56
57
  },
57
58
  },
58
59
  };
60
+ // insert proxy into config if it is enabled
61
+ const isProxyEnabled = (0, isProxyEnabled_1.getIsProxyEnabled)(hydratedRevision);
62
+ if (isProxyEnabled) {
63
+ createConfigObj.content.proxy = { enabled: true };
64
+ }
59
65
  return createConfigObj;
60
66
  };
61
67
  const onSaveReadCreateInstallation = (projectId, integrationId, groupRef, consumerRef, connectionId, objectName, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess) => {
@@ -64,7 +70,7 @@ const onSaveReadCreateInstallation = (projectId, integrationId, groupRef, consum
64
70
  console.error('Error when generating createConfig from configureState');
65
71
  return Promise.resolve(null);
66
72
  }
67
- return (0, createInstallationReducer_1.createInstallationReducer)({
73
+ return (0, createInstallationAndSetState_1.createInstallationAndSetState)({
68
74
  createConfig,
69
75
  projectId,
70
76
  integrationId,
@@ -0,0 +1,3 @@
1
+ import { Config, HydratedIntegrationObject, HydratedRevision, Installation } from '../../../../services/api';
2
+ import { ConfigureState } from '../../types';
3
+ export declare const onSaveReadUpdateInstallation: (projectId: string, integrationId: string, installationId: string, selectedObjectName: string, apiKey: string, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, hydratedObject: HydratedIntegrationObject, hydratedRevision: HydratedRevision, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onSaveReadUpdateInstallation = void 0;
4
- const api_1 = require("../../../services/api");
5
- const utils_1 = require("../state/utils");
4
+ const utils_1 = require("../../state/utils");
5
+ const updateInstallationAndSetState_1 = require("../mutateAndSetState/updateInstallationAndSetState");
6
+ const isProxyEnabled_1 = require("../proxy/isProxyEnabled");
6
7
  /**
7
8
  * given a configureState, config, and objectName, generate the config object that is need for
8
9
  * update installation request.
@@ -19,7 +20,7 @@ const utils_1 = require("../state/utils");
19
20
  * @param schedule
20
21
  * @returns
21
22
  */
22
- const generateUpdateReadConfigFromConfigureState = (configureState, objectName, hydratedObject, schedule) => {
23
+ const generateUpdateReadConfigFromConfigureState = (configureState, objectName, hydratedObject, schedule, hydratedRevision) => {
23
24
  const selectedFields = (0, utils_1.generateSelectedFieldsFromConfigureState)(configureState);
24
25
  const selectedFieldMappings = (0, utils_1.generateSelectedFieldMappingsFromConfigureState)(configureState);
25
26
  // config request object type needs to be fixed
@@ -39,41 +40,32 @@ const generateUpdateReadConfigFromConfigureState = (configureState, objectName,
39
40
  },
40
41
  },
41
42
  };
43
+ // insert proxy into config if it is enabled
44
+ const isProxyEnabled = (0, isProxyEnabled_1.getIsProxyEnabled)(hydratedRevision);
45
+ if (isProxyEnabled) {
46
+ if (!updateConfigObject.content)
47
+ updateConfigObject.content = {};
48
+ updateConfigObject.content.proxy = { enabled: true };
49
+ }
42
50
  return updateConfigObject;
43
51
  };
44
- const onSaveReadUpdateInstallation = (projectId, integrationId, installationId, selectedObjectName, apiKey, configureState, setInstallation, hydratedObject, onUpdateSuccess) => {
52
+ const onSaveReadUpdateInstallation = (projectId, integrationId, installationId, selectedObjectName, apiKey, configureState, setInstallation, hydratedObject, hydratedRevision, onUpdateSuccess) => {
45
53
  // get configuration state
46
54
  // transform configuration state to update shape
47
- const updateConfig = generateUpdateReadConfigFromConfigureState(configureState, selectedObjectName || '', hydratedObject, hydratedObject.schedule);
55
+ const updateConfig = generateUpdateReadConfigFromConfigureState(configureState, selectedObjectName || '', hydratedObject, hydratedObject.schedule, hydratedRevision);
48
56
  if (!updateConfig) {
49
57
  console.error('Error when generating updateConfig from configureState');
50
58
  return Promise.resolve(null);
51
59
  }
52
- const updateInstallationRequest = {
60
+ return (0, updateInstallationAndSetState_1.updateInstallationAndSetState)({
61
+ updateConfig,
53
62
  projectId,
54
- installationId,
55
63
  integrationId,
56
- installationUpdate: {
57
- // update mask will recurse to the object path and replace the object at the object path
58
- // this example will replace the object at the object (i.e. accounts)
59
- updateMask: [`config.content.read.standardObjects.${selectedObjectName}`],
60
- installation: {
61
- config: updateConfig,
62
- },
63
- },
64
- };
65
- // call api.updateInstallation
66
- return (0, api_1.api)().installationApi.updateInstallation(updateInstallationRequest, {
67
- headers: {
68
- 'X-Api-Key': apiKey,
69
- 'Content-Type': 'application/json',
70
- },
71
- }).then((installation) => {
72
- // update local installation state
73
- setInstallation(installation);
74
- onUpdateSuccess === null || onUpdateSuccess === void 0 ? void 0 : onUpdateSuccess(installation.id, installation.config);
75
- }).catch((err) => {
76
- console.error('ERROR: ', err);
64
+ installationId,
65
+ apiKey,
66
+ selectedObjectName,
67
+ setInstallation,
68
+ onUpdateSuccess,
77
69
  });
78
70
  };
79
71
  exports.onSaveReadUpdateInstallation = onSaveReadUpdateInstallation;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onSaveWriteCreateInstallation = void 0;
4
- const createInstallationReducer_1 = require("../createInstallationReducer");
4
+ const createInstallationAndSetState_1 = require("../mutateAndSetState/createInstallationAndSetState");
5
+ const isProxyEnabled_1 = require("../proxy/isProxyEnabled");
5
6
  const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
6
7
  /**
7
8
  * gets write objects from hydratedRevision
@@ -41,7 +42,8 @@ const generateCreateWriteConfigFromConfigureState = (configureState, hydratedRev
41
42
  createdBy: `consumer:${consumerRef}`,
42
43
  content: {
43
44
  provider: hydratedRevision.content.provider,
44
- // need empty read.standardObjects for update read
45
+ // hack: need empty read.standardObjects to be initialized for update read
46
+ // https://linear.app/ampersand/issue/ENG-780/bug-write-createupdate-installation-without-read
45
47
  read: {
46
48
  standardObjects: {},
47
49
  },
@@ -50,6 +52,11 @@ const generateCreateWriteConfigFromConfigureState = (configureState, hydratedRev
50
52
  },
51
53
  },
52
54
  };
55
+ // insert proxy into config if it is enabled
56
+ const isProxyEnabled = (0, isProxyEnabled_1.getIsProxyEnabled)(hydratedRevision);
57
+ if (isProxyEnabled) {
58
+ createConfigObj.content.proxy = { enabled: true };
59
+ }
53
60
  return createConfigObj;
54
61
  };
55
62
  const onSaveWriteCreateInstallation = (projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, configureState, setInstallation, onInstallSuccess) => {
@@ -58,7 +65,7 @@ const onSaveWriteCreateInstallation = (projectId, integrationId, groupRef, consu
58
65
  console.error('Error when generating createConfig from configureState');
59
66
  return Promise.resolve(null);
60
67
  }
61
- return (0, createInstallationReducer_1.createInstallationReducer)({
68
+ return (0, createInstallationAndSetState_1.createInstallationAndSetState)({
62
69
  createConfig,
63
70
  projectId,
64
71
  integrationId,
@@ -1,3 +1,3 @@
1
- import { Config, Installation } from '../../../../services/api';
1
+ import { Config, HydratedRevision, Installation } from '../../../../services/api';
2
2
  import { ConfigureState } from '../../types';
3
- export declare const onSaveWriteUpdateInstallation: (projectId: string, integrationId: string, installationId: string, apiKey: string, configureState: ConfigureState, setInstallation: (installationObj: Installation) => void, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
3
+ export declare const onSaveWriteUpdateInstallation: (projectId: string, integrationId: string, installationId: string, apiKey: string, configureState: ConfigureState, hydratedRevision: HydratedRevision, setInstallation: (installationObj: Installation) => void, onUpdateSuccess?: ((installationId: string, config: Config) => void) | undefined) => Promise<void | null>;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onSaveWriteUpdateInstallation = void 0;
4
4
  const api_1 = require("../../../../services/api");
5
+ const isProxyEnabled_1 = require("../proxy/isProxyEnabled");
5
6
  const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
6
7
  /**
7
8
  * given a configureState generate the config object that is need for
@@ -10,7 +11,7 @@ const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
10
11
  * @param configureState
11
12
  * @returns
12
13
  */
13
- const generateUpdateWriteConfigFromConfigureState = (configureState) => {
14
+ const generateUpdateWriteConfigFromConfigureState = (configureState, hydratedRevision) => {
14
15
  const configWriteObjects = (0, generateConfigWriteObjects_1.generateConfigWriteObjects)(configureState);
15
16
  // config request object type needs to be fixed
16
17
  const updateConfigObject = {
@@ -20,12 +21,19 @@ const generateUpdateWriteConfigFromConfigureState = (configureState) => {
20
21
  },
21
22
  },
22
23
  };
24
+ // insert proxy into config if it is enabled
25
+ const isProxyEnabled = (0, isProxyEnabled_1.getIsProxyEnabled)(hydratedRevision);
26
+ if (isProxyEnabled) {
27
+ if (!updateConfigObject.content)
28
+ updateConfigObject.content = {};
29
+ updateConfigObject.content.proxy = { enabled: true };
30
+ }
23
31
  return updateConfigObject;
24
32
  };
25
- const onSaveWriteUpdateInstallation = (projectId, integrationId, installationId, apiKey, configureState, setInstallation, onUpdateSuccess) => {
33
+ const onSaveWriteUpdateInstallation = (projectId, integrationId, installationId, apiKey, configureState, hydratedRevision, setInstallation, onUpdateSuccess) => {
26
34
  // get configuration state
27
35
  // transform configuration state to update shape
28
- const updateConfig = generateUpdateWriteConfigFromConfigureState(configureState);
36
+ const updateConfig = generateUpdateWriteConfigFromConfigureState(configureState, hydratedRevision);
29
37
  if (!updateConfig) {
30
38
  console.error('Error when generating write updateConfig from configureState');
31
39
  return Promise.resolve(null);
@@ -7,7 +7,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
7
7
  */
8
8
  const react_1 = require("react");
9
9
  const ErrorContextProvider_1 = require("../../../context/ErrorContextProvider");
10
- const onSaveReadCreateInstallation_1 = require("../actions/onSaveReadCreateInstallation");
10
+ const onSaveReadCreateInstallation_1 = require("../actions/read/onSaveReadCreateInstallation");
11
11
  const onSaveWriteCreateInstallation_1 = require("../actions/write/onSaveWriteCreateInstallation");
12
12
  const constant_1 = require("../nav/ObjectManagementNav/constant");
13
13
  const utils_1 = require("../state/utils");
@@ -4,7 +4,7 @@ exports.UpdateInstallation = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const ErrorContextProvider_1 = require("../../../context/ErrorContextProvider");
7
- const onSaveReadUpdateInstallation_1 = require("../actions/onSaveReadUpdateInstallation");
7
+ const onSaveReadUpdateInstallation_1 = require("../actions/read/onSaveReadUpdateInstallation");
8
8
  const onSaveWriteUpdateInstallation_1 = require("../actions/write/onSaveWriteUpdateInstallation");
9
9
  const constant_1 = require("../nav/ObjectManagementNav/constant");
10
10
  const utils_1 = require("../state/utils");
@@ -51,9 +51,9 @@ function UpdateInstallation({ installation, integrationObj }) {
51
51
  if (errorList.length > 0) {
52
52
  return;
53
53
  }
54
- if (installation && selectedObjectName && apiKey && projectId && hydratedObject) {
54
+ if (hydratedRevision && installation && selectedObjectName && apiKey && projectId && hydratedObject) {
55
55
  setLoadingState(true);
56
- const res = (0, onSaveReadUpdateInstallation_1.onSaveReadUpdateInstallation)(projectId, integrationObj.id, installation.id, selectedObjectName, apiKey, configureState, setInstallation, hydratedObject, onUpdateSuccess);
56
+ const res = (0, onSaveReadUpdateInstallation_1.onSaveReadUpdateInstallation)(projectId, integrationObj.id, installation.id, selectedObjectName, apiKey, configureState, setInstallation, hydratedObject, hydratedRevision, onUpdateSuccess);
57
57
  res.finally(() => {
58
58
  setLoadingState(false);
59
59
  resetPendingConfigurationState(selectedObjectName);
@@ -64,9 +64,9 @@ function UpdateInstallation({ installation, integrationObj }) {
64
64
  }
65
65
  };
66
66
  const onSaveWrite = () => {
67
- if (installation && selectedObjectName && apiKey && projectId) {
67
+ if (installation && selectedObjectName && apiKey && projectId && hydratedRevision) {
68
68
  setLoadingState(true);
69
- const res = (0, onSaveWriteUpdateInstallation_1.onSaveWriteUpdateInstallation)(projectId, integrationObj.id, installation.id, apiKey, configureState, setInstallation, onUpdateSuccess);
69
+ const res = (0, onSaveWriteUpdateInstallation_1.onSaveWriteUpdateInstallation)(projectId, integrationObj.id, installation.id, apiKey, configureState, hydratedRevision, setInstallation, onUpdateSuccess);
70
70
  res.finally(() => {
71
71
  setLoadingState(false);
72
72
  resetPendingConfigurationState(selectedObjectName);
@@ -9,7 +9,7 @@ const ConnectionsContextProvider_1 = require("../../../../context/ConnectionsCon
9
9
  const InstallIntegrationContextProvider_1 = require("../../../../context/InstallIntegrationContextProvider");
10
10
  const ProjectContextProvider_1 = require("../../../../context/ProjectContextProvider");
11
11
  const ErrorTextBox_1 = require("../../../ErrorTextBox");
12
- const createInstallationProxyOnly_1 = require("../../actions/proxy/createInstallationProxyOnly");
12
+ const onCreateInstallationProxyOnly_1 = require("../../actions/proxy/onCreateInstallationProxyOnly");
13
13
  const HydratedRevisionContext_1 = require("../../state/HydratedRevisionContext");
14
14
  const InstalledSuccessBox_1 = require("./InstalledSuccessBox");
15
15
  // explicity check other actions (i.e. read, write) to determine if it's proxy only
@@ -38,7 +38,7 @@ function ConditionalProxyLayout({ children }) {
38
38
  (0, react_1.useEffect)(() => {
39
39
  if (hydratedRevision && isProxyOnly && !installation && selectedConnection && apiKey && (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id)) {
40
40
  setCreateInstallLoading(true);
41
- (0, createInstallationProxyOnly_1.createInstallationProxyOnly)({
41
+ (0, onCreateInstallationProxyOnly_1.onCreateInstallationProxyOnly)({
42
42
  apiKey,
43
43
  projectId,
44
44
  integrationId: integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id,
@@ -3,12 +3,10 @@ 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("../../../constants");
7
6
  const ConnectionsContextProvider_1 = require("../../../context/ConnectionsContextProvider");
8
7
  const InstallIntegrationContextProvider_1 = require("../../../context/InstallIntegrationContextProvider");
9
8
  const useConnectionHandler_1 = require("../../Connect/useConnectionHandler");
10
- const NoSubdomainOauthFlow_1 = require("../../Oauth/NoSubdomainEntry/NoSubdomainOauthFlow");
11
- const SalesforceOauthFlow_1 = require("../../Oauth/Salesforce/SalesforceOauthFlow");
9
+ const OauthFlow_1 = require("../../Oauth/OauthFlow/OauthFlow");
12
10
  function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupRef, groupName, children, onSuccess, }) {
13
11
  const { provider: providerFromProps } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
14
12
  const { selectedConnection, setSelectedConnection, connections } = (0, ConnectionsContextProvider_1.useConnections)();
@@ -26,9 +24,6 @@ function ProtectedConnectionLayout({ provider, consumerRef, consumerName, groupR
26
24
  if (selectedConnection)
27
25
  return children;
28
26
  const selectedProvider = provider || providerFromProps;
29
- if (selectedProvider === constants_1.PROVIDER_SALESFORCE) {
30
- return ((0, jsx_runtime_1.jsx)(SalesforceOauthFlow_1.SalesforceOauthFlow, { consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
31
- }
32
- return ((0, jsx_runtime_1.jsx)(NoSubdomainOauthFlow_1.NoSubdomainOauthFlow, { provider: selectedProvider, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
27
+ return ((0, jsx_runtime_1.jsx)(OauthFlow_1.OauthFlow, { provider: selectedProvider, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName }));
33
28
  }
34
29
  exports.ProtectedConnectionLayout = ProtectedConnectionLayout;
@@ -29,17 +29,17 @@ const generateConfigurationStateRead = (readAction, objectName, config) => {
29
29
  const optionalFieldsSaved = Object.assign({}, readSelectedFields);
30
30
  const requiredMapFieldsSaved = Object.assign({}, selectedFieldMappings);
31
31
  return {
32
- allFields,
33
- requiredFields,
34
- optionalFields,
35
- requiredMapFields,
32
+ allFields, // from hydrated revision
33
+ requiredFields, // from hydrated revision
34
+ optionalFields, // from hydrated revision
35
+ requiredMapFields, // from hydrated revision
36
36
  // selected state
37
37
  selectedOptionalFields: readSelectedFields,
38
38
  selectedFieldMappings,
39
39
  isOptionalFieldsModified: false,
40
40
  isRequiredMapFieldsModified: false,
41
41
  savedConfig: {
42
- optionalFields: optionalFieldsSaved,
42
+ optionalFields: optionalFieldsSaved, // from config
43
43
  requiredMapFields: requiredMapFieldsSaved, // from config
44
44
  },
45
45
  };
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LandingContent = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@chakra-ui/react");
6
+ const utils_1 = require("../../../utils");
7
+ const OauthCardLayout_1 = require("../OauthCardLayout");
8
+ const OAuthErrorAlert_1 = require("../OAuthErrorAlert");
9
+ function LandingContent({ provider, handleSubmit, error, isButtonDisabled, }) {
10
+ return ((0, jsx_runtime_1.jsx)(OauthCardLayout_1.OauthCardLayout, { children: (0, jsx_runtime_1.jsxs)(react_1.FormControl, { children: [(0, jsx_runtime_1.jsx)(react_1.FormLabel, { marginTop: "16", marginBottom: "0", children: (0, jsx_runtime_1.jsx)(react_1.Heading, { as: "h4", size: "md", children: `Set up ${(0, utils_1.capitalize)(provider)} integration` }) }), (0, jsx_runtime_1.jsx)(OAuthErrorAlert_1.OAuthErrorAlert, { error: error }), (0, jsx_runtime_1.jsx)("br", {}), (0, jsx_runtime_1.jsx)(react_1.Button, { isDisabled: isButtonDisabled, width: "100%", type: "submit", onClick: handleSubmit, children: "Next" })] }) }));
11
+ }
12
+ exports.LandingContent = LandingContent;
@@ -1,7 +1,7 @@
1
1
  /**
2
- * OAuth flow for any providers that do not require the consumer to enter a subdomain first.
2
+ * OAuth flow for any providers that do not require the consumer to enter a workspace first.
3
3
  */
4
- interface NoSubdomainOauthFlowProps {
4
+ interface NoWorkspaceOauthFlowProps {
5
5
  provider: string;
6
6
  consumerRef: string;
7
7
  consumerName?: string;
@@ -9,8 +9,8 @@ interface NoSubdomainOauthFlowProps {
9
9
  groupName?: string;
10
10
  }
11
11
  /**
12
- * NoSubdomainOauthFlow first prompts user with a next button,
12
+ * NoWorkspaceOauthFlow first prompts user with a next button,
13
13
  * then launches a popup with the OAuth flow.
14
14
  */
15
- export declare function NoSubdomainOauthFlow({ provider, consumerRef, consumerName, groupRef, groupName, }: NoSubdomainOauthFlowProps): import("react/jsx-runtime").JSX.Element;
15
+ export declare function NoWorkspaceOauthFlow({ provider, consumerRef, consumerName, groupRef, groupName, }: NoWorkspaceOauthFlowProps): import("react/jsx-runtime").JSX.Element;
16
16
  export {};