@amp-labs/react 1.2.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.
Files changed (49) hide show
  1. package/build/generated-sources/api/src/apis/DestinationApi.d.ts +24 -0
  2. package/build/generated-sources/api/src/apis/DestinationApi.js +24 -0
  3. package/build/generated-sources/api/src/apis/InstallationApi.d.ts +28 -0
  4. package/build/generated-sources/api/src/apis/InstallationApi.js +30 -0
  5. package/build/generated-sources/api/src/apis/IntegrationApi.js +1 -4
  6. package/build/generated-sources/api/src/models/BaseConfigContent.d.ts +7 -0
  7. package/build/generated-sources/api/src/models/BaseConfigContent.js +3 -0
  8. package/build/generated-sources/api/src/models/BaseProxyConfig.d.ts +31 -0
  9. package/build/generated-sources/api/src/models/BaseProxyConfig.js +50 -0
  10. package/build/generated-sources/api/src/models/ConfigContent.d.ts +7 -0
  11. package/build/generated-sources/api/src/models/ConfigContent.js +3 -0
  12. package/build/generated-sources/api/src/models/HydratedIntegration.d.ts +7 -0
  13. package/build/generated-sources/api/src/models/HydratedIntegration.js +3 -0
  14. package/build/generated-sources/api/src/models/HydratedIntegrationProxy.d.ts +31 -0
  15. package/build/generated-sources/api/src/models/HydratedIntegrationProxy.js +50 -0
  16. package/build/generated-sources/api/src/models/ImportConnectionRequest.d.ts +1 -1
  17. package/build/generated-sources/api/src/models/Integration1.d.ts +7 -0
  18. package/build/generated-sources/api/src/models/Integration1.js +3 -0
  19. package/build/generated-sources/api/src/models/IntegrationProxy.d.ts +31 -0
  20. package/build/generated-sources/api/src/models/IntegrationProxy.js +50 -0
  21. package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +6 -6
  22. package/build/generated-sources/api/src/models/OauthConnectRequest.js +1 -2
  23. package/build/generated-sources/api/src/models/Operation.d.ts +26 -9
  24. package/build/generated-sources/api/src/models/Operation.js +14 -7
  25. package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.d.ts +7 -0
  26. package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.js +3 -0
  27. package/build/generated-sources/api/src/models/index.d.ts +3 -1
  28. package/build/generated-sources/api/src/models/index.js +3 -1
  29. package/build/src/assets/SuccessIcon.d.ts +1 -0
  30. package/build/src/assets/SuccessIcon.js +8 -0
  31. package/build/src/components/Configure/InstallIntegration.js +2 -1
  32. package/build/src/components/Configure/actions/createInstallationReducer.d.ts +15 -0
  33. package/build/src/components/Configure/actions/createInstallationReducer.js +30 -0
  34. package/build/src/components/Configure/actions/onSaveReadCreateInstallation.js +8 -21
  35. package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.d.ts +8 -0
  36. package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.js +44 -0
  37. package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +8 -21
  38. package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.d.ts +11 -0
  39. package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js +67 -0
  40. package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.d.ts +5 -0
  41. package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.js +11 -0
  42. package/build/src/components/Connect/ConnectedSuccessBox.js +3 -3
  43. package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +1 -1
  44. package/build/src/components/SuccessTextBox.d.ts +5 -0
  45. package/build/src/components/SuccessTextBox.js +10 -0
  46. package/build/src/services/api.js +23 -21
  47. package/package.json +1 -1
  48. package/build/generated-sources/api/src/models/OperationError.d.ts +0 -49
  49. package/build/generated-sources/api/src/models/OperationError.js +0 -56
@@ -23,7 +23,6 @@ function instanceOfOauthConnectRequest(value) {
23
23
  isInstance = isInstance && "projectId" in value;
24
24
  isInstance = isInstance && "groupRef" in value;
25
25
  isInstance = isInstance && "consumerRef" in value;
26
- isInstance = isInstance && "providerAppId" in value;
27
26
  isInstance = isInstance && "provider" in value;
28
27
  return isInstance;
29
28
  }
@@ -43,7 +42,7 @@ function OauthConnectRequestFromJSONTyped(json, ignoreDiscriminator) {
43
42
  'groupName': !(0, runtime_1.exists)(json, 'groupName') ? undefined : json['groupName'],
44
43
  'consumerRef': json['consumerRef'],
45
44
  'consumerName': !(0, runtime_1.exists)(json, 'consumerName') ? undefined : json['consumerName'],
46
- 'providerAppId': json['providerAppId'],
45
+ 'providerAppId': !(0, runtime_1.exists)(json, 'providerAppId') ? undefined : json['providerAppId'],
47
46
  'provider': json['provider'],
48
47
  };
