@amp-labs/react 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/build/generated-sources/api/src/apis/DefaultApi.d.ts +78 -6
  2. package/build/generated-sources/api/src/apis/DefaultApi.js +80 -3
  3. package/build/generated-sources/api/src/models/BaseConfigContent.d.ts +8 -1
  4. package/build/generated-sources/api/src/models/BaseConfigContent.js +4 -1
  5. package/build/generated-sources/api/src/models/BaseReadConfig.d.ts +1 -1
  6. package/build/generated-sources/api/src/models/BaseReadConfig.js +1 -1
  7. package/build/generated-sources/api/src/models/BaseReadConfigStandardObject.d.ts +2 -2
  8. package/build/generated-sources/api/src/models/BaseReadConfigStandardObject.js +1 -1
  9. package/build/generated-sources/api/src/models/BaseWriteConfig.d.ts +34 -0
  10. package/build/generated-sources/api/src/models/BaseWriteConfig.js +51 -0
  11. package/build/generated-sources/api/src/models/BaseWriteConfigObject.d.ts +31 -0
  12. package/build/generated-sources/api/src/models/BaseWriteConfigObject.js +50 -0
  13. package/build/generated-sources/api/src/models/BatchUpsertIntegrationsRequest.d.ts +1 -1
  14. package/build/generated-sources/api/src/models/BatchUpsertIntegrationsRequest.js +1 -1
  15. package/build/generated-sources/api/src/models/Config.d.ts +1 -1
  16. package/build/generated-sources/api/src/models/Config.js +1 -1
  17. package/build/generated-sources/api/src/models/ConfigContent.d.ts +7 -1
  18. package/build/generated-sources/api/src/models/ConfigContent.js +3 -1
  19. package/build/generated-sources/api/src/models/ConfigContentAllOf.d.ts +7 -1
  20. package/build/generated-sources/api/src/models/ConfigContentAllOf.js +3 -1
  21. package/build/generated-sources/api/src/models/Connection.d.ts +1 -1
  22. package/build/generated-sources/api/src/models/Connection.js +1 -1
  23. package/build/generated-sources/api/src/models/Consumer.d.ts +1 -1
  24. package/build/generated-sources/api/src/models/Consumer.js +1 -1
  25. package/build/generated-sources/api/src/models/CreateConsumerRequest.d.ts +1 -1
  26. package/build/generated-sources/api/src/models/CreateConsumerRequest.js +1 -1
  27. package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +1 -1
  28. package/build/generated-sources/api/src/models/CreateDestinationRequest.js +1 -1
  29. package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +1 -1
  30. package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.js +1 -1
  31. package/build/generated-sources/api/src/models/CreateGroupRequest.d.ts +1 -1
  32. package/build/generated-sources/api/src/models/CreateGroupRequest.js +1 -1
  33. package/build/generated-sources/api/src/models/CreateInstallationRequest.d.ts +3 -3
  34. package/build/generated-sources/api/src/models/CreateInstallationRequest.js +3 -3
  35. package/build/generated-sources/api/src/models/CreateInstallationRequestConfig.d.ts +4 -4
  36. package/build/generated-sources/api/src/models/CreateInstallationRequestConfig.js +4 -5
  37. package/build/generated-sources/api/src/models/CreateIntegrationRequest.d.ts +1 -1
  38. package/build/generated-sources/api/src/models/CreateIntegrationRequest.js +1 -1
  39. package/build/generated-sources/api/src/models/CreateIntegrationRequestLatestRevision.d.ts +1 -1
  40. package/build/generated-sources/api/src/models/CreateIntegrationRequestLatestRevision.js +1 -1
  41. package/build/generated-sources/api/src/models/CreateProjectRequest.d.ts +1 -1
  42. package/build/generated-sources/api/src/models/CreateProjectRequest.js +1 -1
  43. package/build/generated-sources/api/src/models/CreateProviderAppRequest.d.ts +7 -1
  44. package/build/generated-sources/api/src/models/CreateProviderAppRequest.js +3 -1
  45. package/build/generated-sources/api/src/models/Group.d.ts +1 -1
  46. package/build/generated-sources/api/src/models/Group.js +1 -1
  47. package/build/generated-sources/api/src/models/HydratedIntegration.d.ts +8 -1
  48. package/build/generated-sources/api/src/models/HydratedIntegration.js +4 -1
  49. package/build/generated-sources/api/src/models/HydratedIntegrationField.d.ts +1 -1
  50. package/build/generated-sources/api/src/models/HydratedIntegrationField.js +1 -1
  51. package/build/generated-sources/api/src/models/HydratedIntegrationFieldExistent.d.ts +1 -1
  52. package/build/generated-sources/api/src/models/HydratedIntegrationFieldExistent.js +1 -1
  53. package/build/generated-sources/api/src/models/HydratedIntegrationObject.d.ts +1 -1
  54. package/build/generated-sources/api/src/models/HydratedIntegrationObject.js +1 -1
  55. package/build/generated-sources/api/src/models/HydratedIntegrationRead.d.ts +1 -1
  56. package/build/generated-sources/api/src/models/HydratedIntegrationRead.js +1 -1
  57. package/build/generated-sources/api/src/models/HydratedIntegrationWrite.d.ts +32 -0
  58. package/build/generated-sources/api/src/models/HydratedIntegrationWrite.js +51 -0
  59. package/build/generated-sources/api/src/models/HydratedIntegrationWriteObject.d.ts +37 -0
  60. package/build/generated-sources/api/src/models/HydratedIntegrationWriteObject.js +53 -0
  61. package/build/generated-sources/api/src/models/HydratedRevision.d.ts +1 -1
  62. package/build/generated-sources/api/src/models/HydratedRevision.js +1 -1
  63. package/build/generated-sources/api/src/models/ImportConnectionRequest.d.ts +1 -7
  64. package/build/generated-sources/api/src/models/ImportConnectionRequest.js +1 -4
  65. package/build/generated-sources/api/src/models/ImportInstallationRequest.d.ts +7 -1
  66. package/build/generated-sources/api/src/models/ImportInstallationRequest.js +4 -1
  67. package/build/generated-sources/api/src/models/ImportInstallationRequestConfig.d.ts +1 -1
  68. package/build/generated-sources/api/src/models/ImportInstallationRequestConfig.js +1 -1
  69. package/build/generated-sources/api/src/models/Installation.d.ts +1 -1
  70. package/build/generated-sources/api/src/models/Installation.js +1 -1
  71. package/build/generated-sources/api/src/models/Integration.d.ts +1 -1
  72. package/build/generated-sources/api/src/models/Integration.js +1 -1
  73. package/build/generated-sources/api/src/models/Integration1.d.ts +8 -1
  74. package/build/generated-sources/api/src/models/Integration1.js +4 -1
  75. package/build/generated-sources/api/src/models/IntegrationField.d.ts +1 -1
  76. package/build/generated-sources/api/src/models/IntegrationField.js +1 -1
  77. package/build/generated-sources/api/src/models/IntegrationFieldExistent.d.ts +1 -1
  78. package/build/generated-sources/api/src/models/IntegrationFieldExistent.js +1 -1
  79. package/build/generated-sources/api/src/models/IntegrationFieldMapping.d.ts +1 -1
  80. package/build/generated-sources/api/src/models/IntegrationFieldMapping.js +1 -1
  81. package/build/generated-sources/api/src/models/IntegrationObject.d.ts +1 -1
  82. package/build/generated-sources/api/src/models/IntegrationObject.js +1 -1
  83. package/build/generated-sources/api/src/models/IntegrationRead.d.ts +1 -1
  84. package/build/generated-sources/api/src/models/IntegrationRead.js +1 -1
  85. package/build/generated-sources/api/src/models/IntegrationWrite.d.ts +32 -0
  86. package/build/generated-sources/api/src/models/IntegrationWrite.js +51 -0
  87. package/build/generated-sources/api/src/models/IntegrationWriteObject.d.ts +31 -0
  88. package/build/generated-sources/api/src/models/IntegrationWriteObject.js +50 -0
  89. package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +2 -2
  90. package/build/generated-sources/api/src/models/OauthConnectRequest.js +2 -3
  91. package/build/generated-sources/api/src/models/Operation.d.ts +7 -13
  92. package/build/generated-sources/api/src/models/Operation.js +4 -7
  93. package/build/generated-sources/api/src/models/OperationError.d.ts +1 -1
  94. package/build/generated-sources/api/src/models/OperationError.js +1 -1
  95. package/build/generated-sources/api/src/models/OptionalFieldsAutoOption.d.ts +1 -1
  96. package/build/generated-sources/api/src/models/OptionalFieldsAutoOption.js +1 -1
  97. package/build/generated-sources/api/src/models/Project.d.ts +1 -1
  98. package/build/generated-sources/api/src/models/Project.js +1 -1
  99. package/build/generated-sources/api/src/models/ProjectMembership.d.ts +1 -1
  100. package/build/generated-sources/api/src/models/ProjectMembership.js +1 -1
  101. package/build/generated-sources/api/src/models/ProviderApp.d.ts +1 -1
  102. package/build/generated-sources/api/src/models/ProviderApp.js +1 -1
  103. package/build/generated-sources/api/src/models/Revision.d.ts +1 -1
  104. package/build/generated-sources/api/src/models/Revision.js +1 -1
  105. package/build/generated-sources/api/src/models/SignedUrl.d.ts +43 -0
  106. package/build/generated-sources/api/src/models/SignedUrl.js +56 -0
  107. package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.d.ts +8 -1
  108. package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.js +4 -1
  109. package/build/generated-sources/api/src/models/UpdateInstallationRequest.d.ts +1 -1
  110. package/build/generated-sources/api/src/models/UpdateInstallationRequest.js +1 -1
  111. package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallation.d.ts +1 -1
  112. package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallation.js +1 -1
  113. package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallationConfig.d.ts +1 -1
  114. package/build/generated-sources/api/src/models/UpdateInstallationRequestInstallationConfig.js +1 -1
  115. package/build/generated-sources/api/src/models/UpdateProjectRequest.d.ts +1 -1
  116. package/build/generated-sources/api/src/models/UpdateProjectRequest.js +1 -1
  117. package/build/generated-sources/api/src/models/UpdateProjectRequestProject.d.ts +1 -1
  118. package/build/generated-sources/api/src/models/UpdateProjectRequestProject.js +1 -1
  119. package/build/generated-sources/api/src/models/UpdateProviderAppRequest.d.ts +1 -1
  120. package/build/generated-sources/api/src/models/UpdateProviderAppRequest.js +1 -1
  121. package/build/generated-sources/api/src/models/UpdateProviderAppRequestProviderApp.d.ts +7 -1
  122. package/build/generated-sources/api/src/models/UpdateProviderAppRequestProviderApp.js +3 -1
  123. package/build/generated-sources/api/src/models/UpsertProjectMembershipRequest.d.ts +1 -1
  124. package/build/generated-sources/api/src/models/UpsertProjectMembershipRequest.js +1 -1
  125. package/build/generated-sources/api/src/models/index.d.ts +7 -0
  126. package/build/generated-sources/api/src/models/index.js +7 -0
  127. package/build/generated-sources/api/src/runtime.d.ts +1 -1
  128. package/build/generated-sources/api/src/runtime.js +1 -1
  129. package/build/src/assets/NavIcon.d.ts +1 -0
  130. package/build/src/assets/NavIcon.js +3 -2
  131. package/build/src/assets/TrashIcon.d.ts +1 -0
  132. package/build/src/assets/TrashIcon.js +9 -0
  133. package/build/src/components/AmpersandProvider/AmpersandProvider.js +2 -2
  134. package/build/src/components/Configure/ConfigureInstallationBase.js +14 -2
  135. package/build/src/components/Configure/CreateInstallation.js +11 -14
  136. package/build/src/components/Configure/InstallIntegration.js +1 -2
  137. package/build/src/components/Configure/ObjectManagementNav/UninstallInstallation.d.ts +7 -0
  138. package/build/src/components/Configure/ObjectManagementNav/UninstallInstallation.js +15 -0
  139. package/build/src/components/Configure/ObjectManagementNav/index.js +17 -9
  140. package/build/src/components/Configure/ProtectedConnectionLayout.d.ts +7 -2
  141. package/build/src/components/Configure/ProtectedConnectionLayout.js +15 -9
  142. package/build/src/components/Configure/UninstallContent.d.ts +1 -0
  143. package/build/src/components/Configure/UninstallContent.js +44 -0
  144. package/build/src/components/Configure/UpdateInstallation.js +10 -21
  145. package/build/src/components/Configure/fields/{FieldMapping.d.ts → FieldMappings/FieldMapping.d.ts} +2 -3
  146. package/build/src/components/Configure/fields/{FieldMapping.js → FieldMappings/FieldMapping.js} +12 -11
  147. package/build/src/components/Configure/fields/{RequiredFieldMappings.js → FieldMappings/RequiredFieldMappings.js} +9 -9
  148. package/build/src/components/Configure/fields/FieldMappings/index.d.ts +3 -0
  149. package/build/src/components/Configure/fields/FieldMappings/index.js +7 -0
  150. package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.d.ts +3 -0
  151. package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.js +18 -0
  152. package/build/src/components/Configure/fields/{OptionalFields.js → OptionalFields/OptionalFields.js} +8 -19
  153. package/build/src/components/Configure/fields/OptionalFields/index.d.ts +2 -0
  154. package/build/src/components/Configure/fields/OptionalFields/index.js +5 -0
  155. package/build/src/components/Configure/fields/OptionalFields/setOptionalField.d.ts +3 -0
  156. package/build/src/components/Configure/fields/OptionalFields/setOptionalField.js +21 -0
  157. package/build/src/components/Configure/state/ConfigurationStateProvider.d.ts +47 -1
  158. package/build/src/components/Configure/state/ConfigurationStateProvider.js +28 -6
  159. package/build/src/components/Configure/state/HydratedRevisionContext.js +3 -6
  160. package/build/src/components/Configure/state/utils.d.ts +4 -16
  161. package/build/src/components/Configure/state/utils.js +28 -63
  162. package/build/src/components/Configure/types.d.ts +6 -9
  163. package/build/src/components/Configure/utils.d.ts +6 -4
  164. package/build/src/components/Configure/utils.js +17 -16
  165. package/build/src/components/Connect/ConnectProvider.d.ts +9 -0
  166. package/build/src/components/Connect/ConnectProvider.js +18 -0
  167. package/build/src/components/{OAuthPopup → Connect}/OAuthPopup.js +3 -3
  168. package/build/src/components/Oauth/Hubspot/HubspotLandingContent.d.ts +7 -0
  169. package/build/src/components/Oauth/Hubspot/HubspotLandingContent.js +10 -0
  170. package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.d.ts +15 -0
  171. package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.js +50 -0
  172. package/build/src/components/Oauth/OAuthErrorAlert.d.ts +5 -0
  173. package/build/src/components/Oauth/OAuthErrorAlert.js +12 -0
  174. package/build/src/components/{Salesforce → Oauth/Salesforce}/SalesforceOauthFlow.d.ts +2 -2
  175. package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +57 -0
  176. package/build/src/components/Oauth/Salesforce/SubdomainEntry.d.ts +8 -0
  177. package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +12 -0
  178. package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -0
  179. package/build/src/components/Oauth/fetchOAuthCallbackURL.js +29 -0
  180. package/build/src/components/ThemeProvider/Button/buttonTheme.d.ts +13 -0
  181. package/build/src/components/ThemeProvider/Button/buttonTheme.js +17 -0
  182. package/build/src/components/ThemeProvider/Button/index.d.ts +2 -0
  183. package/build/src/components/ThemeProvider/Button/index.js +5 -0
  184. package/build/src/components/ThemeProvider/index.js +21 -0
  185. package/build/src/components/index.d.ts +1 -0
  186. package/build/src/components/index.js +1 -0
  187. package/build/src/constants.d.ts +1 -0
  188. package/build/src/constants.js +2 -1
  189. package/build/src/context/{ApiKeyContext.d.ts → ApiKeyProvider.d.ts} +1 -0
  190. package/build/src/context/ApiKeyProvider.js +14 -0
  191. package/build/src/context/ConnectionsContext.d.ts +5 -4
  192. package/build/src/context/ConnectionsContext.js +13 -5
  193. package/build/src/context/InstallIntegrationContext.d.ts +1 -0
  194. package/build/src/context/InstallIntegrationContext.js +15 -10
  195. package/build/src/context/IntegrationListContext.js +3 -3
  196. package/build/src/context/ProjectContext.js +3 -3
  197. package/build/src/hooks/useIsIntegrationInstalled.js +2 -2
  198. package/package.json +3 -2
  199. package/build/src/components/Salesforce/SalesforceOauthFlow.js +0 -78
  200. package/build/src/context/ApiKeyContext.js +0 -6
  201. /package/build/src/components/Configure/fields/{RequiredFieldMappings.d.ts → FieldMappings/RequiredFieldMappings.d.ts} +0 -0
  202. /package/build/src/components/Configure/fields/{OptionalFields.d.ts → OptionalFields/OptionalFields.d.ts} +0 -0
  203. /package/build/src/components/{OAuthPopup → Connect}/OAuthPopup.d.ts +0 -0
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Hubspot landing component, which then will launch to create an OAuth connection to Hubspot.
3
+ */
4
+ interface HubspotOauthFlowProps {
5
+ consumerRef: string;
6
+ consumerName?: string;
7
+ groupRef: string;
8
+ groupName?: string;
9
+ }
10
+ /**
11
+ * HubspotOauthFlow first prompts user with a next button,
12
+ * then launches a popup with the OAuth flow.
13
+ */
14
+ export declare function HubspotOauthFlow({ consumerRef, consumerName, groupRef, groupName, }: HubspotOauthFlowProps): import("react/jsx-runtime").JSX.Element;
15
+ export {};
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.HubspotOauthFlow = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ /**
9
+ * Hubspot landing component, which then will launch to create an OAuth connection to Hubspot.
10
+ */
11
+ const react_1 = require("react");
12
+ const constants_1 = require("../../../constants");
13
+ const ApiKeyProvider_1 = require("../../../context/ApiKeyProvider");
14
+ const ProjectContext_1 = require("../../../context/ProjectContext");
15
+ const OAuthPopup_1 = __importDefault(require("../../Connect/OAuthPopup"));
16
+ const fetchOAuthCallbackURL_1 = require("../fetchOAuthCallbackURL");
17
+ const HubspotLandingContent_1 = require("./HubspotLandingContent");
18
+ /**
19
+ * HubspotOauthFlow first prompts user with a next button,
20
+ * then launches a popup with the OAuth flow.
21
+ */
22
+ function HubspotOauthFlow({ consumerRef, consumerName, groupRef, groupName, }) {
23
+ const { projectId } = (0, ProjectContext_1.useProject)();
24
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
25
+ const [oAuthCallbackURL, setOAuthCallbackURL] = (0, react_1.useState)(null);
26
+ const [error, setError] = (0, react_1.useState)(null);
27
+ // 1. fetch provider apps
28
+ // 2. find matching app to provider
29
+ // 3. fetch OAuth callback URL from connection so that oath popup can be launched
30
+ const handleSubmit = async () => {
31
+ var _a;
32
+ setError(null);
33
+ if (consumerName && groupName && apiKey) {
34
+ try {
35
+ const url = await (0, fetchOAuthCallbackURL_1.fetchOAuthCallbackURL)(projectId, consumerRef, groupRef, consumerName, groupName, apiKey, constants_1.PROVIDER_HUBSPOT);
36
+ setOAuthCallbackURL(url);
37
+ }
38
+ catch (err) {
39
+ console.error(err);
40
+ setError((_a = err.message) !== null && _a !== void 0 ? _a : 'Unexpected error');
41
+ }
42
+ }
43
+ };
44
+ const onClose = (0, react_1.useCallback)((err) => {
45
+ setError(err);
46
+ setOAuthCallbackURL(null);
47
+ }, []);
48
+ return ((0, jsx_runtime_1.jsx)(OAuthPopup_1.default, { title: "Connect to Hubspot", url: oAuthCallbackURL, onClose: onClose, children: (0, jsx_runtime_1.jsx)(HubspotLandingContent_1.HubspotLandingContent, { handleSubmit: handleSubmit, error: error }) }));
49
+ }
50
+ exports.HubspotOauthFlow = HubspotOauthFlow;
@@ -0,0 +1,5 @@
1
+ interface OAuthErrorAlertProps {
2
+ error: string | null;
3
+ }
4
+ export declare function OAuthErrorAlert({ error }: OAuthErrorAlertProps): import("react/jsx-runtime").JSX.Element | null;
5
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.OAuthErrorAlert = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("@chakra-ui/react");
6
+ function OAuthErrorAlert({ error }) {
7
+ if (error) {
8
+ return ((0, jsx_runtime_1.jsxs)(react_1.Alert, { status: "error", marginTop: "2em", children: [(0, jsx_runtime_1.jsx)(react_1.AlertIcon, {}), (0, jsx_runtime_1.jsx)(react_1.AlertDescription, { children: error })] }));
9
+ }
10
+ return null;
11
+ }
12
+ exports.OAuthErrorAlert = OAuthErrorAlert;
@@ -12,5 +12,5 @@ interface SalesforceOauthFlowProps {
12
12
  * SalesforceOauthFlow first prompts user for their workspace ("subdomain" in Salesforce lingo),
13
13
  * then launches a popup with the OAuth flow.
14
14
  */
15
- declare function SalesforceOauthFlow({ consumerRef, consumerName, groupRef, groupName, }: SalesforceOauthFlowProps): import("react/jsx-runtime").JSX.Element;
16
- export default SalesforceOauthFlow;
15
+ export declare function SalesforceOauthFlow({ consumerRef, consumerName, groupRef, groupName, }: SalesforceOauthFlowProps): import("react/jsx-runtime").JSX.Element;
16
+ export {};
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SalesforceOauthFlow = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ /**
9
+ * Prompts customer to input their Salesforce subdomain, then creates an OAuth connection to
10
+ * that Salesforce instance.
11
+ */
12
+ const react_1 = require("react");
13
+ const constants_1 = require("../../../constants");
14
+ const ApiKeyProvider_1 = require("../../../context/ApiKeyProvider");
15
+ const ProjectContext_1 = require("../../../context/ProjectContext");
16
+ const OAuthPopup_1 = __importDefault(require("../../Connect/OAuthPopup"));
17
+ const fetchOAuthCallbackURL_1 = require("../fetchOAuthCallbackURL");
18
+ const SubdomainEntry_1 = require("./SubdomainEntry");
19
+ /**
20
+ * SalesforceOauthFlow first prompts user for their workspace ("subdomain" in Salesforce lingo),
21
+ * then launches a popup with the OAuth flow.
22
+ */
23
+ function SalesforceOauthFlow({ consumerRef, consumerName, groupRef, groupName, }) {
24
+ const { projectId } = (0, ProjectContext_1.useProject)();
25
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
26
+ const [workspace, setWorkspace] = (0, react_1.useState)('');
27
+ const [oAuthCallbackURL, setOAuthCallbackURL] = (0, react_1.useState)(null);
28
+ const [error, setError] = (0, react_1.useState)(null);
29
+ const isButtonDisabled = workspace.length === 0;
30
+ const provider = constants_1.PROVIDER_SALESFORCE;
31
+ // 1. fetch provider apps
32
+ // 2. find matching app to provider
33
+ // 3. fetch OAuth callback URL from connection so that oath popup can be launched
34
+ const handleSubmit = async () => {
35
+ var _a;
36
+ setError(null);
37
+ if (workspace && consumerName && groupName && apiKey) {
38
+ try {
39
+ const url = await (0, fetchOAuthCallbackURL_1.fetchOAuthCallbackURL)(projectId, consumerRef, groupRef, consumerName, groupName, apiKey, provider, workspace);
40
+ setOAuthCallbackURL(url);
41
+ }
42
+ catch (err) {
43
+ console.error(err);
44
+ setError((_a = err.message) !== null && _a !== void 0 ? _a : 'Unexpected error');
45
+ }
46
+ }
47
+ else {
48
+ setError('missing required fields');
49
+ }
50
+ };
51
+ const onClose = (0, react_1.useCallback)((err) => {
52
+ setError(err);
53
+ setOAuthCallbackURL(null);
54
+ }, []);
55
+ return ((0, jsx_runtime_1.jsx)(OAuthPopup_1.default, { title: "Connect to Salesforce", url: oAuthCallbackURL, onClose: onClose, children: (0, jsx_runtime_1.jsx)(SubdomainEntry_1.SubdomainEntry, { handleSubmit: handleSubmit, setWorkspace: setWorkspace, error: error, isButtonDisabled: isButtonDisabled }) }));
56
+ }
57
+ exports.SalesforceOauthFlow = SalesforceOauthFlow;
@@ -0,0 +1,8 @@
1
+ type SubdomainEntryProps = {
2
+ handleSubmit: () => void;
3
+ setWorkspace: (workspace: string) => void;
4
+ error: string | null;
5
+ isButtonDisabled?: boolean;
6
+ };
7
+ export declare function SubdomainEntry({ handleSubmit, setWorkspace, error, isButtonDisabled, }: SubdomainEntryProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubdomainEntry = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const icons_1 = require("@chakra-ui/icons");
6
+ const react_1 = require("@chakra-ui/react");
7
+ const OAuthErrorAlert_1 = require("../OAuthErrorAlert");
8
+ const SALESFORCE_HELP_URL = 'https://help.salesforce.com/articleView?id=domain_name_not_found.htm&type=5';
9
+ function SubdomainEntry({ handleSubmit, setWorkspace, error, isButtonDisabled, }) {
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
+ }
12
+ exports.SubdomainEntry = SubdomainEntry;
@@ -0,0 +1 @@
1
+ export declare const fetchOAuthCallbackURL: (projectId: string, consumerRef: string, groupRef: string, consumerName: string, groupName: string, apiKey: string, provider?: string, workspace?: string) => Promise<string>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchOAuthCallbackURL = void 0;
4
+ const constants_1 = require("../../constants");
5
+ const api_1 = require("../../services/api");
6
+ const utils_1 = require("../../utils");
7
+ const fetchOAuthCallbackURL = async (projectId, consumerRef, groupRef, consumerName, groupName, apiKey, provider = constants_1.PROVIDER_SALESFORCE, workspace) => {
8
+ const providerApps = await (0, api_1.api)().listProviderApps({ projectId }, {
9
+ headers: { 'X-Api-Key': apiKey !== null && apiKey !== void 0 ? apiKey : '' },
10
+ });
11
+ const app = providerApps.find((a) => a.provider === provider);
12
+ if (!app) {
13
+ throw new Error(`You must first set up a ${(0, utils_1.capitalize)(provider)} Connected App using the Ampersand Console.`);
14
+ }
15
+ const url = await (0, api_1.api)().oauthConnect({
16
+ connectOAuthParams: {
17
+ providerWorkspaceRef: workspace,
18
+ projectId,
19
+ groupRef,
20
+ groupName,
21
+ consumerRef,
22
+ consumerName,
23
+ providerAppId: app.id,
24
+ provider,
25
+ },
26
+ });
27
+ return url;
28
+ };
29
+ exports.fetchOAuthCallbackURL = fetchOAuthCallbackURL;
@@ -0,0 +1,13 @@
1
+ export declare const buttonVariants: {
2
+ warning: {
3
+ bg: string;
4
+ outlineColor: string;
5
+ outline: string;
6
+ outlineOffset: string;
7
+ borderColor: string;
8
+ color: string;
9
+ _hover: {
10
+ bg: string;
11
+ };
12
+ };
13
+ };
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttonVariants = void 0;
4
+ // define custom button variants
5
+ exports.buttonVariants = {
6
+ warning: {
7
+ bg: 'red.50',
8
+ outlineColor: 'red.800',
9
+ outline: '2px solid',
10
+ outlineOffset: '0',
11
+ borderColor: 'red.800',
12
+ color: 'red.800',
13
+ _hover: {
14
+ bg: 'red.100', // Background color on hover
15
+ },
16
+ },
17
+ };
@@ -0,0 +1,2 @@
1
+ import { buttonVariants } from './buttonTheme';
2
+ export { buttonVariants };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buttonVariants = void 0;
4
+ const buttonTheme_1 = require("./buttonTheme");
5
+ Object.defineProperty(exports, "buttonVariants", { enumerable: true, get: function () { return buttonTheme_1.buttonVariants; } });
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ThemeProvider = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("@chakra-ui/react");
6
+ const Button_1 = require("./Button");
6
7
  const customTheme = (0, react_1.extendTheme)({
7
8
  components: {
8
9
  Tabs: {
@@ -23,8 +24,28 @@ const customTheme = (0, react_1.extendTheme)({
23
24
  },
24
25
  },
25
26
  },
27
+ // consider creating a warning variant tab
28
+ warningTab: {
29
+ width: '100%',
30
+ borderRadius: '4px',
31
+ _hover: {
32
+ bg: 'red.200',
33
+ },
34
+ _selected: {
35
+ color: 'red.800',
36
+ fontWeight: '500',
37
+ bg: 'red.100',
38
+ border: 'none',
39
+ _hover: {
40
+ bg: 'red.200',
41
+ },
42
+ },
43
+ },
26
44
  },
27
45
  },
46
+ Button: {
47
+ variants: Button_1.buttonVariants,
48
+ },
28
49
  },
29
50
  });
