@duffcloudservices/cms 0.13.4 → 0.13.5

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.
@@ -697,17 +697,23 @@ declare function dcsMotionTokensStyleTag(): HtmlTagDescriptor;
697
697
  * this network-touching loader stays out of the dev server.
698
698
  */
699
699
 
700
- /** DCS API origin the loader calls (matches the cms runtime composables). */
701
- declare const DEFAULT_AGENT_API_BASE_URL = "https://portal.duffcloudservices.com";
700
+ /**
701
+ * DCS API origin the loader calls when the build passes none (dcsContentPlugin
702
+ * feeds `process.env.VITE_API_BASE_URL` first). The value lives in this
703
+ * package's `package.json` `config` block (C-1062: no production URL as a source
704
+ * literal); the exported name is unchanged for consumers.
705
+ */
706
+ declare const DEFAULT_AGENT_API_BASE_URL: string;
702
707
  /**
703
708
  * Versioned CDN URL of the widget bundle. Both `cdn.` (branding CDN, CorsAllowAll)
704
709
  * and the already-live `files.` route serve the same `sgdcs` blob origin with an
705
710
  * identical `/agent-widget/v1/...` layout, so this is a plain classic-script
706
711
  * include that needs no CORS on the bundle host. Defaults to `files.` because the
707
712
  * `cdn.` Front Door route is still provisioning-gated (enableCdnDomain=false) —
708
- * flip the default only after that domain is live, or pass cdnScriptUrl.
713
+ * flip the default only after that domain is live, or pass cdnScriptUrl. The
714
+ * value lives in `package.json` `config.agentWidgetScriptUrl` (C-1062).
709
715
  */