49
48
  }
@@ -9,7 +9,6 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
- import type { OperationError } from './OperationError';
13
12
  /**
14
13
  *
15
14
  * @export
@@ -23,17 +22,23 @@ export interface Operation {
23
22
  */
24
23
  projectId: string;
25
24
  /**
26
- * The action type to perform for the given object.
25
+ * The integration ID.
27
26
  * @type {string}
28
27
  * @memberof Operation
29
28
  */
30
- actionType: string;
29
+ integrationId: string;
30
+ /**
31
+ * The config ID.
32
+ * @type {string}
33
+ * @memberof Operation
34
+ */
35
+ configId: string;
31
36
  /**
32
- * The provider object name to perform the action for
37
+ * The action type to perform for the given object.
33
38
  * @type {string}
34
39
  * @memberof Operation
35
40
  */
36
- objectName: string;
41
+ actionType: string;
37
42
  /**
38
43
  * The operation ID.
39
44
  * @type {string}
@@ -51,13 +56,25 @@ export interface Operation {
51
56
  * @type {string}
52
57
  * @memberof Operation
53
58
  */
54
- status?: string;
59
+ status: string;
60
+ /**
61
+ * The result of the operation.
62
+ * @type {string}
63
+ * @memberof Operation
64
+ */
65
+ result?: string;
66
+ /**
67
+ * The latest operation event ID.
68
+ * @type {string}
69
+ * @memberof Operation
70
+ */
71
+ latestOperationEventId?: string;
55
72
  /**
56
- * The error history of the operation.
57
- * @type {Array<OperationError>}
73
+ * Metadata associated with the operation.
74
+ * @type {object}
58
75
  * @memberof Operation
59
76
  */
60
- errorHistory?: Array<OperationError>;
77
+ metadata?: object;
61
78
  /**
62
79
  * The time the operation was created.
63
80
  * @type {Date}
@@ -15,17 +15,18 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.OperationToJSON = exports.OperationFromJSONTyped = exports.OperationFromJSON = exports.instanceOfOperation = void 0;
17
17
  const runtime_1 = require("../runtime");
18
- const OperationError_1 = require("./OperationError");
19
18
  /**
20
19
  * Check if a given object implements the Operation interface.
21
20
  */
22
21
  function instanceOfOperation(value) {
23
22
  let isInstance = true;
24
23
  isInstance = isInstance && "projectId" in value;
24
+ isInstance = isInstance && "integrationId" in value;
25
+ isInstance = isInstance && "configId" in value;
25
26
  isInstance = isInstance && "actionType" in value;
26
- isInstance = isInstance && "objectName" in value;
27
27
  isInstance = isInstance && "id" in value;
28
28
  isInstance = isInstance && "installationId" in value;
29
+ isInstance = isInstance && "status" in value;
29
30
  return isInstance;
30
31
  }
31
32
  exports.instanceOfOperation = instanceOfOperation;
@@ -39,12 +40,15 @@ function OperationFromJSONTyped(json, ignoreDiscriminator) {
39
40
  }
40
41
  return {
41
42
  'projectId': json['projectId'],
43
+ 'integrationId': json['integrationId'],
44
+ 'configId': json['configId'],
42
45
  'actionType': json['actionType'],
43
- 'objectName': json['objectName'],
44
46
  'id': json['id'],
45
47
  'installationId': json['installationId'],
46
- 'status': !(0, runtime_1.exists)(json, 'status') ? undefined : json['status'],
47
- 'errorHistory': !(0, runtime_1.exists)(json, 'errorHistory') ? undefined : (json['errorHistory'].map(OperationError_1.OperationErrorFromJSON)),
48
+ 'status': json['status'],
49
+ 'result': !(0, runtime_1.exists)(json, 'result') ? undefined : json['result'],
50
+ 'latestOperationEventId': !(0, runtime_1.exists)(json, 'latestOperationEventId') ? undefined : json['latestOperationEventId'],
51
+ 'metadata': !(0, runtime_1.exists)(json, 'metadata') ? undefined : json['metadata'],
48
52
  'createTime': !(0, runtime_1.exists)(json, 'createTime') ? undefined : (new Date(json['createTime'])),
49
53
  };
50
54
  }
