@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
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ObjectManagementNav = exports.useSelectedObjectName = exports.SelectedObjectNameContext = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ const react_2 = require("@chakra-ui/react");
7
+ const InstallIntegrationContextProvider_1 = require("../../../../context/InstallIntegrationContextProvider");
8
+ const ProjectContextProvider_1 = require("../../../../context/ProjectContextProvider");
9
+ const utils_1 = require("../../../../utils");
10
+ const ConfigurationStateProvider_1 = require("../../state/ConfigurationStateProvider");
11
+ const HydratedRevisionContext_1 = require("../../state/HydratedRevisionContext");
12
+ const utils_2 = require("../../utils");
13
+ const NavObjectItem_1 = require("./NavObjectItem");
14
+ const OtherTab_1 = require("./OtherTab");
15
+ const UninstallInstallation_1 = require("./UninstallInstallation");
16
+ // Create a context for the selected navObject's name
17
+ exports.SelectedObjectNameContext = (0, react_1.createContext)(null);
18
+ // Custom hook to access the selected navObject's name
19
+ function useSelectedObjectName() {
20
+ const selectedNavObjectName = (0, react_1.useContext)(exports.SelectedObjectNameContext);
21
+ if (selectedNavObjectName === null) {
22
+ throw new Error('useSelectedNavObjectName must be used within a SelectedNavObjectNameProvider');
23
+ }
24
+ return { selectedObjectName: selectedNavObjectName }; // Return as an object
25
+ }
26
+ exports.useSelectedObjectName = useSelectedObjectName;
27
+ function getSelectedObject(navObjects, tabIndex) {
28
+ if (navObjects === null || navObjects === void 0 ? void 0 : navObjects[tabIndex]) {
29
+ // read tabs
30
+ return navObjects[tabIndex];
31
+ }
32
+ // uninstall tab
33
+ return { name: UninstallInstallation_1.UNINSTALL_INSTALLATION_CONST, completed: false };
34
+ }
35
+ // note: when the object key exists in the config; the user has already completed the object before
36
+ function ObjectManagementNav({ children, }) {
37
+ var _a, _b, _c;
38
+ const { project } = (0, ProjectContextProvider_1.useProject)();
39
+ const { installation, provider } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
40
+ const { hydratedRevision } = (0, HydratedRevisionContext_1.useHydratedRevision)();
41
+ const { objectConfigurationsState } = (0, ConfigurationStateProvider_1.useObjectsConfigureState)();
42
+ // Object Nav Tab Index
43
+ const [tabIndex, setTabIndex] = (0, react_1.useState)(0);
44
+ const appName = (project === null || project === void 0 ? void 0 : project.appName) || '';
45
+ const config = installation === null || installation === void 0 ? void 0 : installation.config;
46
+ const readNavObjects = hydratedRevision && (0, utils_2.generateNavObjects)(config, hydratedRevision);
47
+ const isNavObjectsReady = readNavObjects !== null; // null = hydratedRevision/config is not ready
48
+ const isWriteSupported = !!((_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.write);
49
+ const otherNavObject = isWriteSupported ? (0, utils_2.generateOtherNavObject)(config) : undefined;
50
+ const allNavObjects = [...(readNavObjects || [])];
51
+ if (otherNavObject && isWriteSupported) {
52
+ allNavObjects.push(otherNavObject);
53
+ }
54
+ const selectedObject = getSelectedObject(allNavObjects, tabIndex);
55
+ return ((0, jsx_runtime_1.jsx)(exports.SelectedObjectNameContext.Provider, { value: selectedObject === null || selectedObject === void 0 ? void 0 : selectedObject.name, children: (0, jsx_runtime_1.jsxs)(react_2.Box, { p: 8, maxWidth: "55rem", border: "1px solid #EFEFEF", borderRadius: 6, boxShadow: "md", margin: "auto", bgColor: "whitesmoke", display: "flex", gap: "6", minHeight: "100%", children: [(0, jsx_runtime_1.jsxs)(react_2.Box, { width: "20rem", children: [(0, jsx_runtime_1.jsxs)(react_2.Text, { children: [(0, utils_1.capitalize)(provider), " integration"] }), (0, jsx_runtime_1.jsx)(react_2.Text, { marginBottom: "20px", fontSize: "1.125rem", fontWeight: "500", children: appName }), isNavObjectsReady && ((0, jsx_runtime_1.jsxs)(react_2.Tabs, { index: tabIndex, onChange: setTabIndex, orientation: "horizontal", children: [readNavObjects.map((object) => {
56
+ var _a, _b, _c, _d;
57
+ return ((0, jsx_runtime_1.jsx)(NavObjectItem_1.NavObjectItem, { objectName: object.name, completed: object.completed, pending: ((_b = (_a = objectConfigurationsState[object.name]) === null || _a === void 0 ? void 0 : _a.read) === null || _b === void 0 ? void 0 : _b.isOptionalFieldsModified)
58
+ || ((_d = (_c = objectConfigurationsState[object.name]) === null || _c === void 0 ? void 0 : _c.read) === null || _d === void 0 ? void 0 : _d.isRequiredMapFieldsModified) }, object.name));
59
+ }), isWriteSupported && otherNavObject && ((0, jsx_runtime_1.jsx)(OtherTab_1.OtherTab, { completed: otherNavObject.completed, pending: (_c = (_b = objectConfigurationsState === null || objectConfigurationsState === void 0 ? void 0 : objectConfigurationsState.other) === null || _b === void 0 ? void 0 : _b.write) === null || _c === void 0 ? void 0 : _c.isWriteModified, displayName: (readNavObjects === null || readNavObjects === void 0 ? void 0 : readNavObjects.length) ? 'other' : 'write' })), installation && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(react_2.Divider, { marginTop: 10, marginBottom: 3 }), (0, jsx_runtime_1.jsx)(UninstallInstallation_1.UninstallInstallation, { text: "Uninstall" }, "uninstall-installation")] }))] }))] }), children] }) }));
60
+ }
61
+ exports.ObjectManagementNav = ObjectManagementNav;
@@ -1,53 +1,81 @@
1
1
  import React from 'react';
