@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.
@@ -9,8 +9,9 @@ export type EmbeddableConfig = {
9
9
  audienceUrl?: string;
10
10
  authDomain?: string;
11
11
  authClientId?: string;
12
+ errorFallbackComponent?: string;
12
13
  };
13
- declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, }: EmbeddableConfig) => {
14
+ declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, }: EmbeddableConfig) => {
14
15
  core: {
15
16
  rootDir: string;
16
17
  templatesDir: string;
@@ -24,6 +25,7 @@ declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authCl
24
25
  componentDir: string;
25
26
  stencilBuild: string;
26
27
  archiveFile: string;
28
+ errorFallbackComponent: string | undefined;
27
29
  };
28
30
  outputOptions: {
29
31
  typesEntryPointFilename: string;
package/lib/index.esm.js CHANGED
@@ -4655,7 +4655,7 @@ async function selectWorkspace(ctx, token) {
4655
4655
  color: "green",
4656
4656
  discardStdin: false,
4657
4657
  }).start();
4658
- const availableWorkspaces = await getWorkspaces(ctx, token);
4658
+ const availableWorkspaces = await getWorkspaces(ctx, token, workspaceSpinner);
4659
4659
  let selectedWorkspace;
4660
4660
  if (availableWorkspaces.length === 0) {
4661
4661
  workspaceSpinner.fail("No workspaces found");
@@ -4725,23 +4725,27 @@ async function sendBuild(ctx, { workspaceId, token }) {
4725
4725
  });
4726
4726
  await fs.rm(ctx.client.archiveFile);
4727
4727
  }
4728
- async function getWorkspaces(ctx, token) {
4728
+ async function getWorkspaces(ctx, token, workspaceSpinner) {
4729
4729
  try {
4730
- return axios
4731
- .get(`${ctx.pushBaseUrl}/workspace`, {
4730
+ const response = await axios.get(`${ctx.pushBaseUrl}/workspace`, {
4732
4731
  headers: {
4733
4732
  Authorization: `Bearer ${token}`,
4734
4733
  },
4735
- })
4736
- .then((res) => res.data);
4734
+ });
4735
+ return response.data;
4737
4736
  }
4738
4737
  catch (e) {
4739
- console.error(e);
4740
- return [];
4738
+ if (e.response.status === 401) {
4739
+ workspaceSpinner.fail("Invalid token. Please login again.");
4740
+ }
4741
+ else {
4742
+ workspaceSpinner.fail("Failed to fetch workspaces");
4743
+ }
4744
+ process.exit(1);
4741
4745
  }
4742
4746
  }
4743
4747
 
4744
- var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, }) => {
4748
+ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, }) => {
4745
4749
  const coreRoot = path.resolve(__dirname, "..");
4746
4750
  const clientRoot = process.cwd();
4747
4751
  return {
@@ -4758,6 +4762,9 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
4758
4762
  componentDir: path.resolve(clientRoot, ".embeddable-build", "component"),
4759
4763
  stencilBuild: path.resolve(clientRoot, ".embeddable-build", "dist", "embeddable-wrapper"),
4760
4764
  archiveFile: path.resolve(clientRoot, "embeddable-build.zip"),
4765
+ errorFallbackComponent: errorFallbackComponent
4766
+ ? path.resolve(clientRoot, errorFallbackComponent)
4767
+ : undefined,
4761
4768
  },
4762
4769
  outputOptions: {
4763
4770
  typesEntryPointFilename: "embeddable-types-entry-point.js",