@embeddable.com/sdk-core 2.4.4 → 2.4.6

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.
package/lib/index.js CHANGED
@@ -4680,7 +4680,7 @@ async function selectWorkspace(ctx, token) {
4680
4680
  color: "green",
4681
4681
  discardStdin: false,
4682
4682
  }).start();
4683
- const availableWorkspaces = await getWorkspaces(ctx, token);
4683
+ const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
4684
4684
  let selectedWorkspace;
4685
4685
  if (availableWorkspaces.length === 0) {
4686
4686
  workspaceSpinner.fail("No workspaces found");
@@ -4750,23 +4750,27 @@ async function sendBuild(ctx, { workspaceId, token }) {
4750
4750
  });
4751
4751
  await fs__namespace.rm(ctx.client.archiveFile);
4752
4752
  }
4753
- async function getWorkspaces(ctx, token) {
4753
+ async function getWorkspaces(ctx, token, workspaceSpinner) {
4754
4754
  try {
4755
- return axios
4756
- .get(`${ctx.pushBaseUrl}/workspace`, {
4755
+ const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
4757
4756
  headers: {
4758
4757
  Authorization: `Bearer ${token}`,
4759
4758
  },
4760
- })
4761
- .then((res) => res.data);
4759
+ });
4760
+ return response.data;
4762
4761
  }
4763
4762
  catch (e) {
4764
- console.error(e);
4765
- return [];
4763
+ if (e.response.status === 401) {
4764
+ workspaceSpinner.fail("Invalid token. Please login again.");
4765
+ }
4766
+ else {
4767
+ workspaceSpinner.fail("Failed to fetch workspaces");
4768
+ }
4769
+ process.exit(1);
4766
4770
  }
4767
4771
  }
4768
4772
 
4769
- var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, }) => {
4773
+ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, }) => {
4770
4774
  const coreRoot = path__namespace.resolve(__dirname, "..");
4771
4775
  const clientRoot = process.cwd();
4772
4776
  return {
@@ -4783,6 +4787,9 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
4783
4787
  componentDir: path__namespace.resolve(clientRoot, ".embeddable-build", "component"),
4784
4788
  stencilBuild: path__namespace.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),
4785
4789
  archiveFile: path__namespace.resolve(clientRoot, "embeddable-build.zip"),
4790
+ errorFallbackComponent: errorFallbackComponent
4791
+ ? path__namespace.resolve(clientRoot, errorFallbackComponent)
4792
+ : undefined,
4786
4793
  },
4787
4794
  outputOptions: {
4788
4795
  typesEntryPointFilename: "embeddable-types-entry-point.js",