2
+ import { Draft } from 'immer';
2
3
  import { ConfigureState, ObjectConfigurationsState } from '../types';
3
- export declare function useConfigureState(): {
4
+ export declare const ConfigurationContext: React.Context<{
5
+ objectConfigurationsState: ObjectConfigurationsState;
6
+ setObjectConfigurationsState: React.Dispatch<React.SetStateAction<ObjectConfigurationsState>>;
7
+ setConfigureState: (objectName: string, producer: (draft: Draft<ConfigureState>) => void) => void;
8
+ resetConfigureState: (objectName: string, configureState: ConfigureState) => void;
9
+ resetPendingConfigurationState: (objectName: string) => void;
10
+ } | undefined>;
11
+ /**
12
+ * Custom hook to access and update the configuration state for all objects
13
+ */
14
+ export declare function useObjectsConfigureState(): {
4
15
  objectConfigurationsState: ObjectConfigurationsState;
5
16
  setObjectConfigurationsState: React.Dispatch<React.SetStateAction<ObjectConfigurationsState>>;
6
17
  setConfigureState: (objectName: string, producer: (draft: {
7
- allFields: {
8
- fieldName: string;
9
- displayName: string;
10
- }[] | null;
11
- requiredFields: ({
12
- fieldName: string;
13
- displayName: string;
14
- } | {
15
- mapToName: string;
16
- mapToDisplayName?: string | undefined;
17
- _default?: string | undefined;
18
- prompt?: string | undefined;
19
- })[] | null;
20
- optionalFields: ({
21
- fieldName: string;
22
- displayName: string;
23
- } | {
24
- mapToName: string;
25
- mapToDisplayName?: string | undefined;
26
- _default?: string | undefined;
27
- prompt?: string | undefined;
28
- })[] | null;
29
- requiredMapFields: {
30
- mapToName: string;
31
- mapToDisplayName?: string | undefined;
32
- _default?: string | undefined;
33
- prompt?: string | undefined;
34
- }[] | null;
35
- selectedOptionalFields: {
36
- [x: string]: boolean;
37
- } | null;
38
- selectedFieldMappings: {
39
- [x: string]: string | undefined;
40
- } | null;
41
- isOptionalFieldsModified: boolean;
42
- isRequiredMapFieldsModified: boolean;
43
- savedConfig: {
44
- optionalFields: {
45
- [x: string]: boolean;
46
- };
18
+ read: {
19
+ allFields: {
20
+ fieldName: string;
21
+ displayName: string;
22
+ }[] | null;
23
+ requiredFields: ({
24
+ fieldName: string;
25
+ displayName: string;
26
+ } | {
27
+ mapToName: string;
28
+ mapToDisplayName?: string | undefined;
29
+ _default?: string | undefined;
30
+ prompt?: string | undefined;
31
+ })[] | null;
32
+ optionalFields: ({
33
+ fieldName: string;
34
+ displayName: string;
35
+ } | {
36
+ mapToName: string;
37
+ mapToDisplayName?: string | undefined;
38
+ _default?: string | undefined;
39
+ prompt?: string | undefined;
40
+ })[] | null;
47
41
  requiredMapFields: {
42
+ mapToName: string;
43
+ mapToDisplayName?: string | undefined;
44
+ _default?: string | undefined;
45
+ prompt?: string | undefined;
46
+ }[] | null;
47
+ selectedOptionalFields: {
48
+ [x: string]: boolean;
49
+ } | null;
50
+ selectedFieldMappings: {
48
51
  [x: string]: string | undefined;
52
+ } | null;
53
+ isOptionalFieldsModified: boolean;
54
+ isRequiredMapFieldsModified: boolean;
55
+ savedConfig: {
56
+ optionalFields: {
57
+ [x: string]: boolean;
58
+ };
59
+ requiredMapFields: {
60
+ [x: string]: string | undefined;
61
+ };
62
+ };
63
+ } | null;
64
+ write: {
65
+ writeObjects: {
66
+ objectName: string;
67
+ displayName: string;
68
+ }[] | null;
69
+ selectedNonConfigurableWriteFields: {
70
+ [x: string]: boolean;
71
+ } | null;
72
+ isWriteModified: boolean;
73
+ savedConfig: {
74
+ selectedNonConfigurableWriteFields: {
75
+ [x: string]: boolean;
76
+ };
49
77
  };
50
- };
78
+ } | null;
51
79
  }) => void) => void;
52
80
  resetConfigureState: (objectName: string, configureState: ConfigureState) => void;
53
81
  resetPendingConfigurationState: (objectName: string) => void;
@@ -1,27 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigurationProvider = exports.useConfigureState = void 0;
3
+ exports.ConfigurationProvider = exports.useObjectsConfigureState = exports.ConfigurationContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
6
  const immer_1 = require("immer");
7
- const InstallIntegrationContext_1 = require("../../../context/InstallIntegrationContext");
7
+ const InstallIntegrationContextProvider_1 = require("../../../context/InstallIntegrationContextProvider");
8
+ const constant_1 = require("../nav/ObjectManagementNav/constant");
8
9
  const HydratedRevisionContext_1 = require("./HydratedRevisionContext");
9
10
  const utils_1 = require("./utils");
10
11
  // Create a context for the configuration state
11
- const ConfigurationContext = (0, react_1.createContext)(undefined);
12
+ exports.ConfigurationContext = (0, react_1.createContext)(undefined);
12
13
  const initialObjectConfigurationsState = {};
13
- // Custom hook to access and update the configuration state
14
- function useConfigureState() {
15
- const context = (0, react_1.useContext)(ConfigurationContext);
14
+ /**
15
+ * Custom hook to access and update the configuration state for all objects
16
+ */
17
+ function useObjectsConfigureState() {
18
+ const context = (0, react_1.useContext)(exports.ConfigurationContext);
16
19
  if (!context) {
17
- throw new Error('useConfigureState must be used within a ConfigurationProvider');
20
+ throw new Error('useObjectsConfigureState must be used within a ConfigurationProvider');
18
21
  }
19
22
  return context;
20
23
  }
21
- exports.useConfigureState = useConfigureState;
24
+ exports.useObjectsConfigureState = useObjectsConfigureState;
22
25
  // Create a provider component for the configuration context
23
26
  function ConfigurationProvider({ children }) {
24
- const { installation } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
27
+ const { installation } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
25
28
  const { hydratedRevision, loading } = (0, HydratedRevisionContext_1.useHydratedRevision)();
26
29
  // 1. get config from installations (contains form selection state)
27
30
  // 2. get the hydrated revision from installation revisionId (contains full form)
@@ -53,16 +56,35 @@ function ConfigurationProvider({ children }) {
53
56
  draft[objectName] = configureState;
54
57
  }));
55
58
  }, [setObjectConfigurationsState]);