@@ -58,12 +62,15 @@ function OperationToJSON(value) {
58
62
  }
59
63
  return {
60
64
  'projectId': value.projectId,
65
+ 'integrationId': value.integrationId,
66
+ 'configId': value.configId,
61
67
  'actionType': value.actionType,
62
- 'objectName': value.objectName,
63
68
  'id': value.id,
64
69
  'installationId': value.installationId,
65
70
  'status': value.status,
66
- 'errorHistory': value.errorHistory === undefined ? undefined : (value.errorHistory.map(OperationError_1.OperationErrorToJSON)),
71
+ 'result': value.result,
72
+ 'latestOperationEventId': value.latestOperationEventId,
73
+ 'metadata': value.metadata,
67
74
  'createTime': value.createTime === undefined ? undefined : (value.createTime.toISOString()),
68
75
  };
69
76
  }
@@ -9,6 +9,7 @@
9
9
  * https://openapi-generator.tech
10
10
  * Do not edit the class manually.
11
11
  */
12
+ import type { BaseProxyConfig } from './BaseProxyConfig';
12
13
  import type { BaseReadConfig } from './BaseReadConfig';
13
14
  import type { BaseWriteConfig } from './BaseWriteConfig';
14
15
  /**
@@ -35,6 +36,12 @@ export interface UpdateInstallationConfigContent {
35
36
  * @memberof UpdateInstallationConfigContent
36
37
  */
37
38
  write?: BaseWriteConfig;
39
+ /**
40
+ *
41
+ * @type {BaseProxyConfig}
42
+ * @memberof UpdateInstallationConfigContent
43
+ */
44
+ proxy?: BaseProxyConfig;
38
45
  }
39
46
  /**
40
47
  * Check if a given object implements the UpdateInstallationConfigContent interface.
@@ -15,6 +15,7 @@
15
15
  Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.UpdateInstallationConfigContentToJSON = exports.UpdateInstallationConfigContentFromJSONTyped = exports.UpdateInstallationConfigContentFromJSON = exports.instanceOfUpdateInstallationConfigContent = void 0;
17
17
  const runtime_1 = require("../runtime");
18
+ const BaseProxyConfig_1 = require("./BaseProxyConfig");
18
19
  const BaseReadConfig_1 = require("./BaseReadConfig");
19
20
  const BaseWriteConfig_1 = require("./BaseWriteConfig");
20
21
  /**
@@ -37,6 +38,7 @@ function UpdateInstallationConfigContentFromJSONTyped(json, ignoreDiscriminator)
37
38
  'provider': !(0, runtime_1.exists)(json, 'provider') ? undefined : json['provider'],
38
39
  'read': !(0, runtime_1.exists)(json, 'read') ? undefined : (0, BaseReadConfig_1.BaseReadConfigFromJSON)(json['read']),
39
40
  'write': !(0, runtime_1.exists)(json, 'write') ? undefined : (0, BaseWriteConfig_1.BaseWriteConfigFromJSON)(json['write']),
41
+ 'proxy': !(0, runtime_1.exists)(json, 'proxy') ? undefined : (0, BaseProxyConfig_1.BaseProxyConfigFromJSON)(json['proxy']),
40
42
  };
41
43
  }
42
44
  exports.UpdateInstallationConfigContentFromJSONTyped = UpdateInstallationConfigContentFromJSONTyped;
@@ -51,6 +53,7 @@ function UpdateInstallationConfigContentToJSON(value) {
51
53
  'provider': value.provider,
52
54
  'read': (0, BaseReadConfig_1.BaseReadConfigToJSON)(value.read),
53
55
  'write': (0, BaseWriteConfig_1.BaseWriteConfigToJSON)(value.write),
56
+ 'proxy': (0, BaseProxyConfig_1.BaseProxyConfigToJSON)(value.proxy),
54
57
  };
55
58
  }
56
59
  exports.UpdateInstallationConfigContentToJSON = UpdateInstallationConfigContentToJSON;
@@ -1,4 +1,5 @@
1
1
  export * from './BaseConfigContent';
2
+ export * from './BaseProxyConfig';
2
3
  export * from './BaseReadConfig';
3
4
  export * from './BaseReadConfigStandardObject';
4
5
  export * from './BaseWriteConfig';
@@ -24,6 +25,7 @@ export * from './HydratedIntegration';
24
25
  export * from './HydratedIntegrationField';
25
26
  export * from './HydratedIntegrationFieldExistent';
26
27
  export * from './HydratedIntegrationObject';
28
+ export * from './HydratedIntegrationProxy';
27
29
  export * from './HydratedIntegrationRead';
28
30
  export * from './HydratedIntegrationWrite';
29
31
  export * from './HydratedIntegrationWriteObject';
@@ -38,12 +40,12 @@ export * from './IntegrationField';
38
40
  export * from './IntegrationFieldExistent';
39
41
  export * from './IntegrationFieldMapping';
40
42
  export * from './IntegrationObject';
43
+ export * from './IntegrationProxy';
41
44
  export * from './IntegrationRead';
42
45
  export * from './IntegrationWrite';
43
46
  export * from './IntegrationWriteObject';
44
47
  export * from './OauthConnectRequest';
45
48
  export * from './Operation';
46
- export * from './OperationError';
47
49
  export * from './OperationLog';
48
50
  export * from './OptionalFieldsAutoOption';
49
51
  export * from './Project';
@@ -17,6 +17,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  /* tslint:disable */
18
18
  /* eslint-disable */
