@amp-labs/react 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/build/generated-sources/api/src/apis/AllowedDomainApi.d.ts +79 -0
  2. package/build/generated-sources/api/src/apis/AllowedDomainApi.js +101 -0
  3. package/build/generated-sources/api/src/apis/ConnectionApi.d.ts +82 -0
  4. package/build/generated-sources/api/src/apis/ConnectionApi.js +107 -0
  5. package/build/generated-sources/api/src/apis/ConsumerApi.d.ts +52 -0
  6. package/build/generated-sources/api/src/apis/ConsumerApi.js +75 -0
  7. package/build/generated-sources/api/src/apis/DestinationApi.d.ts +102 -0
  8. package/build/generated-sources/api/src/apis/DestinationApi.js +126 -0
  9. package/build/generated-sources/api/src/apis/GroupApi.d.ts +52 -0
  10. package/build/generated-sources/api/src/apis/GroupApi.js +75 -0
  11. package/build/generated-sources/api/src/apis/InstallationApi.d.ts +196 -0
  12. package/build/generated-sources/api/src/apis/InstallationApi.js +235 -0
  13. package/build/generated-sources/api/src/apis/IntegrationApi.d.ts +128 -0
  14. package/build/generated-sources/api/src/apis/IntegrationApi.js +151 -0
  15. package/build/generated-sources/api/src/apis/OAuthApi.d.ts +76 -0
  16. package/build/generated-sources/api/src/apis/OAuthApi.js +102 -0
  17. package/build/generated-sources/api/src/apis/OperationApi.d.ts +80 -0
  18. package/build/generated-sources/api/src/apis/OperationApi.js +104 -0
  19. package/build/generated-sources/api/src/apis/OperationLogApi.d.ts +55 -0
  20. package/build/generated-sources/api/src/apis/OperationLogApi.js +76 -0
  21. package/build/generated-sources/api/src/apis/ProjectApi.d.ts +124 -0
  22. package/build/generated-sources/api/src/apis/ProjectApi.js +148 -0
  23. package/build/generated-sources/api/src/apis/ProjectMembershipApi.d.ts +126 -0
  24. package/build/generated-sources/api/src/apis/ProjectMembershipApi.js +154 -0
  25. package/build/generated-sources/api/src/apis/ProviderAppApi.d.ts +130 -0
  26. package/build/generated-sources/api/src/apis/ProviderAppApi.js +158 -0
  27. package/build/generated-sources/api/src/apis/RevisionApi.d.ts +87 -0
  28. package/build/generated-sources/api/src/apis/RevisionApi.js +113 -0
  29. package/build/generated-sources/api/src/apis/UploadURLApi.d.ts +46 -0
  30. package/build/generated-sources/api/src/apis/UploadURLApi.js +68 -0
  31. package/build/generated-sources/api/src/apis/index.d.ts +15 -1
  32. package/build/generated-sources/api/src/apis/index.js +15 -1
  33. package/build/generated-sources/api/src/models/BaseConfigContent.d.ts +7 -0
  34. package/build/generated-sources/api/src/models/BaseConfigContent.js +3 -0
  35. package/build/generated-sources/api/src/models/BaseProxyConfig.d.ts +31 -0
  36. package/build/generated-sources/api/src/models/BaseProxyConfig.js +50 -0
  37. package/build/generated-sources/api/src/models/ConfigContent.d.ts +7 -0
  38. package/build/generated-sources/api/src/models/ConfigContent.js +3 -0
  39. package/build/generated-sources/api/src/models/Destination.d.ts +44 -0
  40. package/build/generated-sources/api/src/models/Destination.js +57 -0
  41. package/build/generated-sources/api/src/models/DestinationMetadata.d.ts +39 -0
  42. package/build/generated-sources/api/src/models/{CreateDestinationRequestMetadata.js → DestinationMetadata.js} +11 -11
  43. package/build/generated-sources/api/src/models/HydratedIntegration.d.ts +7 -0
  44. package/build/generated-sources/api/src/models/HydratedIntegration.js +3 -0
  45. package/build/generated-sources/api/src/models/HydratedIntegrationProxy.d.ts +31 -0
  46. package/build/generated-sources/api/src/models/HydratedIntegrationProxy.js +50 -0
  47. package/build/generated-sources/api/src/models/ImportConnectionRequest.d.ts +1 -1
  48. package/build/generated-sources/api/src/models/Integration1.d.ts +7 -0
  49. package/build/generated-sources/api/src/models/Integration1.js +3 -0
  50. package/build/generated-sources/api/src/models/IntegrationProxy.d.ts +31 -0
  51. package/build/generated-sources/api/src/models/IntegrationProxy.js +50 -0
  52. package/build/generated-sources/api/src/models/OauthConnectRequest.d.ts +6 -6
  53. package/build/generated-sources/api/src/models/OauthConnectRequest.js +1 -2
  54. package/build/generated-sources/api/src/models/Operation.d.ts +26 -9
  55. package/build/generated-sources/api/src/models/Operation.js +14 -7
  56. package/build/generated-sources/api/src/models/OperationLog.d.ts +43 -0
  57. package/build/generated-sources/api/src/models/OperationLog.js +56 -0
  58. package/build/generated-sources/api/src/models/ProviderApp.d.ts +6 -0
  59. package/build/generated-sources/api/src/models/ProviderApp.js +2 -0
  60. package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.d.ts +7 -0
  61. package/build/generated-sources/api/src/models/UpdateInstallationConfigContent.js +3 -0
  62. package/build/generated-sources/api/src/models/index.d.ts +6 -3
  63. package/build/generated-sources/api/src/models/index.js +6 -3
  64. package/build/src/assets/SuccessIcon.d.ts +1 -0
  65. package/build/src/assets/SuccessIcon.js +8 -0
  66. package/build/src/assets/TrashIcon.js +3 -1
  67. package/build/src/components/Configure/InstallIntegration.d.ts +4 -1
  68. package/build/src/components/Configure/InstallIntegration.js +11 -23
  69. package/build/src/components/Configure/actions/createInstallationReducer.d.ts +15 -0
  70. package/build/src/components/Configure/actions/createInstallationReducer.js +30 -0
  71. package/build/src/components/Configure/actions/onSaveReadCreateInstallation.d.ts +3 -0
  72. package/build/src/components/Configure/actions/{onSaveCreate.js → onSaveReadCreateInstallation.js} +13 -25
  73. package/build/src/components/Configure/actions/onSaveReadUpdateInstallation.d.ts +3 -0
  74. package/build/src/components/Configure/actions/{onSaveUpdate.js → onSaveReadUpdateInstallation.js} +13 -8
  75. package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.d.ts +8 -0
  76. package/build/src/components/Configure/actions/proxy/createInstallationProxyOnly.js +44 -0
  77. package/build/src/components/Configure/actions/write/generateConfigWriteObjects.d.ts +26 -0
  78. package/build/src/components/Configure/actions/write/generateConfigWriteObjects.js +41 -0
  79. package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.d.ts +3 -0
  80. package/build/src/components/Configure/actions/write/onSaveWriteCreateInstallation.js +72 -0
  81. package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.d.ts +3 -0
  82. package/build/src/components/Configure/actions/write/onSaveWriteUpdateInstallation.js +60 -0
  83. package/build/src/components/Configure/{ConfigureInstallationBase.d.ts → content/ConfigureInstallationBase.d.ts} +2 -1
  84. package/build/src/components/Configure/content/ConfigureInstallationBase.js +36 -0
  85. package/build/src/components/Configure/content/CreateInstallation.js +83 -0
  86. package/build/src/components/Configure/content/InstallationContent.d.ts +1 -0
  87. package/build/src/components/Configure/content/InstallationContent.js +20 -0
  88. package/build/src/components/Configure/{UninstallContent.js → content/UninstallContent.js} +10 -9
  89. package/build/src/components/Configure/{UpdateInstallation.d.ts → content/UpdateInstallation.d.ts} +1 -1
  90. package/build/src/components/Configure/{UpdateInstallation.js → content/UpdateInstallation.js} +42 -28
  91. package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.d.ts +1 -1
  92. package/build/src/components/Configure/{fields → content/fields}/FieldMappings/FieldMapping.js +4 -7
  93. package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.js +10 -11
  94. package/build/src/components/Configure/{fields → content/fields}/FieldMappings/setFieldMapping.d.ts +1 -1
  95. package/build/src/components/Configure/content/fields/FieldMappings/setFieldMapping.js +21 -0
  96. package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.js +9 -14
  97. package/build/src/components/Configure/{fields → content/fields}/OptionalFields/setOptionalField.d.ts +1 -1
  98. package/build/src/components/Configure/content/fields/OptionalFields/setOptionalField.js +27 -0
  99. package/build/src/components/Configure/content/fields/ReadFields.d.ts +1 -0
  100. package/build/src/components/Configure/content/fields/ReadFields.js +11 -0
  101. package/build/src/components/Configure/content/fields/RequiredFields.js +23 -0
  102. package/build/src/components/Configure/content/fields/WriteFields/WriteFields.d.ts +1 -0
  103. package/build/src/components/Configure/content/fields/WriteFields/WriteFields.js +22 -0
  104. package/build/src/components/Configure/content/fields/WriteFields/index.d.ts +2 -0
  105. package/build/src/components/Configure/content/fields/WriteFields/index.js +5 -0
  106. package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.d.ts +3 -0
  107. package/build/src/components/Configure/content/fields/WriteFields/setNonConfigurableWriteField.js +32 -0
  108. package/build/src/components/Configure/content/useMutateInstallation.d.ts +23 -0
  109. package/build/src/components/Configure/content/useMutateInstallation.js +47 -0
  110. package/build/src/components/Configure/content/useSelectedConfigureState.d.ts +72 -0
  111. package/build/src/components/Configure/content/useSelectedConfigureState.js +24 -0
  112. package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.d.ts +11 -0
  113. package/build/src/components/Configure/layout/ConditionalProxyLayout/ConditionalProxyLayout.js +67 -0
  114. package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.d.ts +5 -0
  115. package/build/src/components/Configure/layout/ConditionalProxyLayout/InstalledSuccessBox.js +11 -0
  116. package/build/src/components/Configure/{ProtectedConnectionLayout.d.ts → layout/ProtectedConnectionLayout.d.ts} +2 -1
  117. package/build/src/components/Configure/{ProtectedConnectionLayout.js → layout/ProtectedConnectionLayout.js} +13 -13
  118. package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.d.ts +1 -0
  119. package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/NavObjectItem.js +3 -3
  120. package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.d.ts +7 -0
  121. package/build/src/components/Configure/nav/ObjectManagementNav/OtherTab.js +11 -0
  122. package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.d.ts +1 -1
  123. package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/UninstallInstallation.js +2 -2
  124. package/build/src/components/Configure/nav/ObjectManagementNav/constant.d.ts +1 -0
  125. package/build/src/components/Configure/nav/ObjectManagementNav/constant.js +4 -0
  126. package/build/src/components/Configure/{ObjectManagementNav → nav/ObjectManagementNav}/index.d.ts +1 -0
  127. package/build/src/components/Configure/nav/ObjectManagementNav/index.js +61 -0
  128. package/build/src/components/Configure/state/ConfigurationStateProvider.d.ts +70 -42
  129. package/build/src/components/Configure/state/ConfigurationStateProvider.js +39 -17
  130. package/build/src/components/Configure/state/HydratedRevisionContext.js +11 -9
  131. package/build/src/components/Configure/state/utils.d.ts +2 -2
  132. package/build/src/components/Configure/state/utils.js +44 -19
  133. package/build/src/components/Configure/types.d.ts +22 -6
  134. package/build/src/components/Configure/utils.d.ts +3 -2
  135. package/build/src/components/Configure/utils.js +25 -5
  136. package/build/src/components/Connect/ConnectProvider.d.ts +3 -1
  137. package/build/src/components/Connect/ConnectProvider.js +6 -12
  138. package/build/src/components/Connect/ConnectedSuccessBox.d.ts +5 -0
  139. package/build/src/components/Connect/ConnectedSuccessBox.js +13 -0
  140. package/build/src/components/Connect/useConnectionHandler.d.ts +10 -0
  141. package/build/src/components/Connect/useConnectionHandler.js +24 -0
  142. package/build/src/components/ErrorTextBox.js +11 -0
  143. package/build/src/components/Oauth/NoSubdomainEntry/LandingContent.d.ts +8 -0
  144. package/build/src/components/Oauth/{Hubspot/HubspotLandingContent.js → NoSubdomainEntry/LandingContent.js} +5 -4
  145. package/build/src/components/Oauth/NoSubdomainEntry/NoSubdomainOauthFlow.d.ts +16 -0
  146. package/build/src/components/Oauth/{Hubspot/HubspotOauthFlow.js → NoSubdomainEntry/NoSubdomainOauthFlow.js} +14 -14
  147. package/build/src/components/{Connect → Oauth}/OAuthPopup.js +8 -10
  148. package/build/src/components/Oauth/Salesforce/SalesforceOauthFlow.js +5 -5
  149. package/build/src/components/Oauth/Salesforce/SubdomainEntry.js +1 -1
  150. package/build/src/components/Oauth/fetchOAuthCallbackURL.d.ts +1 -1
  151. package/build/src/components/Oauth/fetchOAuthCallbackURL.js +3 -4
  152. package/build/src/components/RedirectHandler/RedirectHandler.d.ts +15 -0
  153. package/build/src/components/RedirectHandler/RedirectHandler.js +31 -0
  154. package/build/src/components/RedirectHandler/index.d.ts +1 -0
  155. package/build/src/components/RedirectHandler/index.js +5 -0
  156. package/build/src/components/SuccessTextBox.d.ts +5 -0
  157. package/build/src/components/SuccessTextBox.js +10 -0
  158. package/build/src/{components/AmpersandProvider/AmpersandProvider.js → context/AmpersandContextProvider/AmpersandContextProvider.js} +6 -6
  159. package/build/src/context/AmpersandContextProvider/index.d.ts +1 -0
  160. package/build/src/{components/AmpersandProvider → context/AmpersandContextProvider}/index.js +1 -1
  161. package/build/src/context/{ConnectionsContext.js → ConnectionsContextProvider.js} +11 -10
  162. package/build/src/context/{InstallIntegrationContext.d.ts → InstallIntegrationContextProvider.d.ts} +7 -2
  163. package/build/src/context/{InstallIntegrationContext.js → InstallIntegrationContextProvider.js} +29 -14
  164. package/build/src/context/{IntegrationListContext.js → IntegrationListContextProvider.js} +4 -4
  165. package/build/src/context/{ProjectContext.js → ProjectContextProvider.js} +4 -4
  166. package/build/src/hooks/useIsIntegrationInstalled.js +7 -7
  167. package/build/src/index.d.ts +1 -2
  168. package/build/src/index.js +1 -2
  169. package/build/src/public/index.d.ts +7 -0
  170. package/build/src/{components → public}/index.js +7 -3
  171. package/build/src/services/ApiService.d.ts +27 -0
  172. package/build/src/services/ApiService.js +34 -0
  173. package/build/src/services/api.d.ts +5 -4
  174. package/build/src/services/api.js +26 -19
  175. package/package.json +2 -2
  176. package/build/generated-sources/api/src/apis/DefaultApi.d.ts +0 -930
  177. package/build/generated-sources/api/src/apis/DefaultApi.js +0 -1019
  178. package/build/generated-sources/api/src/models/CreateDestinationRequest.d.ts +0 -44
  179. package/build/generated-sources/api/src/models/CreateDestinationRequest.js +0 -57
  180. package/build/generated-sources/api/src/models/CreateDestinationRequestMetadata.d.ts +0 -39
  181. package/build/generated-sources/api/src/models/OperationError.d.ts +0 -49
  182. package/build/generated-sources/api/src/models/OperationError.js +0 -56
  183. package/build/src/components/AmpersandProvider/index.d.ts +0 -1
  184. package/build/src/components/CenteredTextBox/CenteredTextBox.d.ts +0 -5
  185. package/build/src/components/CenteredTextBox/CenteredTextBox.js +0 -8
  186. package/build/src/components/Configure/ConfigureInstallationBase.js +0 -29
  187. package/build/src/components/Configure/CreateInstallation.js +0 -70
  188. package/build/src/components/Configure/ErrorTextBox.js +0 -9
  189. package/build/src/components/Configure/ObjectManagementNav/index.js +0 -53
  190. package/build/src/components/Configure/actions/onSaveCreate.d.ts +0 -3
  191. package/build/src/components/Configure/actions/onSaveUpdate.d.ts +0 -3
  192. package/build/src/components/Configure/fields/FieldMappings/setFieldMapping.js +0 -18
  193. package/build/src/components/Configure/fields/OptionalFields/setOptionalField.js +0 -21
  194. package/build/src/components/Configure/fields/RequiredFields.js +0 -27
  195. package/build/src/components/Oauth/Hubspot/HubspotLandingContent.d.ts +0 -7
  196. package/build/src/components/Oauth/Hubspot/HubspotOauthFlow.d.ts +0 -15
  197. package/build/src/components/index.d.ts +0 -3
  198. /package/build/src/components/Configure/{CreateInstallation.d.ts → content/CreateInstallation.d.ts} +0 -0
  199. /package/build/src/components/Configure/{UninstallContent.d.ts → content/UninstallContent.d.ts} +0 -0
  200. /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.d.ts +0 -0
  201. /package/build/src/components/Configure/{fields → content/fields}/FieldHeader.js +0 -0
  202. /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/RequiredFieldMappings.d.ts +0 -0
  203. /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.d.ts +0 -0
  204. /package/build/src/components/Configure/{fields → content/fields}/FieldMappings/index.js +0 -0
  205. /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/OptionalFields.d.ts +0 -0
  206. /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.d.ts +0 -0
  207. /package/build/src/components/Configure/{fields → content/fields}/OptionalFields/index.js +0 -0
  208. /package/build/src/components/Configure/{fields → content/fields}/RequiredFields.d.ts +0 -0
  209. /package/build/src/components/{Configure/ErrorTextBox.d.ts → ErrorTextBox.d.ts} +0 -0
  210. /package/build/src/components/{Connect → Oauth}/OAuthPopup.d.ts +0 -0
  211. /package/build/src/{components/AmpersandProvider/AmpersandProvider.d.ts → context/AmpersandContextProvider/AmpersandContextProvider.d.ts} +0 -0
  212. /package/build/src/context/{ApiKeyProvider.d.ts → ApiKeyContextProvider.d.ts} +0 -0
  213. /package/build/src/context/{ApiKeyProvider.js → ApiKeyContextProvider.js} +0 -0
  214. /package/build/src/context/{ConnectionsContext.d.ts → ConnectionsContextProvider.d.ts} +0 -0
  215. /package/build/src/context/{IntegrationListContext.d.ts → IntegrationListContextProvider.d.ts} +0 -0
  216. /package/build/src/context/{ProjectContext.d.ts → ProjectContextProvider.d.ts} +0 -0