56
- // set configure state of single object
57
- const resetPendingConfigurationState = (0, react_1.useCallback)((objectName) => {
59
+ const resetWritePendingConfigurationState = (0, react_1.useCallback)(() => {
58
60
  setObjectConfigurationsState((0, immer_1.produce)((draft) => {
59
- // immer exception when mutating a draft
60
- // eslint-disable-next-line no-param-reassign
61
- draft[objectName].isOptionalFieldsModified = false;
62
- // eslint-disable-next-line no-param-reassign
63
- draft[objectName].isRequiredMapFieldsModified = false;
61
+ const writeDraft = draft.other.write;
62
+ if (writeDraft) {
63
+ writeDraft.isWriteModified = false;
64
+ }
65
+ }));
66
+ }, [setObjectConfigurationsState]);
67
+ const resetReadPendingConfigurationState = (0, react_1.useCallback)((objectName) => {
68
+ setObjectConfigurationsState((0, immer_1.produce)((draft) => {
69
+ var _a;
70
+ const readDraft = (_a = draft[objectName]) === null || _a === void 0 ? void 0 : _a.read;
71
+ if (readDraft) {
72
+ readDraft.isOptionalFieldsModified = false;
73
+ readDraft.isRequiredMapFieldsModified = false;
74
+ }
64
75
  }));
65
76
  }, [setObjectConfigurationsState]);
77
+ // set configure state of single object
78
+ const resetPendingConfigurationState = (0, react_1.useCallback)((objectName) => {
79
+ // write case
80
+ if (objectName === constant_1.OTHER_CONST) {
81
+ resetWritePendingConfigurationState();
82
+ }
83
+ else {
84
+ // read case
85
+ resetReadPendingConfigurationState(objectName);
86
+ }
87
+ }, [resetReadPendingConfigurationState, resetWritePendingConfigurationState]);
66
88
  const contextValue = (0, react_1.useMemo)(() => ({
67
89
  objectConfigurationsState,
68
90
  setObjectConfigurationsState,
@@ -71,6 +93,6 @@ function ConfigurationProvider({ children }) {
71
93
  resetPendingConfigurationState,
72
94
  }), [objectConfigurationsState,
73
95
  resetConfigureState, resetPendingConfigurationState, setConfigureState]);
74
- return ((0, jsx_runtime_1.jsx)(ConfigurationContext.Provider, { value: contextValue, children: children }));
96
+ return ((0, jsx_runtime_1.jsx)(exports.ConfigurationContext.Provider, { value: contextValue, children: children }));
75
97
  }
76
98
  exports.ConfigurationProvider = ConfigurationProvider;
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.HydratedRevisionProvider = exports.useHydratedRevision = exports.HydratedRevisionContext = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("react");
6
- const ApiKeyProvider_1 = require("../../../context/ApiKeyProvider");
7
- const ConnectionsContext_1 = require("../../../context/ConnectionsContext");
6
+ const ApiKeyContextProvider_1 = require("../../../context/ApiKeyContextProvider");
7
+ const ConnectionsContextProvider_1 = require("../../../context/ConnectionsContextProvider");
8
8
  const ErrorContextProvider_1 = require("../../../context/ErrorContextProvider");
9
- const InstallIntegrationContext_1 = require("../../../context/InstallIntegrationContext");
9
+ const InstallIntegrationContextProvider_1 = require("../../../context/InstallIntegrationContextProvider");
10
10
  const api_1 = require("../../../services/api");
11
- const ErrorTextBox_1 = require("../ErrorTextBox");
11
+ const ErrorTextBox_1 = require("../../ErrorTextBox");
12
12
  exports.HydratedRevisionContext = (0, react_1.createContext)({
13
13
  hydratedRevision: null,
14
14
  loading: false,
@@ -23,12 +23,12 @@ const useHydratedRevision = () => {
23
23
  exports.useHydratedRevision = useHydratedRevision;
24
24
  function HydratedRevisionProvider({ projectId, children, }) {
25
25
  var _a;
26
- const { selectedConnection } = (0, ConnectionsContext_1.useConnections)();
27
- const { integrationId, integrationObj } = (0, InstallIntegrationContext_1.useInstallIntegrationProps)();
26
+ const { selectedConnection } = (0, ConnectionsContextProvider_1.useConnections)();
27
+ const { integrationId, integrationObj } = (0, InstallIntegrationContextProvider_1.useInstallIntegrationProps)();
28
28
  const [hydratedRevision, setHydratedRevision] = (0, react_1.useState)(null);
29
29
  const [loading, setLoading] = (0, react_1.useState)(true);
30
30
  const { isError, removeError, setError } = (0, ErrorContextProvider_1.useErrorState)();
31
- const apiKey = (0, ApiKeyProvider_1.useApiKey)();
31
+ const apiKey = (0, ApiKeyContextProvider_1.useApiKey)();
32
32
  const connectionId = selectedConnection === null || selectedConnection === void 0 ? void 0 : selectedConnection.id;
33
33
  const revisionId = (_a = integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.latestRevision) === null || _a === void 0 ? void 0 : _a.id;
34
34
  const errorIntegrationIdentifier = (integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.name) || integrationId;
@@ -39,7 +39,7 @@ function HydratedRevisionProvider({ projectId, children, }) {
39
39
  && revisionId
40
40
  && connectionId
41
41
  && apiKey) {
42
- (0, api_1.api)().getHydratedRevision({
42
+ (0, api_1.api)().revisionApi.getHydratedRevision({
43
43
  projectId,
44
44
  integrationId,
45
45
  revisionId,
@@ -74,6 +74,8 @@ function HydratedRevisionProvider({ projectId, children, }) {
74
74
  hydratedRevision,
75
75
  loading,
76
76
  }), [hydratedRevision, loading]);
77
- return ((0, jsx_runtime_1.jsx)(exports.HydratedRevisionContext.Provider, { value: contextValue, children: isError(ErrorContextProvider_1.ErrorBoundary.HYDRATED_REVISION, errorIntegrationIdentifier) ? (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: `Error retrieving integration details for '${(integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.name) || integrationId || 'unknown integration'}. This is sometimes caused by insufficient permissions with your credentials'` }) : children }));
77
+ const errorMsg = `Error retrieving integration details for '${(integrationObj === null || integrationObj === void 0 ? void 0 : integrationObj.name) || integrationId || 'unknown integration'}. This is sometimes caused by insufficient permissions with your credentials'`;
78
+ return ((0, jsx_runtime_1.jsx)(exports.HydratedRevisionContext.Provider, { value: contextValue, children: isError(ErrorContextProvider_1.ErrorBoundary.HYDRATED_REVISION, errorIntegrationIdentifier)
79
+ ? (0, jsx_runtime_1.jsx)(ErrorTextBox_1.ErrorTextBox, { message: errorMsg }) : children }));
78
80
  }
79
81
  exports.HydratedRevisionProvider = HydratedRevisionProvider;
@@ -1,7 +1,7 @@
1
- import { Config, HydratedIntegrationRead, HydratedRevision } from '../../../services/api';
1
+ import { Config, HydratedRevision } from '../../../services/api';
2
2
  import { ConfigureState, ObjectConfigurationsState, SelectMappingFields, SelectOptionalFields } from '../types';
3
3
  export declare function isFieldObjectEqual(prevFields: SelectMappingFields | SelectOptionalFields, currentFields: SelectMappingFields | SelectOptionalFields): boolean;
4
- export declare function generateConfigurationState(action: HydratedIntegrationRead, objectName: string, config?: Config): ConfigureState;
4
+ export declare function generateConfigurationState(hydratedRevision: HydratedRevision, objectName: string, config?: Config): ConfigureState;
5
5
  export declare const setHydrateConfigState: (hydratedRevision: HydratedRevision, config: Config | undefined, selectedObjectName: string, setConfigureState: (objectName: string, configureState: ConfigureState) => void) => void;
6
6
  /**
7
7
  * resets configure state for all objects in hydrated revision to hydrated revision values
@@ -11,18 +11,22 @@ function isFieldObjectEqual(prevFields, currentFields) {
11
11
  return (0, lodash_isequal_1.default)(prevFields, currentFields);
12
12
  }
13
13
  exports.isFieldObjectEqual = isFieldObjectEqual;
14
- function generateConfigurationState(action, objectName, config) {
15
- var _a, _b, _c, _d, _e, _f, _g, _h;
14
+ const generateConfigurationStateRead = (readAction, objectName, config) => {
15
+ var _a, _b, _c, _d, _e, _f;
16
+ if (!readAction) {
17
+ return null;
18
+ }
16
19
  // refactor this section to be immutable at hydrated revision level
17
- const object = (0, utils_1.getStandardObjectFromAction)(action, objectName);
20
+ const object = (0, utils_1.getStandardObjectFromAction)(readAction, objectName);
18
21
  const requiredFields = object && (0, utils_1.getRequiredFieldsFromObject)(object);
19
22
  const optionalFields = object && (0, utils_1.getOptionalFieldsFromObject)(object);
20
23
  const requiredMapFields = object && (0, utils_1.getRequiredMapFieldsFromObject)(object);
21
24
  /// //////////////////////////////////////////////////////////////////////
22
25
  const allFields = (object === null || object === void 0 ? void 0 : object.allFields) || [];
23
- const selectedFields = ((_d = (_c = (_b = (_a = config === null || config === void 0 ? void 0 : config.content) === null || _a === void 0 ? void 0 : _a.read) === null || _b === void 0 ? void 0 : _b.standardObjects) === null || _c === void 0 ? void 0 : _c[objectName]) === null || _d === void 0 ? void 0 : _d.selectedFields) || {};
24
- const selectedFieldMappings = ((_h = (_g = (_f = (_e = config === null || config === void 0 ? void 0 : config.content) === null || _e === void 0 ? void 0 : _e.read) === null || _f === void 0 ? void 0 : _f.standardObjects) === null || _g === void 0 ? void 0 : _g[objectName]) === null || _h === void 0 ? void 0 : _h.selectedFieldMappings) || {};
25
- const optionalFieldsSaved = Object.assign({}, selectedFields);
26
+ const content = config === null || config === void 0 ? void 0 : config.content;
27
+ const readSelectedFields = ((_c = (_b = (_a = content === null || content === void 0 ? void 0 : content.read) === null || _a === void 0 ? void 0 : _a.standardObjects) === null || _b === void 0 ? void 0 : _b[objectName]) === null || _c === void 0 ? void 0 : _c.selectedFields) || {};
28
+ const selectedFieldMappings = ((_f = (_e = (_d = content === null || content === void 0 ? void 0 : content.read) === null || _d === void 0 ? void 0 : _d.standardObjects) === null || _e === void 0 ? void 0 : _e[objectName]) === null || _f === void 0 ? void 0 : _f.selectedFieldMappings) || {};
29
+ const optionalFieldsSaved = Object.assign({}, readSelectedFields);
26
30
  const requiredMapFieldsSaved = Object.assign({}, selectedFieldMappings);
27
31
  return {
28
32
  allFields,
@@ -30,7 +34,7 @@ function generateConfigurationState(action, objectName, config) {
30
34
  optionalFields,
31
35
  requiredMapFields,
32
36
  // selected state
33
- selectedOptionalFields: selectedFields,
37
+ selectedOptionalFields: readSelectedFields,
34
38
  selectedFieldMappings,
35
39
  isOptionalFieldsModified: false,
36
40
  isRequiredMapFieldsModified: false,
@@ -39,16 +43,39 @@ function generateConfigurationState(action, objectName, config) {
39
43
  requiredMapFields: requiredMapFieldsSaved, // from config
40
44
  },
41
45
  };
46
+ };
47
+ const generateConfigurationStateWrite = (writeAction, config) => {
48
+ var _a, _b;
49
+ if (!writeAction) {
50
+ return null;
51
+ }
52
+ const writeObjects = (_b = (_a = config === null || config === void 0 ? void 0 : config.content) === null || _a === void 0 ? void 0 : _a.write) === null || _b === void 0 ? void 0 : _b.objects;
53
+ const fields = Object.keys(writeObjects || {});
54
+ const selectedWriteFields = {};
55
+ fields.forEach((field) => { selectedWriteFields[field] = true; });
56
+ const savedFields = Object.assign({}, selectedWriteFields);
57
+ return {
58
+ writeObjects: (writeAction === null || writeAction === void 0 ? void 0 : writeAction.objects) || [],
59
+ selectedNonConfigurableWriteFields: selectedWriteFields,
60
+ isWriteModified: false,
61
+ savedConfig: {
62
+ selectedNonConfigurableWriteFields: savedFields,
63
+ },
64
+ };
65
+ };
66
+ function generateConfigurationState(hydratedRevision, objectName, config) {
67
+ var _a, _b;
68
+ const readAction = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.read;
69
+ const writeAction = (_b = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _b === void 0 ? void 0 : _b.write;
70
+ return {
71
+ read: generateConfigurationStateRead(readAction, objectName, config),
72
+ write: generateConfigurationStateWrite(writeAction, config),
73
+ };
42
74
  }
43
75
  exports.generateConfigurationState = generateConfigurationState;
44
76
  // resets configure state for single object to hydrated revision values
45
77
  const setHydrateConfigState = (hydratedRevision, config, selectedObjectName, setConfigureState) => {
46
- var _a;
47
- const readAction = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.read;
48
- if (!readAction) {
49
- return;
50
- }
51
- const state = generateConfigurationState(readAction, selectedObjectName, config);
78
+ const state = generateConfigurationState(hydratedRevision, selectedObjectName, config);
52
79
  setConfigureState(selectedObjectName, state);
53
80
  };
54
81
  exports.setHydrateConfigState = setHydrateConfigState;
@@ -59,10 +86,8 @@ const resetAllObjectsConfigurationState = (hydratedRevision, config, setObjectCo
59
86
  const navObjects = (0, utils_1.generateNavObjects)(config, hydratedRevision);
60
87
  const objectConfigurationsState = {};
61
88
  navObjects.forEach(({ name, completed }) => {
62
- var _a;
63
- const readAction = (_a = hydratedRevision === null || hydratedRevision === void 0 ? void 0 : hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.read;
64
- if (completed && readAction) {
65
- objectConfigurationsState[name] = generateConfigurationState(readAction, name, config);
89
+ if (completed) {
90
+ objectConfigurationsState[name] = generateConfigurationState(hydratedRevision, name, config);
66
91
  }
67
92
  });
68
93
  setObjectConfiguresState(objectConfigurationsState);
@@ -74,7 +99,7 @@ exports.resetAllObjectsConfigurationState = resetAllObjectsConfigurationState;
74
99
  * @returns
75
100
  */
76
101
  const generateSelectedFieldsFromConfigureState = (configureState) => {
77
- const { requiredFields, selectedOptionalFields } = configureState;
102
+ const { requiredFields, selectedOptionalFields } = (configureState === null || configureState === void 0 ? void 0 : configureState.read) || {};
78
103
  const fields = new Set();
79
104
  requiredFields === null || requiredFields === void 0 ? void 0 : requiredFields.forEach((field) => fields.add((0, utils_1.getFieldKeyValue)(field)));
80
105
  // convert set to object for config
@@ -88,7 +113,7 @@ exports.generateSelectedFieldsFromConfigureState = generateSelectedFieldsFromCon
88
113
  * @returns
89
114
  */
90
115
  const generateSelectedFieldMappingsFromConfigureState = (configureState) => {
91
- const { selectedFieldMappings: selectedRequiredMapFields } = configureState;
116
+ const { selectedFieldMappings: selectedRequiredMapFields } = (configureState === null || configureState === void 0 ? void 0 : configureState.read) || {};
92
117
  // filter out undefined values of selectedRequiredMapFields
93
118
  const selectedRequiredMapFieldsSubmit = {};
94
119
  if (selectedRequiredMapFields) {
@@ -1,15 +1,23 @@
1
- import { HydratedIntegrationField, HydratedIntegrationFieldExistent, IntegrationFieldMapping } from '../../services/api';
1
+ import { HydratedIntegrationField, HydratedIntegrationFieldExistent, HydratedIntegrationWriteObject, IntegrationFieldMapping } from '../../services/api';
2
+ export type SelectedNonConfigurableWriteFields = {
3
+ [key: string]: boolean;
4
+ };
5
+ type SavedWriteConfigureState = {
6
+ selectedNonConfigurableWriteFields: SelectedNonConfigurableWriteFields;
7
+ };
8
+ export type ConfigureStateWrite = {
9
+ writeObjects: HydratedIntegrationWriteObject[] | null;
10
+ selectedNonConfigurableWriteFields: SelectedNonConfigurableWriteFields | null;
11
+ isWriteModified: boolean;
12
+ savedConfig: SavedWriteConfigureState;
13
+ };
2
14
  export type SelectOptionalFields = {
3
15
  [key: string]: boolean;
4
16
  };
5
17
  export type SelectMappingFields = {
6
18
  [key: string]: string | undefined;
7
19
  };
8
- type SavedConfigureState = {
9
- optionalFields: SelectOptionalFields;
10
- requiredMapFields: SelectMappingFields;
11
- };
12
- export type ConfigureState = {
20
+ export type ConfigureStateRead = {
13
21
  allFields: HydratedIntegrationFieldExistent[] | null;
14
22
  requiredFields: HydratedIntegrationField[] | null;
15
23
  optionalFields: HydratedIntegrationField[] | null;
@@ -20,6 +28,14 @@ export type ConfigureState = {
20
28
  isRequiredMapFieldsModified: boolean;
21
29
  savedConfig: SavedConfigureState;
22
30
  };
31
+ type SavedConfigureState = {
32
+ optionalFields: SelectOptionalFields;
33
+ requiredMapFields: SelectMappingFields;
34
+ };
35
+ export type ConfigureState = {
36
+ read: ConfigureStateRead | null;
37
+ write: ConfigureStateWrite | null;
38
+ };
23
39
  export type ObjectConfigurationsState = Record<string, ConfigureState>;
24
40
  export type NavObject = {
25
41
  name: string;
@@ -11,7 +11,7 @@ export declare function isIntegrationFieldMapping(field: HydratedIntegrationFiel
11
11
  /**
12
12
  *
13
13
  * @param action HydratedIntegrationAction
14
- * @param objectName string (account, contect, etc...)
14
+ * @param objectName string (account, contact, etc...)
15
15
  * @returns HydratedIntegrationObject | null
16
16
  */
17
17
  export declare function getStandardObjectFromAction(action: HydratedIntegrationRead, objectName: string): HydratedIntegrationObject | null;
@@ -20,7 +20,8 @@ export declare function getRequiredMapFieldsFromObject(object: HydratedIntegrati
20
20
  export declare function getOptionalFieldsFromObject(object: HydratedIntegrationObject): HydratedIntegrationField[] | null;
21
21
  export declare const getReadObject: (config: Config, objectName: string) => any;
22
22
  export declare function getFieldKeyValue(field: HydratedIntegrationField): string;
23
+ export declare const generateOtherNavObject: (config: Config | undefined) => NavObject;
23
24
  export declare function generateNavObjects(config: Config | undefined, hydratedRevision: HydratedRevision): NavObject[];
24
- export declare function validateFieldMappings(requiredMapFields: IntegrationFieldMapping[] | null, selectedRequiredMapFields: SelectMappingFields | null, setErrors: (boundary: ErrorBoundary, errors: string[]) => void): {
25
+ export declare function validateFieldMappings(requiredMapFields: IntegrationFieldMapping[] | null | undefined, selectedRequiredMapFields: SelectMappingFields | null | undefined, setErrors: (boundary: ErrorBoundary, errors: string[]) => void): {
25
26
  errorList: string[];
26
27
  };
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateFieldMappings = exports.generateNavObjects = exports.getFieldKeyValue = exports.getReadObject = exports.getOptionalFieldsFromObject = exports.getRequiredMapFieldsFromObject = exports.getRequiredFieldsFromObject = exports.getStandardObjectFromAction = exports.isIntegrationFieldMapping = void 0;
3
+ exports.validateFieldMappings = exports.generateNavObjects = exports.generateOtherNavObject = exports.getFieldKeyValue = exports.getReadObject = exports.getOptionalFieldsFromObject = exports.getRequiredMapFieldsFromObject = exports.getRequiredFieldsFromObject = exports.getStandardObjectFromAction = exports.isIntegrationFieldMapping = void 0;
4
4
  const ErrorContextProvider_1 = require("../../context/ErrorContextProvider");
5
+ const constant_1 = require("./nav/ObjectManagementNav/constant");
5
6
  /**
6
7
  * type guard for IntegrationFieldMapping | IntegrationFieldExistent
7
8
  *
@@ -16,7 +17,7 @@ exports.isIntegrationFieldMapping = isIntegrationFieldMapping;
16
17
  /**
17
18
  *
18
19
  * @param action HydratedIntegrationAction
19
- * @param objectName string (account, contect, etc...)
20
+ * @param objectName string (account, contact, etc...)
20
21
  * @returns HydratedIntegrationObject | null
21
22
  */
22
23
  function getStandardObjectFromAction(action, objectName) {
@@ -50,11 +51,16 @@ function getFieldKeyValue(field) {
50
51
  if (isIntegrationFieldMapping(field)) {
51
52
  return field.mapToName; // custom mapping
52
53
  }
53
- return field.fieldName; // existant field
54
+ return field.fieldName; // existent field
54
55
  }
55
56
  exports.getFieldKeyValue = getFieldKeyValue;
56
- // generates standard objects and whether they are complete based on config and hydrated revision
57
- function generateNavObjects(config, hydratedRevision) {
57
+ /**
58
+ * generates Nav Objects for read action
59
+ * @param config
60
+ * @param hydratedRevision
61
+ * @returns NavObject[]
62
+ */
63
+ const generateReadNavObjects = (config, hydratedRevision) => {
58
64
  var _a, _b, _c;
59
65
  const navObjects = [];
60
66
  (_c = (_b = (_a = hydratedRevision.content) === null || _a === void 0 ? void 0 : _a.read) === null || _b === void 0 ? void 0 : _b.standardObjects) === null || _c === void 0 ? void 0 : _c.forEach((object) => {
@@ -66,6 +72,20 @@ function generateNavObjects(config, hydratedRevision) {
66
72
  });
67
73
  });
68
74
  return navObjects;
75
+ };
76
+ const generateOtherNavObject = (config) => {
77
+ var _a;
78
+ const navObject = {
79
+ name: constant_1.OTHER_CONST,
80
+ completed: config ? !!((_a = config === null || config === void 0 ? void 0 : config.content) === null || _a === void 0 ? void 0 : _a.write) : false,
81
+ };
82
+ return navObject;
83
+ };
84
+ exports.generateOtherNavObject = generateOtherNavObject;
85
+ // generates standard objects and whether they are complete based on config and hydrated revision
86
+ function generateNavObjects(config, hydratedRevision) {
87
+ const navObjects = generateReadNavObjects(config, hydratedRevision);
88
+ return navObjects;
69
89
  }
70
90
  exports.generateNavObjects = generateNavObjects;
71
91
  // validates whether required fields are filled out or throws error
@@ -4,6 +4,8 @@ interface ConnectProviderProps {
4
4
  consumerName?: string;
5
5
  groupRef: string;
6
6
  groupName?: string;
7
+ redirectUrl?: string;
8
+ onSuccess?: (connectionID: string) => void;
7
9
  }
8
- export declare function ConnectProvider({ provider, consumerRef, consumerName, groupRef, groupName, }: ConnectProviderProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare function ConnectProvider({ provider, consumerRef, consumerName, groupRef, groupName, redirectUrl, onSuccess, }: ConnectProviderProps): import("react/jsx-runtime").JSX.Element;
9
11
  export {};
@@ -2,17 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ConnectProvider = 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
- const ConnectionsContext_1 = require("../../context/ConnectionsContext");
8
- const ProjectContext_1 = require("../../context/ProjectContext");
9
- const utils_1 = require("../../utils");
10
- const ProtectedConnectionLayout_1 = require("../Configure/ProtectedConnectionLayout");
11
- function ConnectedSuccessBox({ provider }) {
12
- const { appName } = (0, ProjectContext_1.useProject)();
13
- 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}.` })] }) }));
14
- }
15
- function ConnectProvider({ provider, consumerRef, consumerName, groupRef, groupName, }) {
16
- return ((0, jsx_runtime_1.jsx)(ConnectionsContext_1.ConnectionsProvider, { provider: provider, groupRef: groupRef, children: (0, jsx_runtime_1.jsx)(ProtectedConnectionLayout_1.ProtectedConnectionLayout, { provider: provider, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, children: (0, jsx_runtime_1.jsx)(ConnectedSuccessBox, { provider: provider }) }) }));
5
+ const ConnectionsContextProvider_1 = require("../../context/ConnectionsContextProvider");
6
+ const ProtectedConnectionLayout_1 = require("../Configure/layout/ProtectedConnectionLayout");
7
+ const RedirectHandler_1 = require("../RedirectHandler");
8
+ const ConnectedSuccessBox_1 = require("./ConnectedSuccessBox");
9
+ function ConnectProvider({ provider, consumerRef, consumerName, groupRef, groupName, redirectUrl, onSuccess, }) {
10
+ return ((0, jsx_runtime_1.jsx)(ConnectionsContextProvider_1.ConnectionsProvider, { provider: provider, groupRef: groupRef, children: (0, jsx_runtime_1.jsx)(ProtectedConnectionLayout_1.ProtectedConnectionLayout, { provider: provider, consumerRef: consumerRef, consumerName: consumerName, groupRef: groupRef, groupName: groupName, onSuccess: onSuccess, children: (0, jsx_runtime_1.jsx)(RedirectHandler_1.RedirectHandler, { redirectURL: redirectUrl, children: (0, jsx_runtime_1.jsx)(ConnectedSuccessBox_1.ConnectedSuccessBox, { provider: provider }) }) }) }));
17
11
  }
18
12
  exports.ConnectProvider = ConnectProvider;
@@ -0,0 +1,5 @@
1
+ interface ConnectedSuccessBoxProps {
2
+ provider: string;
3
+ }
4
+ export declare function ConnectedSuccessBox({ provider }: ConnectedSuccessBoxProps): import("react/jsx-runtime").JSX.Element;
5
+ export {};