@exdst-sitecore-content-sdk/astro 0.0.13 → 0.0.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exdst-sitecore-content-sdk/astro",
3
- "version": "0.0.13",
3
+ "version": "0.0.16",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts",
@@ -10,8 +10,8 @@
10
10
  "./utils": "./src/utils/index.ts",
11
11
  "./client": "./src/client/index.ts",
12
12
  "./config": "./src/config/index.ts",
13
- "./components/*": "./src/components/*",
14
- "./components/Placeholder": "./src/components/index.ts"
13
+ "./components/Placeholder": "./src/components/Placeholder/index.ts"
14
+
15
15
 
16
16
  },
17
17
  "files": [
@@ -22,42 +22,58 @@ export const getAstroFallbackConfig = (
22
22
  contextId: config?.api?.edge?.contextId || '',
23
23
  clientContextId:
24
24
  config?.api?.edge?.clientContextId ||
25
+ import.meta.env?.PUBLIC_SITECORE_EDGE_CONTEXT_ID ||
25
26
  process.env.PUBLIC_SITECORE_EDGE_CONTEXT_ID,
26
27
  edgeUrl:
27
- config?.api?.edge?.edgeUrl || process.env.PUBLIC_SITECORE_EDGE_URL,
28
+ config?.api?.edge?.edgeUrl ||
29
+ import.meta.env?.PUBLIC_SITECORE_EDGE_URL ||
30
+ process.env.PUBLIC_SITECORE_EDGE_URL,
28
31
  },
29
32
  local: {
30
33
  ...config?.api?.local,
31
34
  apiKey:
32
35
  config?.api?.local?.apiKey ||
36
+ import.meta.env?.PUBLIC_SITECORE_API_KEY ||
33
37
  process.env.PUBLIC_SITECORE_API_KEY ||
34
38
  '',
35
39
  apiHost:
36
40
  config?.api?.local?.apiHost ||
41
+ import.meta.env?.PUBLIC_SITECORE_API_HOST ||
37
42
  process.env.PUBLIC_SITECORE_API_HOST ||
38
43
  '',
39
44
  },
40
45
  },
41
46
  defaultSite:
42
- config?.defaultSite || process.env.PUBLIC_DEFAULT_SITE_NAME || '',
47
+ config?.defaultSite ||
48
+ import.meta.env?.PUBLIC_DEFAULT_SITE_NAME ||
49
+ process.env.PUBLIC_DEFAULT_SITE_NAME ||
50
+ '',
43
51
  defaultLanguage:
44
- config?.defaultLanguage || process.env.PUBLIC_DEFAULT_LANGUAGE || 'en',
52
+ config?.defaultLanguage ||
53
+ import.meta.env?.PUBLIC_DEFAULT_LANGUAGE ||
54
+ process.env.PUBLIC_DEFAULT_LANGUAGE ||
55
+ 'en',
45
56
  multisite: {
46
57
  ...config?.multisite,
47
58
  useCookieResolution:
48
59
  config?.multisite?.useCookieResolution ??
49
- (() => process.env.VERCEL_ENV === 'preview'),
60
+ (() => (import.meta.env?.VERCEL_ENV || process.env.VERCEL_ENV) === 'preview'),
50
61
  },
51
62
  personalize: {
52
63
  ...config?.personalize,
53
- scope: config?.personalize?.scope || process.env.PUBLIC_PERSONALIZE_SCOPE,
64
+ scope:
65
+ config?.personalize?.scope ||
66
+ import.meta.env?.PUBLIC_PERSONALIZE_SCOPE ||
67
+ process.env.PUBLIC_PERSONALIZE_SCOPE,
54
68
  },
55
69
  generateStaticPaths:
56
- process.env.GENERATE_STATIC_PATHS !== undefined
57
- ? process.env.GENERATE_STATIC_PATHS.toLowerCase() === 'true'
70
+ (import.meta.env?.GENERATE_STATIC_PATHS ?? process.env.GENERATE_STATIC_PATHS) !== undefined
71
+ ? (import.meta.env?.GENERATE_STATIC_PATHS || process.env.GENERATE_STATIC_PATHS).toLowerCase() === 'true'
58
72
  : config?.generateStaticPaths ?? true,
59
73
  sitecoreInternalEditingHostUrl:
60
- config?.sitecoreInternalEditingHostUrl || process.env.SITECORE_INTERNAL_EDITING_HOST_URL,
74
+ config?.sitecoreInternalEditingHostUrl ||
75
+ import.meta.env?.SITECORE_INTERNAL_EDITING_HOST_URL ||
76
+ process.env.SITECORE_INTERNAL_EDITING_HOST_URL,
61
77
  };
62
78
  };
63
79
 
@@ -257,18 +257,22 @@ export const isDesignLibraryPreviewData = (
257
257
  * @param {Request} req
258
258
  */
259
259
  export const resolveServerUrl = (req: Request) => {
260
- const internalHostUrl = process.env.SITECORE_INTERNAL_EDITING_HOST_URL;
260
+ const internalHostUrl =
261
+ import.meta.env?.SITECORE_INTERNAL_EDITING_HOST_URL ||
262
+ process.env.SITECORE_INTERNAL_EDITING_HOST_URL;
261
263
  if (internalHostUrl) {
262
264
  return internalHostUrl;
263
265
  }
264
266
 
265
267
  // in xmc deployment we always use localhost:3000
266
- if (process.env.SITECORE) {
268
+ if (import.meta.env?.SITECORE || process.env.SITECORE) {
267
269
  return 'http://localhost:3000';
268
270
  }
269
271
 
270
272
  // to preserve auth headers, use https if we're in our 3 main hosting options
271
- const useHttps = (process.env.VERCEL || process.env.NETLIFY) !== undefined;
273
+ const useHttps =
274
+ (import.meta.env?.VERCEL || process.env.VERCEL ||
275
+ import.meta.env?.NETLIFY || process.env.NETLIFY) !== undefined;
272
276
  // use https for requests with auth but also support unsecured http rendering hosts
273
277
  return `${useHttps ? 'https' : 'http'}://${req.headers.get('host') ?? undefined}`;
274
278
  };
@@ -1,5 +1,5 @@
1
1
  export const getEditingSecret = (): string => {
2
- const secret = process.env.SITECORE_EDITING_SECRET;
2
+ const secret = import.meta.env?.SITECORE_EDITING_SECRET || process.env.SITECORE_EDITING_SECRET;
3
3
 
4
4
  if (!secret || secret.length === 0) {
5
5
  throw new Error('The SITECORE_EDITING_SECRET environment variable is missing or invalid.');