@@ -2,14 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useIsIntegrationInstalled = void 0;
4
4
  const react_1 = require("react");
5
- const ApiKeyProvider_1 = require("../context/ApiKeyProvider");
6
- const IntegrationListContext_1 = require("../context/IntegrationListContext");
7
- const ProjectContext_1 = require("../context/ProjectContext");
5
+ const ApiKeyContextProvider_1 = require("../context/ApiKeyContextProvider");
6
+ const IntegrationListContextProvider_1 = require("../context/IntegrationListContextProvider");
7
+ const ProjectContextProvider_1 = require("../context/ProjectContextProvider");
8
8
  const api_1 = require("../services/api");
9
9
  const useIsIntegrationInstalled = (integration, groupRef) => {
10
- const apiKey = (0, ApiKeyProvider_1.useApiKey)();
11
- const { projectId } = (0, ProjectContext_1.useProject)();
12
- const { integrations } = (0, IntegrationListContext_1.useIntegrationList)();
10
+ const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
11
+ const { projectId } = (0, ProjectContextProvider_1.useProject)();
12
+ const { integrations } = (0, IntegrationListContextProvider_1.useIntegrationList)();
13
13
  const [isLoaded, setIsLoaded] = (0, react_1.useState)(false);
14
14
  const [isIntegrationInstalled, setIsIntegrationInstalled] = (0, react_1.useState)(null);
15
15
  if (!apiKey || !projectId) {
@@ -27,7 +27,7 @@ const useIsIntegrationInstalled = (integration, groupRef) => {
27
27
  (0, react_1.useEffect)(() => {
28
28
  if (!integrationToCheck)
29
29
  return;
30
- (0, api_1.api)().listInstallations({
30
+ (0, api_1.api)().installationApi.listInstallations({
31
31
  projectId,
32
32
  integrationId: integrationToCheck.id,
33
33
  groupRef,
@@ -1,2 +1 @@
1
- export * from './components';
2
- export * from './hooks';
1
+ export * from './public';
@@ -14,5 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./components"), exports);
18
- __exportStar(require("./hooks"), exports);
17
+ __exportStar(require("./public"), exports);
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Contains all the features to be exported out of the library
3
+ */
4
+ export * from '../context/AmpersandContextProvider';
5
+ export * from '../components/Configure';
6
+ export * from '../components/Connect/ConnectProvider';
7
+ export * from '../hooks/useIsIntegrationInstalled';
@@ -14,6 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./AmpersandProvider"), exports);
18
- __exportStar(require("./Configure"), exports);
19
- __exportStar(require("./Connect/ConnectProvider"), exports);
17
+ /**
18
+ * Contains all the features to be exported out of the library
19
+ */
20
+ __exportStar(require("../context/AmpersandContextProvider"), exports);
21
+ __exportStar(require("../components/Configure"), exports);
22
+ __exportStar(require("../components/Connect/ConnectProvider"), exports);
23
+ __exportStar(require("../hooks/useIsIntegrationInstalled"), exports);
@@ -0,0 +1,27 @@
1
+ import { AllowedDomainApi, Configuration, ConnectionApi, ConsumerApi, DestinationApi, GroupApi, InstallationApi, IntegrationApi, OAuthApi, OperationApi, OperationLogApi, ProjectApi, ProjectMembershipApi, ProviderAppApi, RevisionApi, UploadURLApi } from '../../generated-sources/api/src';
2
+ /**
3
+ * ApiService is a wrapper around the generated API client, which exposes
4
+ * all generated api services as properties.
5
+ * This allows us to inject the configuration object into every api service.
6
+ *
7
+ * New or legacy services need to be added or deleted here after services are generated.
8
+ * Note: some services are not used in this repo.
9
+ */
10
+ export declare class ApiService {
11
+ allowedDomainApi: AllowedDomainApi;
12
+ connectionApi: ConnectionApi;
13
+ consumerApi: ConsumerApi;
14
+ destinationApi: DestinationApi;
15
+ groupApi: GroupApi;
16
+ installationApi: InstallationApi;
17
+ integrationApi: IntegrationApi;
18
+ oAuthApi: OAuthApi;
19
+ operationApi: OperationApi;
20
+ operationLogApi: OperationLogApi;
21
+ projectApi: ProjectApi;
22
+ projectMembershipApi: ProjectMembershipApi;
23
+ providerAppApi: ProviderAppApi;
24
+ revisionApi: RevisionApi;
25
+ uploadURLApi: UploadURLApi;
26
+ constructor(config: Configuration);
27
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ApiService = void 0;
4
+ /* eslint-disable import/no-relative-packages */
5
+ // currently not using a bundler to support alias imports
6
+ const src_1 = require("../../generated-sources/api/src");
7
+ /**
8
+ * ApiService is a wrapper around the generated API client, which exposes
9
+ * all generated api services as properties.
10
+ * This allows us to inject the configuration object into every api service.
11
+ *
12
+ * New or legacy services need to be added or deleted here after services are generated.
13
+ * Note: some services are not used in this repo.
14
+ */
15
+ class ApiService {
16
+ constructor(config) {
17
+ this.allowedDomainApi = new src_1.AllowedDomainApi(config);
18
+ this.connectionApi = new src_1.ConnectionApi(config);
19
+ this.consumerApi = new src_1.ConsumerApi(config);
20
+ this.destinationApi = new src_1.DestinationApi(config);
21
+ this.groupApi = new src_1.GroupApi(config);
22
+ this.installationApi = new src_1.InstallationApi(config);
23
+ this.integrationApi = new src_1.IntegrationApi(config);
24
+ this.oAuthApi = new src_1.OAuthApi(config);
25
+ this.operationApi = new src_1.OperationApi(config);
26
+ this.operationLogApi = new src_1.OperationLogApi(config);
27
+ this.projectApi = new src_1.ProjectApi(config);
28
+ this.projectMembershipApi = new src_1.ProjectMembershipApi(config);
29
+ this.providerAppApi = new src_1.ProviderAppApi(config);
30
+ this.revisionApi = new src_1.RevisionApi(config);
31
+ this.uploadURLApi = new src_1.UploadURLApi(config);
32
+ }
33
+ }
34
+ exports.ApiService = ApiService;
@@ -1,9 +1,10 @@
1
- import { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, DefaultApi, HydratedIntegrationField, HydratedIntegrationFieldExistent, HydratedIntegrationObject, HydratedIntegrationRead, HydratedRevision, Installation, Integration, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig } from '../../generated-sources/api/src';
1
+ import { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationField, HydratedIntegrationFieldExistent, HydratedIntegrationObject, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedRevision, Installation, Integration, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig } from '../../generated-sources/api/src';
2
+ import { ApiService } from './ApiService';
2
3
  export declare const AMP_SERVER: string;
3
4
  export declare const AMP_API_ROOT: string;
4
- export declare const setApi: (api: DefaultApi) => void;
5
- export declare const api: () => DefaultApi;
5
+ export declare const setApi: (api: ApiService) => void;
6
+ export declare const api: () => ApiService;
6
7
  /**
7
8
  * Types exported from generated api
8
9
  */
9
- export type { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationRead, HydratedIntegrationObject, HydratedIntegrationField, HydratedRevision, Installation, Integration, HydratedIntegrationFieldExistent, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig, };
10
+ export type { Config, Connection, CreateInstallationOperationRequest, CreateInstallationRequestConfig, HydratedIntegrationRead, HydratedIntegrationWrite, HydratedIntegrationWriteObject, HydratedIntegrationObject, HydratedIntegrationField, HydratedRevision, Installation, Integration, HydratedIntegrationFieldExistent, IntegrationFieldMapping, Project, ProviderApp, UpdateInstallationOperationRequest, UpdateInstallationRequestInstallationConfig, };
@@ -4,6 +4,7 @@ exports.api = exports.setApi = exports.AMP_API_ROOT = exports.AMP_SERVER = void
4
4
  /* eslint-disable import/no-relative-packages */
5
5
  // currently not using a bundler to support alias imports
6
6
  const src_1 = require("../../generated-sources/api/src");
7
+ const ApiService_1 = require("./ApiService");
7
8
  /**
8
9
  * To update the api you need to
9
10
  * 1. git clone `https://github.com/amp-labs/server` into a sibling directory
@@ -16,25 +17,31 @@ const src_1 = require("../../generated-sources/api/src");
16
17
  *
17
18
  * */
18
19
  const VERSION = 'v1';
20
+ const prodEndpoint = 'https://api.withampersand.com';
19
21
  function getApiEndpoint() {
20
- var _a;
21
- switch (process.env.REACT_APP_AMP_SERVER) {
22
- case 'local':
23
- return 'http://localhost:8080';
24
- case 'dev':
25
- return 'https://dev-api.withampersand.com';
26
- case 'staging':
27
- return 'https://staging-api.withampersand.com';
28
- case 'prod':
29
- return 'https://api.withampersand.com';
30
- case 'mock':
31
- return 'http://127.0.0.1:4010';
32
- case '':
33
- return 'https://api.withampersand.com';
34
- default:
35
- // The user may provide an arbitrary URL here if they want to, or else the
36
- // default prod url will be used.
37
- return (_a = process.env.REACT_APP_AMP_SERVER) !== null && _a !== void 0 ? _a : 'https://api.withampersand.com';
22
+ try {
23
+ const ENV_SERVER = process.env.REACT_APP_AMP_SERVER;
24
+ switch (ENV_SERVER) {
25
+ case 'local':
26
+ return 'http://localhost:8080';
27
+ case 'dev':
28
+ return 'https://dev-api.withampersand.com';
29
+ case 'staging':
30
+ return 'https://staging-api.withampersand.com';
31
+ case 'prod':
32
+ return prodEndpoint;
33
+ case 'mock':
34
+ return 'http://127.0.0.1:4010';
35
+ case '':
36
+ return prodEndpoint;
37
+ default:
38
+ // The user may provide an arbitrary URL here if they want to, or else the
39
+ // default prod url will be used.
40
+ return ENV_SERVER !== null && ENV_SERVER !== void 0 ? ENV_SERVER : prodEndpoint;
41
+ }
42
+ }
43
+ catch (e) {
44
+ return prodEndpoint;
38
45
  }
39
46
  }
40
47
  const getApiRoot = (server, version) => `${server}/${version}`;
@@ -54,7 +61,7 @@ exports.AMP_API_ROOT = assignRoot();
54
61
  const config = new src_1.Configuration({
55
62
  basePath: exports.AMP_API_ROOT,
56
63
  });
57
- let apiValue = new src_1.DefaultApi(config);
64
+ let apiValue = new ApiService_1.ApiService(config);
58
65
  // For testing, etc. we may want to use a different API configuration than the default
59
66
  const setApi = (api) => {
60
67
  apiValue = api;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",
@@ -61,7 +61,7 @@
61
61
  "eslint-plugin-promise": "^6.1.1",
62
62
  "eslint-plugin-react": "^7.33.2",
63
63
  "eslint-plugin-react-hooks": "^4.6.0",
64
- "eslint-plugin-simple-import-sort": "^10.0.0",
64
+ "eslint-plugin-simple-import-sort": "^12.0.0",
65
65
  "jest": "^29.7.0",
66
66
  "react-test-renderer": "^18.2.0",
67
67
  "typescript": "^5.2.2"