19
19
  __exportStar(require("./BaseConfigContent"), exports);
20
+ __exportStar(require("./BaseProxyConfig"), exports);
20
21
  __exportStar(require("./BaseReadConfig"), exports);
21
22
  __exportStar(require("./BaseReadConfigStandardObject"), exports);
22
23
  __exportStar(require("./BaseWriteConfig"), exports);
@@ -42,6 +43,7 @@ __exportStar(require("./HydratedIntegration"), exports);
42
43
  __exportStar(require("./HydratedIntegrationField"), exports);
43
44
  __exportStar(require("./HydratedIntegrationFieldExistent"), exports);
44
45
  __exportStar(require("./HydratedIntegrationObject"), exports);
46
+ __exportStar(require("./HydratedIntegrationProxy"), exports);
45
47
  __exportStar(require("./HydratedIntegrationRead"), exports);
46
48
  __exportStar(require("./HydratedIntegrationWrite"), exports);
47
49
  __exportStar(require("./HydratedIntegrationWriteObject"), exports);
@@ -56,12 +58,12 @@ __exportStar(require("./IntegrationField"), exports);
56
58
  __exportStar(require("./IntegrationFieldExistent"), exports);
57
59
  __exportStar(require("./IntegrationFieldMapping"), exports);
58
60
  __exportStar(require("./IntegrationObject"), exports);
61
+ __exportStar(require("./IntegrationProxy"), exports);
59
62
  __exportStar(require("./IntegrationRead"), exports);
60
63
  __exportStar(require("./IntegrationWrite"), exports);
61
64
  __exportStar(require("./IntegrationWriteObject"), exports);
62
65
  __exportStar(require("./OauthConnectRequest"), exports);
63
66
  __exportStar(require("./Operation"), exports);
64
- __exportStar(require("./OperationError"), exports);
65
67
  __exportStar(require("./OperationLog"), exports);
66
68
  __exportStar(require("./OptionalFieldsAutoOption"), exports);
67
69
  __exportStar(require("./Project"), exports);
@@ -0,0 +1 @@
1
+ export declare function SuccessCheckmarkIcon(): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuccessCheckmarkIcon = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ function SuccessCheckmarkIcon() {
6
+ return ((0, jsx_runtime_1.jsxs)("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("circle", { cx: "24", cy: "24", r: "24", fill: "#BBF7D0" }), (0, jsx_runtime_1.jsx)("path", { d: "M34.6666 18.6667L20 32.0001L13.3333 25.9395", stroke: "#16A34A", strokeWidth: "5.33333", strokeLinecap: "round", strokeLinejoin: "round" })] }));
7
+ }
8
+ exports.SuccessCheckmarkIcon = SuccessCheckmarkIcon;
@@ -8,6 +8,7 @@ const InstallIntegrationContextProvider_1 = require("../../context/InstallIntegr
8
8
  const ProjectContextProvider_1 = require("../../context/ProjectContextProvider");
9
9
  const ErrorTextBox_1 = require("../ErrorTextBox");
10
10
  const InstallationContent_1 = require("./content/InstallationContent");
11
+ const ConditionalProxyLayout_1 = require("./layout/ConditionalProxyLayout/ConditionalProxyLayout");
11
12
  const ProtectedConnectionLayout_1 = require("./layout/ProtectedConnectionLayout");
12
13
  const ObjectManagementNav_1 = require("./nav/ObjectManagementNav");
13
14
  const ConfigurationStateProvider_1 = require("./state/ConfigurationStateProvider");
@@ -21,6 +22,6 @@ function InstallIntegration({ integration, consumerRef, consumerName, groupRef,
21
22
  }
22
23
  return (
23
24
  // install integration provider provides all props, integrationObj and installation
24
- (0, jsx_runtime_1.jsx)(InstallIntegrationContextProvider_1.InstallIntegrationProvider, { integration: integration, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, onInstallSuccess: onInstallSuccess, onUpdateSuccess: onUpdateSuccess, children: (0, jsx_runtime_1.jsx)(ConnectionsContextProvider_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_1.InstallationContent, {}) }) }) }) }) }) }));
25
+ (0, jsx_runtime_1.jsx)(InstallIntegrationContextProvider_1.InstallIntegrationProvider, { integration: integration, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, onInstallSuccess: onInstallSuccess, onUpdateSuccess: onUpdateSuccess, children: (0, jsx_runtime_1.jsx)(ConnectionsContextProvider_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)(ConditionalProxyLayout_1.ConditionalProxyLayout, { 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_1.InstallationContent, {}) }) }) }) }) }) }) }));
25
26
  }
