@amp-labs/react 1.4.0 → 1.4.1

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.
@@ -52,7 +52,7 @@ function ObjectManagementNav({ children, }) {
52
52
  allNavObjects.push(otherNavObject);
53
53
  }
54
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) => {
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%", color: "gray.800", fontSize: "md", 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
56
  var _a, _b, _c, _d;
57
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
58
  || ((_d = (_c = objectConfigurationsState[object.name]) === null || _c === void 0 ? void 0 : _c.read) === null || _d === void 0 ? void 0 : _d.isRequiredMapFieldsModified) }, object.name));
@@ -6,6 +6,6 @@ const react_1 = require("@chakra-ui/react");
6
6
  function ErrorTextBox({ message }) {
7
7
  return ((0, jsx_runtime_1.jsxs)(react_1.Box, { minHeight: "300px", padding: "30px", display: "flex", flexDirection: "column", justifyContent: "space-evenly", alignItems: "center", children: [(0, jsx_runtime_1.jsxs)("svg", { width: "48", height: "48", viewBox: "0 0 48 48", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsx)("path", {
8
8
  // eslint-disable-next-line max-len
9
- d: "M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z", stroke: "#7F1D1D", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M24 18V26", stroke: "#7F1D1D", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M24 34H24.02", stroke: "#7F1D1D", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)(react_1.Box, { boxSizing: "border-box", display: "flex", justifyContent: "center", alignItems: "center", "align-self": "stretch", padding: "12px 50px 12px 50px", borderRadius: "8px", border: "2px solid #FECACA", background: "#FEF2F2", children: (0, jsx_runtime_1.jsx)(react_1.Text, { color: "#991B1B", children: message }) })] }));
9
+ d: "M20.5796 7.72236L3.63955 36.0024C3.29029 36.6072 3.10549 37.293 3.10353 37.9914C3.10158 38.6898 3.28254 39.3766 3.62841 39.9834C3.97428 40.5902 4.473 41.0959 5.07497 41.4501C5.67693 41.8043 6.36115 41.9947 7.05955 42.0024H40.9396C41.638 41.9947 42.3222 41.8043 42.9241 41.4501C43.5261 41.0959 44.0248 40.5902 44.3707 39.9834C44.7166 39.3766 44.8975 38.6898 44.8956 37.9914C44.8936 37.293 44.7088 36.6072 44.3596 36.0024L27.4196 7.72236C27.063 7.13458 26.561 6.6486 25.9619 6.31133C25.3629 5.97406 24.687 5.79688 23.9996 5.79688C23.3121 5.79688 22.6362 5.97406 22.0372 6.31133C21.4381 6.6486 20.9361 7.13458 20.5796 7.72236Z", stroke: "#7F1D1D", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M24 18V26", stroke: "#7F1D1D", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" }), (0, jsx_runtime_1.jsx)("path", { d: "M24 34H24.02", stroke: "#7F1D1D", strokeWidth: "4", strokeLinecap: "round", strokeLinejoin: "round" })] }), (0, jsx_runtime_1.jsx)(react_1.Box, { boxSizing: "border-box", display: "flex", justifyContent: "center", alignItems: "center", "align-self": "stretch", padding: "12px 50px 12px 50px", borderRadius: "8px", border: "2px solid #FECACA", background: "#FEF2F2", children: (0, jsx_runtime_1.jsx)(react_1.Text, { color: "#991B1B", fontSize: "md", children: message }) })] }));
10
10
  }
11
11
  exports.ErrorTextBox = ErrorTextBox;
@@ -28,15 +28,13 @@ function NoWorkspaceOauthFlow({ provider, consumerRef, consumerName, groupRef, g
28
28
  const handleSubmit = async () => {
29
29
  var _a;
30
30
  setError(null);
31
- if (consumerName && groupName && apiKey) {
32
- try {
33
- const url = await (0, fetchOAuthCallbackURL_1.fetchOAuthCallbackURL)(projectId, consumerRef, groupRef, consumerName, groupName, apiKey, provider);
34
- setOAuthCallbackURL(url);
35
- }
36
- catch (err) {
37
- console.error(err);
38
- setError((_a = err.message) !== null && _a !== void 0 ? _a : 'Unexpected error');
39
- }
31
+ try {
32
+ const url = await (0, fetchOAuthCallbackURL_1.fetchOAuthCallbackURL)(projectId, consumerRef, groupRef, apiKey, provider, undefined, consumerName, groupName);
33
+ setOAuthCallbackURL(url);
34
+ }
35
+ catch (err) {
36
+ console.error(err);
37
+ setError((_a = err.message) !== null && _a !== void 0 ? _a : 'Unexpected error');
40
38
  }
41
39
  };
42
40
  const onClose = (0, react_1.useCallback)((err) => {
@@ -4,6 +4,6 @@ exports.OauthCardLayout = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("@chakra-ui/react");
6
6
  function OauthCardLayout({ children }) {
7
- 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: children }) }));
7
+ 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", color: "gray.800", fontSize: "md", children: children }) }));
8
8
  }
9
9
  exports.OauthCardLayout = OauthCardLayout;
@@ -33,15 +33,13 @@ function WorkspaceOauthFlow({ provider, consumerRef, consumerName, groupRef, gro
33
33
  setError('Workspace is required');
34
34
  return;
35
35
  }
36
- if (consumerName && groupName && apiKey && workspace) {
37
- try {
38
- const url = await (0, fetchOAuthCallbackURL_1.fetchOAuthCallbackURL)(projectId, consumerRef, groupRef, consumerName, groupName, apiKey, provider, workspace);
39
- setOAuthCallbackURL(url);
40
- }
41
- catch (err) {
42
- console.error(err);
43
- setError((_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 'Unexpected error');
44
- }
36
+ try {
37
+ const url = await (0, fetchOAuthCallbackURL_1.fetchOAuthCallbackURL)(projectId, consumerRef, groupRef, apiKey, provider, workspace, consumerName, groupName);
38
+ setOAuthCallbackURL(url);
39
+ }
40
+ catch (err) {
41
+ console.error(err);
42
+ setError((_a = err === null || err === void 0 ? void 0 : err.message) !== null && _a !== void 0 ? _a : 'Unexpected error');
45
43
  }
46
44
  };
47
45
  const onClose = (0, react_1.useCallback)((err) => {
@@ -1 +1 @@
1
- export declare const fetchOAuthCallbackURL: (projectId: string, consumerRef: string, groupRef: string, consumerName: string, groupName: string, apiKey: string, provider: string, workspace?: string) => Promise<string>;
1
+ export declare const fetchOAuthCallbackURL: (projectId: string, consumerRef: string, groupRef: string, apiKey: string, provider: string, workspace?: string, consumerName?: string, groupName?: string) => Promise<string>;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchOAuthCallbackURL = void 0;
4
4
  const api_1 = require("../../services/api");
5
5
  const utils_1 = require("../../utils");
6
- const fetchOAuthCallbackURL = async (projectId, consumerRef, groupRef, consumerName, groupName, apiKey, provider, workspace) => {
6
+ const fetchOAuthCallbackURL = async (projectId, consumerRef, groupRef, apiKey, provider, workspace, consumerName, groupName) => {
7
7
  const providerApps = await (0, api_1.api)().providerAppApi.listProviderApps({ projectId }, {
8
8
  headers: { 'X-Api-Key': apiKey !== null && apiKey !== void 0 ? apiKey : '' },
9
9
  });
@@ -5,6 +5,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_1 = require("@chakra-ui/react");
6
6
  const SuccessIcon_1 = require("../assets/SuccessIcon");
7
7
  function SuccessTextBox({ text }) {
8
- return ((0, jsx_runtime_1.jsx)(react_1.Container, { children: (0, jsx_runtime_1.jsxs)(react_1.Box, { p: 8, maxWidth: "600px", minHeight: "290px", borderWidth: 1, borderRadius: 8, boxShadow: "lg", margin: "auto", marginTop: "40px", bgColor: "white", paddingTop: "100px", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { width: "100%", display: "flex", alignContent: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(react_1.Box, { margin: "auto", children: (0, jsx_runtime_1.jsx)(SuccessIcon_1.SuccessCheckmarkIcon, {}) }) }), (0, jsx_runtime_1.jsx)(react_1.Box, { textAlign: "center", paddingTop: "25px", children: text })] }) }));
8
+ return ((0, jsx_runtime_1.jsx)(react_1.Container, { children: (0, jsx_runtime_1.jsxs)(react_1.Box, { p: 8, maxWidth: "600px", minHeight: "290px", borderWidth: 1, borderRadius: 8, boxShadow: "lg", margin: "auto", marginTop: "40px", bgColor: "white", paddingTop: "100px", color: "gray.800", fontSize: "md", children: [(0, jsx_runtime_1.jsx)(react_1.Box, { width: "100%", display: "flex", alignContent: "center", justifyContent: "center", children: (0, jsx_runtime_1.jsx)(react_1.Box, { margin: "auto", children: (0, jsx_runtime_1.jsx)(SuccessIcon_1.SuccessCheckmarkIcon, {}) }) }), (0, jsx_runtime_1.jsx)(react_1.Box, { textAlign: "center", paddingTop: "25px", children: text })] }) }));
9
9
  }
10
10
  exports.SuccessTextBox = SuccessTextBox;
@@ -1 +1 @@
1
- export declare const LIB_VERSION = "1.4.0";
1
+ export declare const LIB_VERSION = "1.4.1";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.LIB_VERSION = void 0;
4
- exports.LIB_VERSION = '1.4.0';
4
+ exports.LIB_VERSION = '1.4.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amp-labs/react",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Ampersand React library.",
5
5
  "author": {
6
6
  "name": "Ampersand Labs",
@@ -57,7 +57,7 @@
57
57
  "eslint-config-airbnb-typescript": "^17.1.0",
58
58
  "eslint-plugin-import": "^2.29.0",
59
59
  "eslint-plugin-jsx-a11y": "^6.8.0",
60
- "eslint-plugin-n": "^16.2.0",
60
+ "eslint-plugin-n": "^17.2.0",
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",