@financial-times/custom-code-component 0.0.8 → 0.0.9

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.
@@ -12,15 +12,12 @@ class u extends HTMLElement {
12
12
  }
13
13
  async connectedCallback() {
14
14
  var a;
15
- const o = this.getAttribute("path"), n = this.hasAttribute("shadow-open") ? "open" : "closed", s = this.getAttribute("version"), m = (a = this.getAttribute("env")) == null ? void 0 : a.toLowerCase().startsWith("d");
16
- if (!o)
15
+ const n = this.getAttribute("path"), s = this.hasAttribute("shadow-open") ? "open" : "closed", c = this.getAttribute("version"), m = (a = this.getAttribute("env")) == null ? void 0 : a.toLowerCase().startsWith("d");
16
+ if (!n)
17
17
  throw new Error(
18
18
  "path attribute not specified in <custom-code-component>"
19
19
  );
20
- const [c, p, h] = o.split("/").reverse(), d = m ? `http://localhost:5173/src/${c}/index.jsx` : (
21
- // @TODO create component service -- this URL may change!!!
22
- `https://www.ft.com/__component/${h}/${p}/${c}${s ? `@${s}` : "@latest"}`
23
- );
20
+ const [o, p, h] = n.split("/").reverse(), d = m ? `http://localhost:5173/src/${o}/index.jsx` : `https://www.ft.com/__component/${h}/${p}/${o}${c ? `@${c}` : "@latest"}/${o}.js`;
24
21
  try {
25
22
  const e = await import(
26
23
  /* webpackIgnore: true */
@@ -37,9 +34,9 @@ class u extends HTMLElement {
37
34
  { ...r, data: i },
38
35
  ...this.children
39
36
  );
40
- }), this.attachShadow({ mode: n }).append(t);
37
+ }), this.attachShadow({ mode: s }).append(t);
41
38
  } else {
42
- const t = this.attachShadow({ mode: n });
39
+ const t = this.attachShadow({ mode: s });
43
40
  e.default(t, { ...r, data: i }, ...this.children);
44
41
  }
45
42
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/custom-code-component",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -35,10 +35,9 @@ class FTCustomCodeComponent extends HTMLElement {
35
35
 
36
36
  const source = useLocalVersion
37
37
  ? `http://localhost:5173/src/${componentName}/index.jsx`
38
- : // @TODO create component service -- this URL may change!!!
39
- `https://www.ft.com/__component/${componentOrg}/${componentRepo}/${componentName}${
38
+ : `https://www.ft.com/__component/${componentOrg}/${componentRepo}/${componentName}${
40
39
  componentVersionRange ? `@${componentVersionRange}` : "@latest"
41
- }`;
40
+ }/${componentName}.js`;
42
41
  try {
43
42
  const App = await import(
44
43
  /* webpackIgnore: true */ source /* @vite-ignore */