26
27
  exports.InstallIntegration = InstallIntegration;
@@ -0,0 +1,15 @@
1
+ import { Config, CreateInstallationRequestConfig, Installation } from '../../../services/api';
2
+ export type CreateInstallationSharedProps = {
3
+ projectId: string;
4
+ integrationId: string;
5
+ groupRef: string;
6
+ connectionId: string;
7
+ apiKey: string;
8
+ setInstallation: (installationObj: Installation) => void;
9
+ onInstallSuccess?: (installationId: string, config: Config) => void;
10
+ };
11
+ type CreateInstallationReducer = CreateInstallationSharedProps & {
12
+ createConfig: CreateInstallationRequestConfig;
13
+ };
14
+ export declare function createInstallationReducer({ createConfig, projectId, integrationId, groupRef, connectionId, apiKey, setInstallation, onInstallSuccess, }: CreateInstallationReducer): Promise<void>;
15
+ export {};
@@ -0,0 +1,30 @@
1
+ "use strict";
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, }) {
6
+ const createInstallationRequest = {
7
+ projectId,
8
+ integrationId,
9
+ installation: {
10
+ groupRef,
11
+ connectionId,
12
+ config: createConfig,
13
+ },
14
+ };
15
+ return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
16
+ headers: {
17
+ 'X-Api-Key': apiKey,
18
+ 'Content-Type': 'application/json',
19
+ },
20
+ })
21
+ .then((installation) => {
22
+ // update local installation state
23
+ setInstallation(installation);
24
+ onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
25
+ })
26
+ .catch((err) => {
27
+ console.error('ERROR: ', err);
28
+ });
29
+ }
30
+ exports.createInstallationReducer = createInstallationReducer;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onSaveReadCreateInstallation = void 0;
4
- const api_1 = require("../../../services/api");
5
4
  const utils_1 = require("../state/utils");
