@lumiastream/ui 0.2.8-alpha.15 → 0.2.8-alpha.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/dist/index.js CHANGED
@@ -7228,6 +7228,13 @@ function SEImportWizard({
7228
7228
  });
7229
7229
  return;
7230
7230
  }
7231
+ if (!parts.apikey) {
7232
+ setLoadError({
7233
+ message: "That looks like an editor URL, which doesn't include an access token.",
7234
+ hint: `Use the public preview URL (Overlay menu \u2192 Get URL \u2192 Public link). Overlay id: ${parts.overlayId}`
7235
+ });
7236
+ return;
7237
+ }
7231
7238
  setLoading(true);
7232
7239
  try {
7233
7240
  const bootstrap = await fetchSEBootstrap(parts);
@@ -7897,14 +7904,20 @@ function extractSEOverlayId(input) {
7897
7904
  }
7898
7905
  function extractSEPreviewParts(input) {
7899
7906
  const trimmed = input.trim();
7900
- const m = trimmed.match(/streamelements\.com\/overlay\/([0-9a-f]{24})\/([A-Za-z0-9_-]+)/i);
7907
+ const m = trimmed.match(/streamelements\.com\/overlay\/([0-9a-f]{24})(?:\/([A-Za-z0-9_-]+))?/i);
7901
7908
  if (!m) return null;
7902
- return { overlayId: m[1], apikey: m[2] };
7909
+ const overlayId = m[1];
7910
+ const second = m[2];
7911
+ const apikey = second && second.toLowerCase() !== "editor" ? second : null;
7912
+ return { overlayId, apikey };
7903
7913
  }
7904
7914
  function buildBootstrapUrl(overlayId) {
7905
7915
  return `https://api.streamelements.com/kappa/v2/overlays/${overlayId}/bootstrap?isEditor=false&isMobile=false&isObs=false&isObsLive=false&isXsplit=false`;
7906
7916
  }
7907
7917
  async function fetchSEBootstrap({ overlayId, apikey }) {
7918
+ if (!apikey) {
7919
+ throw new Error("Missing access token. Use the public preview URL (Overlay menu \u2192 Get URL \u2192 Public link) \u2014 editor URLs do not include a token.");
7920
+ }
7908
7921
  const res = await fetch(buildBootstrapUrl(overlayId), {
7909
7922
  method: "GET",
7910
7923
  headers: { Accept: "application/json", Authorization: `apikey ${apikey}` }
@@ -369,12 +369,12 @@ interface ImportResult {
369
369
  declare function extractSEOverlayId(input: string): string | null;
370
370
  declare function extractSEPreviewParts(input: string): {
371
371
  overlayId: string;
372
- apikey: string;
372
+ apikey: string | null;
373
373
  } | null;
374
374
  declare function buildBootstrapUrl(overlayId: string): string;
375
375
  declare function fetchSEBootstrap({ overlayId, apikey }: {
376
376
  overlayId: string;
377
- apikey: string;
377
+ apikey: string | null;
378
378
  }): Promise<SEBootstrapResponse>;
379
379
  declare function isSEBootstrap(value: unknown): value is SEBootstrapResponse;
380
380
  declare function importSEBootstrap(bootstrap: SEBootstrapResponse): ImportResult;
package/dist/se-import.js CHANGED
@@ -6098,6 +6098,13 @@ function SEImportWizard({
6098
6098
  });
6099
6099
  return;
6100
6100
  }
6101
+ if (!parts.apikey) {
6102
+ setLoadError({
6103
+ message: "That looks like an editor URL, which doesn't include an access token.",
6104
+ hint: `Use the public preview URL (Overlay menu \u2192 Get URL \u2192 Public link). Overlay id: ${parts.overlayId}`
6105
+ });
6106
+ return;
6107
+ }
6101
6108
  setLoading(true);
6102
6109
  try {
6103
6110
  const bootstrap = await fetchSEBootstrap(parts);
@@ -6767,14 +6774,20 @@ function extractSEOverlayId(input) {
6767
6774
  }
6768
6775
  function extractSEPreviewParts(input) {
6769
6776
  const trimmed = input.trim();
6770
- const m = trimmed.match(/streamelements\.com\/overlay\/([0-9a-f]{24})\/([A-Za-z0-9_-]+)/i);
6777
+ const m = trimmed.match(/streamelements\.com\/overlay\/([0-9a-f]{24})(?:\/([A-Za-z0-9_-]+))?/i);
6771
6778
  if (!m) return null;
6772
- return { overlayId: m[1], apikey: m[2] };
6779
+ const overlayId = m[1];
6780
+ const second = m[2];
6781
+ const apikey = second && second.toLowerCase() !== "editor" ? second : null;
6782
+ return { overlayId, apikey };
6773
6783
  }
6774
6784
  function buildBootstrapUrl(overlayId) {
6775
6785
  return `https://api.streamelements.com/kappa/v2/overlays/${overlayId}/bootstrap?isEditor=false&isMobile=false&isObs=false&isObsLive=false&isXsplit=false`;
6776
6786
  }
6777
6787
  async function fetchSEBootstrap({ overlayId, apikey }) {
6788
+ if (!apikey) {
6789
+ throw new Error("Missing access token. Use the public preview URL (Overlay menu \u2192 Get URL \u2192 Public link) \u2014 editor URLs do not include a token.");
6790
+ }
6778
6791
  const res = await fetch(buildBootstrapUrl(overlayId), {
6779
6792
  method: "GET",
6780
6793
  headers: { Accept: "application/json", Authorization: `apikey ${apikey}` }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumiastream/ui",
3
- "version": "0.2.8-alpha.15",
3
+ "version": "0.2.8-alpha.16",
4
4
  "author": "Lumia Stream",
5
5
  "license": "ISC",
6
6
  "description": "Lumia UI Kit",