@embeddable.com/sdk-core 3.12.1 → 3.12.3

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.
@@ -1,4 +1,5 @@
1
1
  import { RollupOptions } from "rollup";
2
+ export type Region = "EU" | "US" | "legacy-US";
2
3
  export type EmbeddableConfig = {
3
4
  plugins: (() => {
4
5
  pluginName: string;
@@ -24,8 +25,9 @@ export type EmbeddableConfig = {
24
25
  };
25
26
  };
26
27
  rollupOptions?: RollupOptions;
28
+ region?: Region;
27
29
  };
28
- declare const _default: ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, presetsSrc, componentsSrc, globalCss, viteConfig, rollupOptions, }: EmbeddableConfig) => {
30
+ declare const _default: ({ plugins, region, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc, presetsSrc, componentsSrc, globalCss, viteConfig, rollupOptions, }: EmbeddableConfig) => {
29
31
  core: {
30
32
  rootDir: string;
31
33
  templatesDir: string;
package/lib/index.esm.js CHANGED
@@ -28,6 +28,7 @@ import * as http from 'node:http';
28
28
  import { WebSocketServer } from 'ws';
29
29
  import * as chokidar from 'chokidar';
30
30
  import fg from 'fast-glob';
31
+ import * as dotenv from 'dotenv';
31
32
  import { stat } from 'fs/promises';
32
33
 
33
34
  var findFiles = async (initialSrcDir, regex) => {
@@ -21665,6 +21666,7 @@ async function uploadFile(formData, url, token) {
21665
21666
  }
21666
21667
 
21667
21668
  const minimist = require("minimist");
21669
+ dotenv.config();
21668
21670
  const oraP = import('ora');
21669
21671
  let wss;
21670
21672
  let changedFiles = [];
@@ -21916,8 +21918,6 @@ const onClose = async (server, sys, watchers, config) => {
21916
21918
  process.exit(0);
21917
21919
  };
21918
21920
  const getPreviewWorkspace = async (startedOra, ctx) => {
21919
- // login and retry
21920
- await login();
21921
21921
  const token = await getToken();
21922
21922
  const params = minimist(process.argv.slice(2));
21923
21923
  let primaryWorkspace = params.w || params.workspace;
@@ -21928,8 +21928,12 @@ const getPreviewWorkspace = async (startedOra, ctx) => {
21928
21928
  startedOra.start();
21929
21929
  }
21930
21930
  try {
21931
+ const instanceUrl = process.env.CUBE_CLOUD_ENDPOINT;
21931
21932
  const response = await axios.get(`${ctx.pushBaseUrl}/workspace/dev-workspace`, {
21932
- params: { primaryWorkspace },
21933
+ params: {
21934
+ primaryWorkspace,
21935
+ instanceUrl,
21936
+ },
21933
21937
  headers: {
21934
21938
  Authorization: `Bearer ${token}`,
21935
21939
  },
@@ -21948,7 +21952,34 @@ const getPreviewWorkspace = async (startedOra, ctx) => {
21948
21952
  }
21949
21953
  };
21950
21954
 
21951
- var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", presetsSrc = "src", componentsSrc = "src", globalCss = "src/global.css", viteConfig = {}, rollupOptions = {}, }) => {
21955
+ const REGION_CONFIGS = {
21956
+ EU: {
21957
+ pushBaseUrl: "https://api.eu.embeddable.com",
21958
+ audienceUrl: "https://auth.eu.embeddable.com",
21959
+ previewBaseUrl: "https://app.eu.embeddable.com",
21960
+ authDomain: "auth.eu.embeddable.com",
21961
+ authClientId: "6OGPwIQsVmtrBKhNrwAaXh4ePb0kBGV",
21962
+ },
21963
+ US: {
21964
+ pushBaseUrl: "https://api.us.embeddable.com",
21965
+ audienceUrl: "https://auth.embeddable.com",
21966
+ previewBaseUrl: "https://app.us.embeddable.com",
21967
+ authDomain: "auth.embeddable.com",
21968
+ authClientId: "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
21969
+ },
21970
+ "legacy-US": {
21971
+ pushBaseUrl: "https://api.embeddable.com",
21972
+ audienceUrl: "https://auth.embeddable.com",
21973
+ previewBaseUrl: "https://app.embeddable.com",
21974
+ authDomain: "auth.embeddable.com",
21975
+ authClientId: "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
21976
+ },
21977
+ };
21978
+ var defineConfig = ({ plugins, region = "legacy-US", pushBaseUrl, audienceUrl, authDomain, authClientId, errorFallbackComponent, applicationEnvironment, rollbarAccessToken, previewBaseUrl, modelsSrc = "src", presetsSrc = "src", componentsSrc = "src", globalCss = "src/global.css", viteConfig = {}, rollupOptions = {}, }) => {
21979
+ if (region && !REGION_CONFIGS[region]) {
21980
+ throw new Error(`Unsupported region: ${region}. Supported regions are: EU, US, legacy-US`);
21981
+ }
21982
+ const regionConfig = REGION_CONFIGS[region];
21952
21983
  const coreRoot = path.resolve(__dirname, "..");
21953
21984
  const clientRoot = process.cwd();
21954
21985
  if (!path.isAbsolute(componentsSrc)) {
@@ -21996,11 +22027,11 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
21996
22027
  outputOptions: {
21997
22028
  typesEntryPointFilename: "embeddable-types-entry-point.js",
21998
22029
  },
21999
- pushBaseUrl: pushBaseUrl !== null && pushBaseUrl !== void 0 ? pushBaseUrl : "https://api.embeddable.com",
22000
- audienceUrl: audienceUrl !== null && audienceUrl !== void 0 ? audienceUrl : "https://auth.embeddable.com",
22001
- previewBaseUrl: previewBaseUrl !== null && previewBaseUrl !== void 0 ? previewBaseUrl : "https://app.embeddable.com",
22002
- authDomain: authDomain !== null && authDomain !== void 0 ? authDomain : "auth.embeddable.com",
22003
- authClientId: authClientId !== null && authClientId !== void 0 ? authClientId : "dygrSUmI6HmgY5ymVbEAoLDEBxIOyr1V",
22030
+ pushBaseUrl: pushBaseUrl !== null && pushBaseUrl !== void 0 ? pushBaseUrl : regionConfig.pushBaseUrl,
22031
+ audienceUrl: audienceUrl !== null && audienceUrl !== void 0 ? audienceUrl : regionConfig.audienceUrl,
22032
+ previewBaseUrl: previewBaseUrl !== null && previewBaseUrl !== void 0 ? previewBaseUrl : regionConfig.previewBaseUrl,
22033
+ authDomain: authDomain !== null && authDomain !== void 0 ? authDomain : regionConfig.authDomain,
22034
+ authClientId: authClientId !== null && authClientId !== void 0 ? authClientId : regionConfig.authClientId,
22004
22035
  applicationEnvironment: applicationEnvironment !== null && applicationEnvironment !== void 0 ? applicationEnvironment : "production",
22005
22036
  rollbarAccessToken: rollbarAccessToken !== null && rollbarAccessToken !== void 0 ? rollbarAccessToken : "5c6028038d844bf1835a0f4db5f55d9e",
22006
22037
  plugins,
@@ -22008,7 +22039,7 @@ var defineConfig = ({ plugins, pushBaseUrl, audienceUrl, authDomain, authClientI
22008
22039
  };
22009
22040
 
22010
22041
  var name = "@embeddable.com/sdk-core";
22011
- var version = "3.12.0-next.2";
22042
+ var version = "3.12.2";
22012
22043
  var description = "Core Embeddable SDK module responsible for web-components bundling and publishing.";
22013
22044
  var keywords = [
22014
22045
  "embeddable",
@@ -22046,13 +22077,14 @@ var engines = {
22046
22077
  };
22047
22078
  var license = "MIT";
22048
22079
  var dependencies = {
22049
- "@embeddable.com/sdk-utils": "0.6.0-next.0",
22050
- "@inquirer/prompts": "^7.1.0",
22051
- "@stencil/core": "^4.22.3",
22080
+ "@embeddable.com/sdk-utils": "0.6.1",
22081
+ "@inquirer/prompts": "^7.2.1",
22082
+ "@stencil/core": "^4.23.0",
22052
22083
  "@swc-node/register": "^1.10.9",
22053
22084
  archiver: "^5.3.2",
22054
- axios: "^1.7.8",
22055
- chokidar: "^4.0.1",
22085
+ axios: "^1.7.9",
22086
+ chokidar: "^4.0.3",
22087
+ dotenv: "^16.4.7",
22056
22088
  "fast-glob": "^3.3.2",
22057
22089
  finalhandler: "^1.3.1",
22058
22090
  "formdata-node": "^6.0.3",