5
+ const createInstallationReducer_1 = require("./createInstallationReducer");
6
6
  /**
7
7
  * gets matching object from hydratedRevision
8
8
  * @param hydratedRevision
@@ -64,28 +64,15 @@ const onSaveReadCreateInstallation = (projectId, integrationId, groupRef, consum
64
64
  console.error('Error when generating createConfig from configureState');
65
65
  return Promise.resolve(null);
66
66
  }
67
- const createInstallationRequest = {
67
+ return (0, createInstallationReducer_1.createInstallationReducer)({
68
+ createConfig,
68
69
  projectId,
69
70
  integrationId,
70
- installation: {
71
- groupRef,
72
- connectionId,
73
- config: createConfig,
74
- },
75
- };
76
- return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
77
- headers: {
78
- 'X-Api-Key': apiKey,
79
- 'Content-Type': 'application/json',
80
- },
81
- })
82
- .then((installation) => {
83
- // update local installation state
84
- setInstallation(installation);
85
- onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
86
- })
87
- .catch((err) => {
88
- console.error('ERROR: ', err);
71
+ groupRef,
72
+ connectionId,
73
+ apiKey,
74
+ setInstallation,
75
+ onInstallSuccess,
89
76
  });
90
77
  };
91
78
  exports.onSaveReadCreateInstallation = onSaveReadCreateInstallation;
@@ -0,0 +1,8 @@
1
+ import { HydratedRevision } from '../../../../services/api';
2
+ import { CreateInstallationSharedProps } from '../createInstallationReducer';
3
+ type CreateInstallationProxyOnlyProps = CreateInstallationSharedProps & {
4
+ hydratedRevision: HydratedRevision;
5
+ consumerRef: string;
6
+ };
7
+ export declare function createInstallationProxyOnly({ projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, setInstallation, onInstallSuccess, }: CreateInstallationProxyOnlyProps): Promise<void> | Promise<null>;
8
+ export {};
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInstallationProxyOnly = void 0;
4
+ const createInstallationReducer_1 = require("../createInstallationReducer");
5
+ /**
6
+ * given a hydratedRevision and consumerRef,
7
+ * generate the config object that is need for create installation request with proxy only.
8
+ *
9
+ * @param hydratedRevision
10
+ * @param consumerRef
11
+ * @returns
12
+ */
13
+ const generateProxyOnlyConfig = (hydratedRevision, consumerRef) => {
14
+ // create config request object
15
+ const createConfigObj = {
16
+ revisionId: hydratedRevision.id,
17
+ createdBy: `consumer:${consumerRef}`,
18
+ content: {
19
+ provider: hydratedRevision.content.provider,
20
+ proxy: {
21
+ enabled: true,
22
+ },
23
+ },
24
+ };
25
+ return createConfigObj;
26
+ };
27
+ function createInstallationProxyOnly({ projectId, integrationId, groupRef, consumerRef, connectionId, apiKey, hydratedRevision, setInstallation, onInstallSuccess, }) {
28
+ const createConfig = generateProxyOnlyConfig(hydratedRevision, consumerRef);
29
+ if (!createConfig) {
30
+ console.error('Error when generating createConfig from configureState');
31
+ return Promise.resolve(null);
32
+ }
33
+ return (0, createInstallationReducer_1.createInstallationReducer)({
34
+ createConfig,
35
+ projectId,
36
+ integrationId,
37
+ groupRef,
38
+ connectionId,
39
+ apiKey,
40
+ setInstallation,
41
+ onInstallSuccess,
42
+ });
43
+ }
44
+ exports.createInstallationProxyOnly = createInstallationProxyOnly;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onSaveWriteCreateInstallation = void 0;
4
- const api_1 = require("../../../../services/api");
4
+ const createInstallationReducer_1 = require("../createInstallationReducer");
5
5
  const generateConfigWriteObjects_1 = require("./generateConfigWriteObjects");