30
51
  const theme = (0, react_1.extendTheme)((0, react_1.withDefaultColorScheme)({
@@ -1,2 +1,3 @@
1
1
  export * from './AmpersandProvider';
2
2
  export * from './Configure';
3
+ export * from './Connect/ConnectProvider';
@@ -16,3 +16,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./AmpersandProvider"), exports);
18
18
  __exportStar(require("./Configure"), exports);
19
+ __exportStar(require("./Connect/ConnectProvider"), exports);
@@ -1 +1,2 @@
1
1
  export declare const PROVIDER_SALESFORCE = "salesforce";
2
+ export declare const PROVIDER_HUBSPOT = "hubspot";
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PROVIDER_SALESFORCE = void 0;
3
+ exports.PROVIDER_HUBSPOT = exports.PROVIDER_SALESFORCE = void 0;
4
4
  exports.PROVIDER_SALESFORCE = 'salesforce';
5
+ exports.PROVIDER_HUBSPOT = 'hubspot';
@@ -1,3 +1,4 @@
1
1
  /// <reference types="react" />
2
2
  export declare const ApiKeyContext: import("react").Context<string | null>;
3
3
  export declare const ApiKeyProvider: import("react").Provider<string | null>;
4
+ export declare const useApiKey: () => string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useApiKey = exports.ApiKeyProvider = exports.ApiKeyContext = void 0;
4
+ const react_1 = require("react");
5
+ exports.ApiKeyContext = (0, react_1.createContext)(null);
6
+ exports.ApiKeyProvider = exports.ApiKeyContext.Provider;
7
+ const useApiKey = () => {
8
+ const apiKey = (0, react_1.useContext)(exports.ApiKeyContext);
9
+ if (apiKey === null) {
10
+ throw new Error('useApiKey must be used within an ApiKeyProvider');
11
+ }
12
+ return apiKey;
13
+ };
14
+ exports.useApiKey = useApiKey;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { Connection } from '../services/api';
3
3
  interface ConnectionsContextValue {
4
4
  connections: Connection[] | null;
@@ -6,11 +6,12 @@ interface ConnectionsContextValue {
6
6
  setConnections: React.Dispatch<React.SetStateAction<Connection[] | null>>;
7
7
  setSelectedConnection: React.Dispatch<React.SetStateAction<Connection | null>>;
8
8
  }
9
- export declare const ConnectionsContext: React.Context<ConnectionsContextValue>;
9
+ export declare const ConnectionsContext: import("react").Context<ConnectionsContextValue>;
10
10
  export declare const useConnections: () => ConnectionsContextValue;
11
11
  type ConnectionsProviderProps = {
12
- projectId: string;
12
+ provider?: string;
13
+ groupRef: string;
13
14
  children?: React.ReactNode;
14
15
  };
15
- export declare function ConnectionsProvider({ projectId, children, }: ConnectionsProviderProps): import("react/jsx-runtime").JSX.Element;
16
+ export declare function ConnectionsProvider({ provider, groupRef, children, }: ConnectionsProviderProps): import("react/jsx-runtime").JSX.Element;
16
17
  export {};
@@ -6,9 +6,10 @@ const react_1 = require("react");
6
6
  const LoadingIcon_1 = require("../assets/LoadingIcon");
7
7
  const ErrorTextBox_1 = require("../components/Configure/ErrorTextBox");
8
8
  const api_1 = require("../services/api");
9
- const ApiKeyContext_1 = require("./ApiKeyContext");
9
+ const ApiKeyProvider_1 = require("./ApiKeyProvider");
10
10
  const ErrorContextProvider_1 = require("./ErrorContextProvider");
11
11
  const InstallIntegrationContext_1 = require("./InstallIntegrationContext");
12
+ const ProjectContext_1 = require("./ProjectContext");
12
13
  exports.ConnectionsContext = (0, react_1.createContext)({
13
14
  connections: null,
14
15
  selectedConnection: null,
@@ -18,18 +19,25 @@ exports.ConnectionsContext = (0, react_1.createContext)({
18
19
  const useConnections = () => {
19
20
  const context = (0, react_1.useContext)(exports.ConnectionsContext);
20
21
  if (!context) {
21
- throw new Error('useConnections must be used within a ConnectionsListProvider');
22
+ throw new Error('useConnections must be used within a ConnectionsProvider');
22
23
  }
23
24
  return context;
24
25
  };
25
26
  exports.useConnections = useConnections;
26
- function ConnectionsProvider({ projectId, children, }) {
27
- const { groupRef, provider } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
27
+ function ConnectionsProvider({ provider, groupRef, children, }) {
28
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
29
+ const { projectId } = (0, ProjectContext_1.useProject)();
28
30
  const [connections, setConnections] = (0, react_1.useState)(null);
29
31
  const [selectedConnection, setSelectedConnection] = (0, react_1.useState)(null);
30
- const apiKey = (0, react_1.useContext)(ApiKeyContext_1.ApiKeyContext);
31
32
  const [isLoading, setLoadingState] = (0, react_1.useState)(true);
32
33
  const { setError, isError } = (0, ErrorContextProvider_1.useErrorState)();
34
+ const { provider: providerFromProps } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
35
+ if (!projectId) {
36
+ throw new Error('ConnectionsProvider must be used within AmpersandProvider');
37
+ }
38
+ if (!provider && !providerFromProps) {
39
+ throw new Error('ConnectionsProvider must be given a provider prop or be used within InstallIntegrationProvider');
40
+ }
33
41
  (0, react_1.useEffect)(() => {
34
42
  (0, api_1.api)().listConnections({ projectId, groupRef, provider }, {
35
43
  headers: {
@@ -10,6 +10,7 @@ interface InstallIntegrationContextValue {
10
10
  groupName?: string;
11
11
  installation?: Installation;
12
12
  setInstallation: (installationObj: Installation) => void;
13
+ resetInstallations: () => void;
13
14
  }
14
15
  export declare function useInstallIntegrationProps(): InstallIntegrationContextValue;
15
16
  interface InstallIntegrationProviderProps {
@@ -7,7 +7,7 @@ const LoadingIcon_1 = require("../assets/LoadingIcon");
7
7
  const ErrorTextBox_1 = require("../components/Configure/ErrorTextBox");
8
8
  const api_1 = require("../services/api");
9
9
  const utils_1 = require("../utils");
10
- const ApiKeyContext_1 = require("./ApiKeyContext");
10
+ const ApiKeyProvider_1 = require("./ApiKeyProvider");
11
11
  const ErrorContextProvider_1 = require("./ErrorContextProvider");
12
12
  const IntegrationListContext_1 = require("./IntegrationListContext");
13
13
  const ProjectContext_1 = require("./ProjectContext");
@@ -22,6 +22,7 @@ const InstallIntegrationContext = (0, react_1.createContext)({
22
22
  groupName: '',
23
23
  installation: undefined,
24
24
  setInstallation: () => { },
25
+ resetInstallations: () => { },
25
26
  });
26
27
  // Create a custom hook to access the props
27
28
  function useInstallIntegrationProps() {
@@ -34,14 +35,14 @@ function useInstallIntegrationProps() {
34
35
  exports.useInstallIntegrationProps = useInstallIntegrationProps;
35
36
  // Wrap your parent component with the context provider
36
37
  function InstallIntegrationProvider({ children, integration, consumerRef, consumerName, groupRef, groupName, }) {
38
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
37
39
  const { projectId } = (0, ProjectContext_1.useProject)();
38
- const [installations, setInstallations] = (0, react_1.useState)([]);
39
- const installation = (installations === null || installations === void 0 ? void 0 : installations[0]) || null; // there should only be one installation for mvp
40
- const apiKey = (0, react_1.useContext)(ApiKeyContext_1.ApiKeyContext);
41
40
  const { integrations } = (0, IntegrationListContext_1.useIntegrationList)();
42
- const integrationObj = (0, react_1.useMemo)(() => (0, utils_1.findIntegrationFromList)(integration, integrations || []), [integration, integrations]);
41
+ const [installations, setInstallations] = (0, react_1.useState)([]);
43
42
  const [isLoading, setLoadingState] = (0, react_1.useState)(true);
44
43
  const { setError, isError } = (0, ErrorContextProvider_1.useErrorState)();
44
+ const installation = (installations === null || installations === void 0 ? void 0 : installations[0]) || null; // there should only be one installation for mvp
45
+ const integrationObj = (0, react_1.useMemo)(() => (0, utils_1.findIntegrationFromList)(integration, integrations || []), [integration, integrations]);
45
46
  (0, react_1.useEffect)(() => {
46
47
  if (integrationObj === null && (integrations === null || integrations === void 0 ? void 0 : integrations.length)) {
47
48
  console.error(`Integration "${integration}" not found in integration list`);
@@ -52,9 +53,7 @@ function InstallIntegrationProvider({ children, integration, consumerRef, consum
52
53
  const setInstallation = (0, react_1.useCallback)((installationObj) => {
53
54
  setInstallations([installationObj]);
54
55
  }, [setInstallations]);
55
- const integrationErrorKey = (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id) || '';
56
- // check if integration has been installed in AmpersandProvider
57
- (0, react_1.useEffect)(() => {
56
+ const resetInstallations = (0, react_1.useCallback)(() => {
58
57
  if (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id) {
59
58
  // check if installation exists on selected integration
60
59
  (0, api_1.api)().listInstallations({ projectId, integrationId: integrationObj.id, groupRef }, {
@@ -72,7 +71,12 @@ function InstallIntegrationProvider({ children, integration, consumerRef, consum
72
71
  console.error('Error retrieving installation information: ', err);
73
72
  });
74
73
  }
75
- }, [projectId, integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id, apiKey, groupRef, setError]);
74
+ }, [integrationObj, projectId, apiKey, setError, groupRef]);
75
+ const integrationErrorKey = (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id) || '';
76
+ // check if integration has been installed in AmpersandProvider
77
+ (0, react_1.useEffect)(() => {
78
+ resetInstallations();
79
+ }, [resetInstallations]);
76
80
  const props = (0, react_1.useMemo)(() => ({
77
81
  integrationId: (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.id) || '',
78
82
  provider: (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.provider) || '',
@@ -83,8 +87,9 @@ function InstallIntegrationProvider({ children, integration, consumerRef, consum
83
87
  groupName,
84
88
  installation,
85
89
  setInstallation,
90
+ resetInstallations,
86
91
  }), [integrationObj, consumerRef, consumerName, groupRef,
87
- groupName, installation, setInstallation]);
92
+ groupName, installation, setInstallation, resetInstallations]);
88
93
  return (isError(ErrorContextProvider_1.ErrorBoundary.INSTALLATION_LIST, integrationErrorKey)) ? (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: `Error retrieving installation information for integration "${(integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.name) || 'unknown'}"` }) : ((0, jsx_runtime_1.jsx)(InstallIntegrationContext.Provider, { value: props, children: isLoading ? (0, jsx_runtime_1.jsx)(LoadingIcon_1.LoadingIcon, {}) : children }));
89
94
  }
90
95
  exports.InstallIntegrationProvider = InstallIntegrationProvider;
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const LoadingIcon_1 = require("../assets/LoadingIcon");
7
7
  const ErrorTextBox_1 = require("../components/Configure/ErrorTextBox");
8
8
  const api_1 = require("../services/api");
9
- const ApiKeyContext_1 = require("./ApiKeyContext");
9
+ const ApiKeyProvider_1 = require("./ApiKeyProvider");
10
10
  const ErrorContextProvider_1 = require("./ErrorContextProvider");
11
11
  exports.IntegrationListContext = (0, react_1.createContext)({
12
12
  integrations: null,
@@ -20,9 +20,9 @@ const useIntegrationList = () => {
20
20
  };
21
21
  exports.useIntegrationList = useIntegrationList;
22
22
  function IntegrationListProvider({ projectId, children }) {
23
- const [integrations, setIntegrations] = (0, react_1.useState)(null);
24
- const apiKey = (0, react_1.useContext)(ApiKeyContext_1.ApiKeyContext);
23
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
25
24
  const { setError, isError } = (0, ErrorContextProvider_1.useErrorState)();
25
+ const [integrations, setIntegrations] = (0, react_1.useState)(null);
26
26
  const [isLoading, setLoadingState] = (0, react_1.useState)(true);
27
27
  (0, react_1.useEffect)(() => {
28
28
  (0, api_1.api)().listIntegrations({ projectId }, {
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const LoadingIcon_1 = require("../assets/LoadingIcon");
7
7
  const ErrorTextBox_1 = require("../components/Configure/ErrorTextBox");
8
8
  const api_1 = require("../services/api");
9
- const ApiKeyContext_1 = require("./ApiKeyContext");
9
+ const ApiKeyProvider_1 = require("./ApiKeyProvider");
10
10
  const ErrorContextProvider_1 = require("./ErrorContextProvider");
11
11
  exports.ProjectContext = (0, react_1.createContext)({
12
12
  project: null,
@@ -22,10 +22,10 @@ const useProject = () => {
22
22
  };
23
23
  exports.useProject = useProject;
24
24
  function ProjectProvider({ projectId, children }) {
25
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
26
+ const { isError, setError } = (0, ErrorContextProvider_1.useErrorState)();
25
27
  const [project, setProject] = (0, react_1.useState)(null);
26
- const apiKey = (0, react_1.useContext)(ApiKeyContext_1.ApiKeyContext);
27
28
  const [isLoading, setLoadingState] = (0, react_1.useState)(true);
28
- const { isError, setError } = (0, ErrorContextProvider_1.useErrorState)();
29
29
  (0, react_1.useEffect)(() => {
30
30
  (0, api_1.api)().getProject({ projectId }, {
31
31
  headers: {
@@ -2,12 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useIsIntegrationInstalled = void 0;
4
4
  const react_1 = require("react");
5
- const ApiKeyContext_1 = require("../context/ApiKeyContext");
5
+ const ApiKeyProvider_1 = require("../context/ApiKeyProvider");
6
6
  const IntegrationListContext_1 = require("../context/IntegrationListContext");
7
7
  const ProjectContext_1 = require("../context/ProjectContext");
8
8
  const api_1 = require("../services/api");
9
9
  const useIsIntegrationInstalled = (integration, groupRef) => {
10
- const apiKey = (0, react_1.useContext)(ApiKeyContext_1.ApiKeyContext);
10
+ const apiKey = (0, ApiKeyProvider_1.useApiKey)();
11
11
  const { projectId } = (0, ProjectContext_1.useProject)();
12
12
  const { integrations } = (0, IntegrationListContext_1.useIntegrationList)();
13
13
  const [isLoaded, setIsLoaded] = (0, react_1.useState)(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",
@@ -56,7 +56,7 @@
56
56
  "eslint-config-airbnb": "^19.0.4",
57
57
  "eslint-config-airbnb-typescript": "^17.1.0",
58
58
  "eslint-plugin-import": "^2.29.0",
59
- "eslint-plugin-jsx-a11y": "^6.7.1",
59
+ "eslint-plugin-jsx-a11y": "^6.8.0",
60
60
  "eslint-plugin-n": "^16.2.0",
61
61
  "eslint-plugin-promise": "^6.1.1",
62
62
  "eslint-plugin-react": "^7.33.2",
@@ -75,6 +75,7 @@
75
75
  },
76
76
  "dependencies": {
77
77
  "@chakra-ui/icons": "^2.1.1",
78
+ "immer": "^10.0.3",
78
79
  "lodash.isequal": "^4.5.0"
79
80
  }
80
81
  }