710
- declare const DEFAULT_AGENT_WIDGET_SCRIPT_URL = "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js";
716
+ declare const DEFAULT_AGENT_WIDGET_SCRIPT_URL: string;
711
717
  interface DcsAgentWidgetLoaderOptions {
712
718
  /** Owning site slug — baked into the loader so it can build the config URL. */
713
719
  siteSlug: string;
@@ -5,6 +5,7 @@ import path5 from 'path';
5
5
  import yaml4 from 'js-yaml';
6
6
  import http from 'http';
7
7
  import { defineComponent, h } from 'vue';
8
+ import { isVectorImageUrl } from '@duffcloudservices/cms-core';
8
9
 
9
10
  function dcsSearchPaths(projectRoot, relPath) {
10
11
  return [
@@ -68,8 +69,16 @@ function dcsMotionTokensStyleTag() {
68
69
  injectTo: "head"
69
70
  };
70
71
  }
71
- var DEFAULT_AGENT_API_BASE_URL = "https://portal.duffcloudservices.com";
72
- var DEFAULT_AGENT_WIDGET_SCRIPT_URL = "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js";
72
+
73
+ // package.json
74
+ var config = {
75
+ agentApiBaseUrl: "https://portal.duffcloudservices.com",
76
+ agentWidgetScriptUrl: "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js"
77
+ };
78
+
79
+ // src/plugins/agentWidget.ts
80
+ var DEFAULT_AGENT_API_BASE_URL = config.agentApiBaseUrl;
81
+ var DEFAULT_AGENT_WIDGET_SCRIPT_URL = config.agentWidgetScriptUrl;
73
82
  var trimTrailingSlash = (value) => value.replace(/\/+$/, "");
74
83
  var encodeForInlineScript = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
75
84
  function buildAgentWidgetLoaderScript(options) {
@@ -118,11 +127,11 @@ function dcsContentPlugin(options = {}) {
118
127
  let isDev = false;
119
128
  return {
120
129
  name: "dcs-content",
121
- configResolved(config) {
122
- resolvedConfig = config;
123
- isDev = config.command === "serve";
130
+ configResolved(config2) {
131
+ resolvedConfig = config2;
132
+ isDev = config2.command === "serve";
124
133
  },
125
- config(config, env) {
134
+ config(config2, env) {
126
135
  if (env.command === "serve") {
127
136
  return {
128
137
  define: {
@@ -131,7 +140,7 @@ function dcsContentPlugin(options = {}) {
131
140
  ssr: { noExternal: DCS_SSR_NO_EXTERNAL }
132
141
  };
133
142
  }
134
- const projectRoot = config.root || process.cwd();
143
+ const projectRoot = config2.root || process.cwd();
135
144
  const possiblePaths = [
136
145
  path5.resolve(projectRoot, contentPath),
137
146
  path5.resolve(projectRoot, "..", contentPath),
@@ -486,9 +495,9 @@ function readHonestyBlock(value) {
486
495
  network: value.network
487
496
  };
488
497
  }
489
- function resolveOutDir(config) {
490
- const out = config.build?.outDir || "dist";
491
- return path5.isAbsolute(out) ? out : path5.resolve(config.root || process.cwd(), out);
498
+ function resolveOutDir(config2) {
499
+ const out = config2.build?.outDir || "dist";
500
+ return path5.isAbsolute(out) ? out : path5.resolve(config2.root || process.cwd(), out);
492
501
  }
493
502
  function loadSeoConfig(projectRoot, seoPath, debug) {
494
503
  const possiblePaths = [
@@ -513,8 +522,8 @@ function loadSeoConfig(projectRoot, seoPath, debug) {
513
522
  }
514
523
  try {
515
524
  const fileContent = fs5.readFileSync(foundPath, "utf8");
516
- const config = yaml4.load(fileContent);
517
- return { config, foundPath };
525
+ const config2 = yaml4.load(fileContent);
526
+ return { config: config2, foundPath };
518
527
  } catch (error) {
519
528
  console.warn("[dcs-seo] Failed to parse seo.yaml:", error);
520
529
  return null;
@@ -969,11 +978,11 @@ function dcsSeoPlugin(options = {}) {
969
978
  let isDev = false;
970
979
  return {
971
980
  name: "dcs-seo",
972
- configResolved(config) {
973
- resolvedConfig = config;
974
- isDev = config.command === "serve";
981
+ configResolved(config2) {
982
+ resolvedConfig = config2;
983
+ isDev = config2.command === "serve";
975
984
  },
976
- config(config, env) {
985
+ config(config2, env) {
977
986
  if (env.command === "serve") {
978
987
  return {
979
988
  define: {
@@ -982,7 +991,7 @@ function dcsSeoPlugin(options = {}) {
982
991
  }
983
992
  };
984
993
  }
985
- const projectRoot = config.root || process.cwd();
994
+ const projectRoot = config2.root || process.cwd();
986
995
  const pagesDefine = (() => {
987
996
  const routes = loadPagesManifest(projectRoot, pagesPath, debug);
988
997
  if (!routes) {
@@ -1340,14 +1349,14 @@ function dcsSeoPlugin(options = {}) {
1340
1349
  if (!isDev) return html;
1341
1350
  const projectRoot = resolvedConfig?.root || process.cwd();
1342
1351
  const tags = [];
1343
- const config = readDcsYamlFresh(projectRoot, seoPath, "dcs-seo", debug);
1344
- if (config !== void 0) {
1352
+ const config2 = readDcsYamlFresh(projectRoot, seoPath, "dcs-seo", debug);
1353
+ if (config2 !== void 0) {
1345
1354
  if (debug) {
1346
1355
  console.log("[dcs-seo] serve: injecting fresh __DCS_SEO__ into <head>");
1347
1356
  }
1348
1357
  tags.push({
1349
1358
  tag: "script",
1350
- children: buildGlobalAssignScript("__DCS_SEO__", config),
1359
+ children: buildGlobalAssignScript("__DCS_SEO__", config2),
1351
1360
  injectTo: "head-prepend"
1352
1361
  });
1353
1362
  }
@@ -1439,9 +1448,9 @@ function dcsEditorPlugin(options = {}) {
1439
1448
  return { server: { hmr: false } };
1440
1449
  }
1441
1450
  },
1442
- configResolved(config) {
1443
- isDev = config.command === "serve";
1444
- basePath = config.base ?? "/";
1451
+ configResolved(config2) {
1452
+ isDev = config2.command === "serve";
1453
+ basePath = config2.base ?? "/";
1445
1454
  isPreview = process.env.DCS_PREVIEW === "true";
1446
1455
  },
1447
1456
  resolveId(id) {
@@ -1646,7 +1655,7 @@ function dcsCdnImagePlugin(options = {}) {
1646
1655
  const extraAttrs = otherAttrs ? " " + otherAttrs : "";
1647
1656
  const sizesMatch = (beforeSrc + afterSrc).match(/data-sizes=["']([^"']*)["']/);
1648
1657
  const sizes = sizesMatch ? sizesMatch[1] : defaultSizes;
1649
- if (!entry.variants || entry.variants.length === 0) {
1658
+ if (!entry.variants || entry.variants.length === 0 || isVectorImageUrl(entry.cdnUrl)) {
1650
1659
  return `<img src="${escapeHtml(entry.cdnUrl)}" alt="${escapeHtml(alt)}"${extraAttrs}${dimensionAttrs(entry)} loading="lazy" decoding="async" />`;
1651
1660
  }
1652
1661
  return buildPictureElement(entry, alt, extraAttrs, sizes);
@@ -1657,15 +1666,15 @@ function dcsCdnImagePlugin(options = {}) {
1657
1666
  return {
1658
1667
  name: "dcs-cdn-image",
1659
1668
  enforce: "pre",
1660
- configResolved(config) {
1661
- isProduction = config.command === "build";
1669
+ configResolved(config2) {
1670
+ isProduction = config2.command === "build";
1662
1671
  if (!isProduction) {
1663
1672
  if (debug) {
1664
1673
  console.log("[dcs-cdn-image] Dev mode \u2014 plugin disabled (local images served by Vite)");
1665
1674
  }
1666
1675
  return;
1667
1676
  }
1668
- imageMap = loadCdnImageMap(config.root, mapPath, debug);
1677
+ imageMap = loadCdnImageMap(config2.root, mapPath, debug);
1669
1678
  },
1670
1679
  transform(code, id) {
1671
1680
  if (!isProduction || !imageMap) return;
@@ -1804,8 +1813,6 @@ function dcsCdnBuildEnd(options = {}) {
1804
1813
  }
1805
1814
  };
1806
1815
  }
1807
-
1808
- // src/plugins/responsiveImagePlugin.ts
1809
1816
  var CDN_PATTERN = /^(https?:\/\/files\.[^/]+\/(?:content\/)?[^/]+\/assets\/(?:[^/]+\/)*)([a-f0-9-]+)\.(\w+)$/;
1810
1817
  function escapeHtml2(str) {
1811
1818
  return str.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -1817,7 +1824,7 @@ function responsiveImagePlugin(md) {
1817
1824
  const src = token.attrGet("src") ?? "";
1818
1825
  const alt = token.content ?? "";
1819
1826
  const match = src.match(CDN_PATTERN);
1820
- if (!match) {
1827
+ if (!match || isVectorImageUrl(src)) {
1821
1828
  if (defaultImageRenderer) {
1822
1829
  return defaultImageRenderer(tokens, idx, options, env, self);
1823
1830
  }