6
6
  /**
7
7
  * gets write objects from hydratedRevision
@@ -58,28 +58,15 @@ const onSaveWriteCreateInstallation = (projectId, integrationId, groupRef, consu
58
58
  console.error('Error when generating createConfig from configureState');
59
59
  return Promise.resolve(null);
60
60
  }
61
- const createInstallationRequest = {
61
+ return (0, createInstallationReducer_1.createInstallationReducer)({
62
+ createConfig,
62
63
  projectId,
63
64
  integrationId,
64
- installation: {
65
- groupRef,
66
- connectionId,
67
- config: createConfig,
68
- },
69
- };
70
- return (0, api_1.api)().installationApi.createInstallation(createInstallationRequest, {
71
- headers: {
72
- 'X-Api-Key': apiKey,
73
- 'Content-Type': 'application/json',
74
- },
75
- })
76
- .then((installation) => {
77
- // update local installation state
78
- setInstallation(installation);
79
- onInstallSuccess === null || onInstallSuccess === void 0 ? void 0 : onInstallSuccess(installation.id, installation.config);
80
- })
81
- .catch((err) => {
82
- console.error('ERROR: ', err);
65
+ groupRef,
66
+ connectionId,
67
+ apiKey,
68
+ setInstallation,
69
+ onInstallSuccess,
83
70
  });
84
71
  };
85
72
  exports.onSaveWriteCreateInstallation = onSaveWriteCreateInstallation;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ interface ConditionalProxyLayoutProps {
3
+ children: React.ReactNode;
4
+ }
5
+ /**
6
+ * if the hydratedRevision only has proxy actions,
7
+ * then it will not render the ConfigureInstallation
8
+ * @returns
9
+ */
10
+ export declare function ConditionalProxyLayout({ children }: ConditionalProxyLayoutProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConditionalProxyLayout = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const LoadingIcon_1 = require("../../../../assets/LoadingIcon");
7
+ const ApiKeyContextProvider_1 = require("../../../../context/ApiKeyContextProvider");
8
+ const ConnectionsContextProvider_1 = require("../../../../context/ConnectionsContextProvider");
9
+ const InstallIntegrationContextProvider_1 = require("../../../../context/InstallIntegrationContextProvider");
10
+ const ProjectContextProvider_1 = require("../../../../context/ProjectContextProvider");
11
+ const ErrorTextBox_1 = require("../../../ErrorTextBox");
12
+ const createInstallationProxyOnly_1 = require("../../actions/proxy/createInstallationProxyOnly");
13
+ const HydratedRevisionContext_1 = require("../../state/HydratedRevisionContext");
14
+ const InstalledSuccessBox_1 = require("./InstalledSuccessBox");
15
+ // explicity check other actions (i.e. read, write) to determine if it's proxy only
16
+ // returns false if it's not proxy only or no hydratedRevision
17
+ const getIsProxyOnly = (hydratedRevision) => {
18
+ var _a;
19
+ const { read, write, proxy } = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) !== null && _a !== void 0 ? _a : {};
20
+ return (!read && !write && (proxy === null || proxy === void 0 ? void 0 : proxy.enabled)) || false;
21
+ };
22
+ /**
23
+ * if the hydratedRevision only has proxy actions,
24
+ * then it will not render the ConfigureInstallation
25
+ * @returns
26
+ */
27
+ function ConditionalProxyLayout({ children }) {
28
+ var _a;
29
+ const { projectId } = (0, ProjectContextProvider_1.useProject)();
30
+ const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
31
+ const { hydratedRevision, loading: hydratedRevisionLoading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
32
+ const { integrationObj, installation, groupRef, consumerRef, setInstallation, } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
33
+ const { selectedConnection } = (0, ConnectionsContextProvider_1.useConnections)();
34
+ const [createInstallLoading, setCreateInstallLoading] = (0, react_1.useState)(false);
35
+ const isLoading = hydratedRevisionLoading || createInstallLoading;
36
+ const provider = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.provider;
37
+ const isProxyOnly = getIsProxyOnly(hydratedRevision);
38
+ (0, react_1.useEffect)(() => {
39
+ if (hydratedRevision && isProxyOnly && !installation && selectedConnection && apiKey && (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id)) {
40
+ setCreateInstallLoading(true);
41
+ (0, createInstallationProxyOnly_1.createInstallationProxyOnly)({
42
+ apiKey,
43
+ projectId,
44
+ integrationId: integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id,
45
+ groupRef,
46
+ consumerRef,
47
+ connectionId: selectedConnection === null || selectedConnection === void 0 ? void 0 : selectedConnection.id,
48
+ hydratedRevision,
49
+ setInstallation,
50
+ }).then(() => {
51
+ setCreateInstallLoading(false);
52
+ }).catch((e) => {
53
+ setCreateInstallLoading(false);
54
+ console.error('Error when creating proxy installation:', e);
55
+ });
56
+ }
57
+ }, [hydratedRevision, isProxyOnly, installation,
58
+ selectedConnection, apiKey, projectId, integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id, groupRef, consumerRef, setInstallation]);
59
+ if (!integrationObj)
60
+ return (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: "We can't load the integration" });
61
+ if (isLoading)
62
+ return (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {});
63
+ if (isProxyOnly && provider && installation)
64
+ return (0, jsx_runtime_1.jsx)(InstalledSuccessBox_1.InstalledSuccessBox, { provider: provider });
65
+ return ((0, jsx_runtime_1.jsx)("div", { children: children }));
66
+ }
67
+ exports.ConditionalProxyLayout = ConditionalProxyLayout;
@@ -0,0 +1,5 @@
1
+ type InstalledSuccessBoxProps = {
2
+ provider: string;
3
+ };
4
+ export declare function InstalledSuccessBox({ provider }: InstalledSuccessBoxProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InstalledSuccessBox = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const utils_1 = require("../../../../utils");
6
+ const SuccessTextBox_1 = require("../../../SuccessTextBox");
7
+ function InstalledSuccessBox({ provider }) {
8
+ const text = `You have successfully installed your ${(0, utils_1.capitalize)(provider)} integration.`;
9
+ return ((0, jsx_runtime_1.jsx)(SuccessTextBox_1.SuccessTextBox, { text: text }));
10
+ }
11
+ exports.InstalledSuccessBox = InstalledSuccessBox;
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectedSuccessBox = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
- const react_1 = require("@chakra-ui/react");
6
- const NavIcon_1 = require("../../assets/NavIcon");
7
5
  const ProjectContextProvider_1 = require("../../context/ProjectContextProvider");
8
6
  const utils_1 = require("../../utils");
7
+ const SuccessTextBox_1 = require("../SuccessTextBox");
9
8
  function ConnectedSuccessBox({ provider }) {
10
9
  const { appName } = (0, ProjectContextProvider_1.useProject)();
11
- return ((0, jsx_runtime_1.jsx)(react_1.Container, { children: (0, jsx_runtime_1.jsxs)(react_1.Box, { p: 8, maxWidth: "600px", minHeight: "290px", borderWidth: 1, borderRadius: 8, boxShadow: "lg", margin: "auto", marginTop: "40px", bgColor: "white", paddingTop: "100px", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { width: "100%", display: "flex", alignContent: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(react_1.Box, { margin: "auto", children: NavIcon_1.CheckMarkIcon }) }), (0, jsx_runtime_1.jsx)(react_1.Box, { textAlign: "center", paddingTop: "25px", children: `You've successfully connected ${(0, utils_1.capitalize)(provider)} to ${appName}.` })] }) }));
10
+ const text = `You have successfully connected your ${(0, utils_1.capitalize)(provider)} account to ${appName}.`;
11
+ return ((0, jsx_runtime_1.jsx)(SuccessTextBox_1.SuccessTextBox, { text: text }));
12
12
  }
13
13
  exports.ConnectedSuccessBox = ConnectedSuccessBox;
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const icons_1 = require("@chakra-ui/icons");
6
6
  const react_1 = require("@chakra-ui/react");
7
7
  const OAuthErrorAlert_1 = require("../OAuthErrorAlert");
8
- const SALESFORCE_HELP_URL = 'https://help.salesforce.com/articleView?id=domain_name_not_found.htm&type=5';
8
+ const SALESFORCE_HELP_URL = 'https://help.salesforce.com/s/articleView?id=sf.faq_domain_name_what.htm&type=5';
9
9
  function SubdomainEntry({ handleSubmit, setWorkspace, error, isButtonDisabled, }) {
10
10
  return ((0, jsx_runtime_1.jsx)(react_1.Container, { children: (0, jsx_runtime_1.jsx)(react_1.Box, { p: 8, maxWidth: "600px", borderWidth: 1, borderRadius: 8, boxShadow: "lg", textAlign: ['left'], margin: "auto", marginTop: "40px", bgColor: "white", 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: "Enter your Salesforce subdomain" }) }), (0, jsx_runtime_1.jsxs)(react_1.Link, { href: SALESFORCE_HELP_URL, color: "blackAlpha.600", isExternal: true, children: ["What is my Salesforce subdomain?", (0, jsx_runtime_1.jsx)(icons_1.ExternalLinkIcon, { mx: "2px" })] }), (0, jsx_runtime_1.jsx)(OAuthErrorAlert_1.OAuthErrorAlert, { error: error }), (0, jsx_runtime_1.jsxs)(react_1.Flex, { marginTop: "1em", children: [(0, jsx_runtime_1.jsx)(react_1.Input, { placeholder: "MyDomain", onChange: (event) => setWorkspace(event.currentTarget.value) }), (0, jsx_runtime_1.jsx)(react_1.Text, { lineHeight: "2.2em", marginLeft: "0.4em", children: ".my.salesforce.com" })] }), (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
11
  }
@@ -0,0 +1,5 @@
1
+ interface ConnectedSuccessBoxProps {
2
+ text: string;
3
+ }
4
+ export declare function SuccessTextBox({ text }: ConnectedSuccessBoxProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SuccessTextBox = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@chakra-ui/react");
6
+ const SuccessIcon_1 = require("../assets/SuccessIcon");
7
+ function SuccessTextBox({ text }) {
8
+ return ((0, jsx_runtime_1.jsx)(react_1.Container, { children: (0, jsx_runtime_1.jsxs)(react_1.Box, { p: 8, maxWidth: "600px", minHeight: "290px", borderWidth: 1, borderRadius: 8, boxShadow: "lg", margin: "auto", marginTop: "40px", bgColor: "white", paddingTop: "100px", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { width: "100%", display: "flex", alignContent: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(react_1.Box, { margin: "auto", children: (0, jsx_runtime_1.jsx)(SuccessIcon_1.SuccessCheckmarkIcon, {}) }) }), (0, jsx_runtime_1.jsx)(react_1.Box, { textAlign: "center", paddingTop: "25px", children: text })] }) }));
9
+ }
10
+ exports.SuccessTextBox = SuccessTextBox;