@myop/sdk 0.3.18 → 0.3.20
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/bundled-declarations.d.ts +24 -0
- package/dist/cjs/{_IframeSDK.c1b7f57f.js → _IframeSDK.63faba1b.js} +99 -71
- package/dist/cjs/_IframeSDK.63faba1b.js.map +7 -0
- package/dist/cjs/_IframeSDK.a00fcd4b.min.js +1 -0
- package/dist/cjs/_MyopHelpers.19dc0df3.min.js +1 -0
- package/dist/cjs/{_MyopHelpers.a39f420c.js → _MyopHelpers.71a8a09b.js} +47 -1
- package/dist/cjs/_MyopHelpers.71a8a09b.js.map +7 -0
- package/dist/cjs/_WebComponentSDK.03cdf3cf.min.js +1 -0
- package/dist/cjs/{_WebComponentSDK.26dff6f5.js → _WebComponentSDK.8f19258f.js} +99 -71
- package/dist/cjs/{_WebComponentSDK.26dff6f5.js.map → _WebComponentSDK.8f19258f.js.map} +4 -4
- package/dist/cjs/_hostSDK.1c0fe5db.min.js +1 -0
- package/dist/cjs/{_hostSDK.cb5a3856.js → _hostSDK.a5f727f5.js} +99 -71
- package/dist/cjs/_hostSDK.a5f727f5.js.map +7 -0
- package/dist/cjs/myop_sdk.js +19 -19
- package/dist/cjs/myop_sdk.js.map +1 -1
- package/dist/cjs/myop_sdk.min.js +1 -1
- package/dist/cjs-bundled/myop_sdk.bundled.js +148 -72
- package/dist/cjs-bundled/myop_sdk.bundled.js.map +3 -3
- package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -1
- package/dist/module/Iframe/index.js +100 -72
- package/dist/module/Iframe/index.js.map +4 -4
- package/dist/module/SDK.js +148 -72
- package/dist/module/SDK.js.map +3 -3
- package/dist/module/embeddedSDK.js +1 -1
- package/dist/module/helpers/CloudRepository.d.ts +1 -0
- package/dist/module/helpers/cloudRepositoryHelpers.d.ts +12 -0
- package/dist/module/helpers/index.d.ts +1 -0
- package/dist/module/helpers/index.js +40 -2
- package/dist/module/helpers/index.js.map +3 -3
- package/dist/module/host/components/myopIframeComponent.d.ts +8 -0
- package/dist/module/host/embeddedSDK.js +1 -1
- package/dist/module/host/index.js +100 -72
- package/dist/module/host/index.js.map +4 -4
- package/dist/module/webcomponent/index.js +100 -72
- package/dist/module/webcomponent/index.js.map +4 -4
- package/package.json +54 -6
- package/dist/cjs/_IframeSDK.c1b7f57f.js.map +0 -7
- package/dist/cjs/_IframeSDK.ff567b74.min.js +0 -1
- package/dist/cjs/_MyopHelpers.a39f420c.js.map +0 -7
- package/dist/cjs/_MyopHelpers.eb1728bc.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.045877dc.min.js +0 -1
- package/dist/cjs/_hostSDK.1f0bc503.min.js +0 -1
- package/dist/cjs/_hostSDK.cb5a3856.js.map +0 -7
|
@@ -1191,6 +1191,9 @@ declare module "@myop/sdk/host/components/myopIframeComponent" {
|
|
|
1191
1191
|
componentConfig: IComponentDefinitionConfig;
|
|
1192
1192
|
container: HTMLElement;
|
|
1193
1193
|
private IframeElement;
|
|
1194
|
+
private _autoSizeCleanup?;
|
|
1195
|
+
private _autoSizeOptions?;
|
|
1196
|
+
private _autoSizeUpdate?;
|
|
1194
1197
|
constructor(componentConfig: IComponentDefinitionConfig, skin: ISkinConfig, container: HTMLElement, IframeElement: HTMLIFrameElement, options?: loaderOptions);
|
|
1195
1198
|
sizeMeta?: {
|
|
1196
1199
|
width?: string | number;
|
|
@@ -1209,6 +1212,11 @@ declare module "@myop/sdk/host/components/myopIframeComponent" {
|
|
|
1209
1212
|
/**
|
|
1210
1213
|
* Observes the iframe content size and automatically syncs it to the iframe element.
|
|
1211
1214
|
* Uses direct contentDocument access (same-origin only) for accurate measurements.
|
|
1215
|
+
*
|
|
1216
|
+
* Reentrant: when called again while observers already exist, updates options and
|
|
1217
|
+
* re-evaluates sizing without recreating observers. Cleanup + re-call (e.g. React
|
|
1218
|
+
* re-render) creates fresh observers since cleanup clears the existing ones.
|
|
1219
|
+
*
|
|
1212
1220
|
* @param options - Configuration options including size change callback and min/max constraints
|
|
1213
1221
|
* @returns Cleanup function to stop observing
|
|
1214
1222
|
*/
|
|
@@ -1702,6 +1710,7 @@ declare module "@myop/sdk/helpers/CloudRepository" {
|
|
|
1702
1710
|
private preloadedComponents;
|
|
1703
1711
|
private userFlows;
|
|
1704
1712
|
private _defaultEnv;
|
|
1713
|
+
private _envExplicitlySet;
|
|
1705
1714
|
constructor(_baseUrl?: string);
|
|
1706
1715
|
/**
|
|
1707
1716
|
* Set the default environment for this CloudRepository instance
|
|
@@ -1749,6 +1758,20 @@ declare module "@myop/sdk/helpers/CloudRepository" {
|
|
|
1749
1758
|
declare module "@myop/sdk/helpers/exec" {
|
|
1750
1759
|
export const exec: (getter: any) => Promise<any>;
|
|
1751
1760
|
}
|
|
1761
|
+
declare module "@myop/sdk/helpers/cloudRepositoryHelpers" {
|
|
1762
|
+
import { CloudRepository } from "@myop/sdk/helpers/CloudRepository";
|
|
1763
|
+
export const getCloudRepository: () => CloudRepository;
|
|
1764
|
+
export const isPreloaded: (componentId: string, env?: string, preview?: boolean) => boolean;
|
|
1765
|
+
export const getPreloadedParams: (componentId: string) => {
|
|
1766
|
+
env: string;
|
|
1767
|
+
preview: boolean;
|
|
1768
|
+
};
|
|
1769
|
+
export const enableLocalDev: () => void;
|
|
1770
|
+
export const setCloudRepositoryUrl: (url: string) => void;
|
|
1771
|
+
export const setCloudRepository: (repository: CloudRepository) => void;
|
|
1772
|
+
export const setEnvironment: (env: string) => void;
|
|
1773
|
+
export const preloadComponents: (ids: string[], env?: string, preview?: boolean) => Promise<PromiseSettledResult<import("common").IComponentConfig>[]>;
|
|
1774
|
+
}
|
|
1752
1775
|
declare module "@myop/sdk/helpers" {
|
|
1753
1776
|
export * from "@myop/sdk/helpers/applyStylesheet";
|
|
1754
1777
|
export * from "@myop/sdk/helpers/iframeSkinUrlTokenizer";
|
|
@@ -1756,6 +1779,7 @@ declare module "@myop/sdk/helpers" {
|
|
|
1756
1779
|
export * from "@myop/sdk/helpers/configBuilder";
|
|
1757
1780
|
export * from "@myop/sdk/helpers/CloudRepository";
|
|
1758
1781
|
export * from "@myop/sdk/helpers/exec";
|
|
1782
|
+
export * from "@myop/sdk/helpers/cloudRepositoryHelpers";
|
|
1759
1783
|
}
|
|
1760
1784
|
declare module "@myop/sdk/host/myopOverride" {
|
|
1761
1785
|
import { IComponentConfig } from "@myop/sdk/common";
|
|
@@ -1585,6 +1585,9 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1585
1585
|
this.componentConfig = componentConfig;
|
|
1586
1586
|
this.container = container;
|
|
1587
1587
|
this.IframeElement = IframeElement;
|
|
1588
|
+
__publicField(this, "_autoSizeCleanup");
|
|
1589
|
+
__publicField(this, "_autoSizeOptions");
|
|
1590
|
+
__publicField(this, "_autoSizeUpdate");
|
|
1588
1591
|
__publicField(this, "sizeMeta");
|
|
1589
1592
|
__publicField(this, "cleanupInspect");
|
|
1590
1593
|
__publicField(this, "setHeightBasedOnDocumentElement", () => {
|
|
@@ -1614,11 +1617,20 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1614
1617
|
/**
|
|
1615
1618
|
* Observes the iframe content size and automatically syncs it to the iframe element.
|
|
1616
1619
|
* Uses direct contentDocument access (same-origin only) for accurate measurements.
|
|
1620
|
+
*
|
|
1621
|
+
* Reentrant: when called again while observers already exist, updates options and
|
|
1622
|
+
* re-evaluates sizing without recreating observers. Cleanup + re-call (e.g. React
|
|
1623
|
+
* re-render) creates fresh observers since cleanup clears the existing ones.
|
|
1624
|
+
*
|
|
1617
1625
|
* @param options - Configuration options including size change callback and min/max constraints
|
|
1618
1626
|
* @returns Cleanup function to stop observing
|
|
1619
1627
|
*/
|
|
1620
1628
|
__publicField(this, "observeAutoSize", (options) => {
|
|
1621
|
-
|
|
1629
|
+
this._autoSizeOptions = options;
|
|
1630
|
+
if (this._autoSizeCleanup && this._autoSizeUpdate) {
|
|
1631
|
+
this._autoSizeUpdate();
|
|
1632
|
+
return this._autoSizeCleanup;
|
|
1633
|
+
}
|
|
1622
1634
|
const iframe = this.IframeElement;
|
|
1623
1635
|
const doc = iframe.contentDocument;
|
|
1624
1636
|
if (!doc) {
|
|
@@ -1637,78 +1649,88 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1637
1649
|
const parsed = parseFloat(value);
|
|
1638
1650
|
return isNaN(parsed) ? void 0 : parsed;
|
|
1639
1651
|
};
|
|
1640
|
-
const minWidth = parseSize(options == null ? void 0 : options.minWidth);
|
|
1641
|
-
const maxWidth = parseSize(options == null ? void 0 : options.maxWidth);
|
|
1642
|
-
const minHeight = parseSize(options == null ? void 0 : options.minHeight);
|
|
1643
|
-
const maxHeight = parseSize(options == null ? void 0 : options.maxHeight);
|
|
1644
|
-
const loaderMinHeight = (_a = options == null ? void 0 : options.loaderMinHeight) != null ? _a : 50;
|
|
1645
|
-
const sizeMetaFillWidth = ((_b = this.sizeMeta) == null ? void 0 : _b.width) === "100%" ? "100%" : void 0;
|
|
1646
|
-
const sizeMetaFillHeight = ((_c = this.sizeMeta) == null ? void 0 : _c.height) === "100%" ? "100%" : void 0;
|
|
1647
|
-
const resolvedExplicitWidth = (_e = (_d = options == null ? void 0 : options.explicitWidth) != null ? _d : sizeMetaFillWidth) != null ? _e : "100%";
|
|
1648
|
-
const resolvedExplicitHeight = (_f = options == null ? void 0 : options.explicitHeight) != null ? _f : sizeMetaFillHeight;
|
|
1649
|
-
const hasExplicitWidth = resolvedExplicitWidth !== void 0;
|
|
1650
|
-
const hasExplicitHeight = resolvedExplicitHeight !== void 0;
|
|
1651
|
-
const containerRect = this.container.getBoundingClientRect();
|
|
1652
|
-
const collapsedWidth = containerRect.width === 0;
|
|
1653
|
-
const collapsedHeight = containerRect.height === 0 || containerRect.height === loaderMinHeight;
|
|
1654
|
-
const shouldAutoWidth = (options == null ? void 0 : options.forceAutoSize) ? !hasExplicitWidth : collapsedWidth && !hasExplicitWidth;
|
|
1655
|
-
const shouldAutoHeight = (options == null ? void 0 : options.forceAutoSize) ? !hasExplicitHeight : collapsedHeight && !hasExplicitHeight;
|
|
1656
|
-
if (!shouldAutoWidth && !shouldAutoHeight) {
|
|
1657
|
-
const explicitWidthPx = typeof resolvedExplicitWidth === "number" ? resolvedExplicitWidth : void 0;
|
|
1658
|
-
const explicitHeightPx = typeof resolvedExplicitHeight === "number" ? resolvedExplicitHeight : void 0;
|
|
1659
|
-
if (explicitWidthPx !== void 0 || explicitHeightPx !== void 0) {
|
|
1660
|
-
(_g = options == null ? void 0 : options.onSizeChange) == null ? void 0 : _g.call(options, {
|
|
1661
|
-
width: explicitWidthPx,
|
|
1662
|
-
height: explicitHeightPx,
|
|
1663
|
-
autoSizingWidth: false,
|
|
1664
|
-
autoSizingHeight: false
|
|
1665
|
-
});
|
|
1666
|
-
}
|
|
1667
|
-
return () => {
|
|
1668
|
-
};
|
|
1669
|
-
}
|
|
1670
1652
|
const updateSize = () => {
|
|
1671
|
-
var
|
|
1653
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
1672
1654
|
const contentDoc = iframe.contentDocument;
|
|
1673
|
-
if (contentDoc)
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1655
|
+
if (!contentDoc) return;
|
|
1656
|
+
const opts = this._autoSizeOptions;
|
|
1657
|
+
const minWidth = parseSize(opts == null ? void 0 : opts.minWidth);
|
|
1658
|
+
const maxWidth = parseSize(opts == null ? void 0 : opts.maxWidth);
|
|
1659
|
+
const minHeight = parseSize(opts == null ? void 0 : opts.minHeight);
|
|
1660
|
+
const maxHeight = parseSize(opts == null ? void 0 : opts.maxHeight);
|
|
1661
|
+
const loaderMinHeight = (_a = opts == null ? void 0 : opts.loaderMinHeight) != null ? _a : 50;
|
|
1662
|
+
const sizeMetaFillWidth = ((_b = this.sizeMeta) == null ? void 0 : _b.width) === "100%" ? "100%" : void 0;
|
|
1663
|
+
const sizeMetaFillHeight = ((_c = this.sizeMeta) == null ? void 0 : _c.height) === "100%" ? "100%" : void 0;
|
|
1664
|
+
const resolvedExplicitWidth = (_e = (_d = opts == null ? void 0 : opts.explicitWidth) != null ? _d : sizeMetaFillWidth) != null ? _e : "100%";
|
|
1665
|
+
const resolvedExplicitHeight = (_f = opts == null ? void 0 : opts.explicitHeight) != null ? _f : sizeMetaFillHeight;
|
|
1666
|
+
const hasExplicitWidth = resolvedExplicitWidth !== void 0;
|
|
1667
|
+
const hasExplicitHeight = resolvedExplicitHeight !== void 0;
|
|
1668
|
+
const containerRect = this.container.getBoundingClientRect();
|
|
1669
|
+
const collapsedWidth = containerRect.width === 0;
|
|
1670
|
+
const collapsedHeight = containerRect.height === 0 || containerRect.height === loaderMinHeight;
|
|
1671
|
+
const shouldAutoWidth = (opts == null ? void 0 : opts.forceAutoSize) ? !hasExplicitWidth : collapsedWidth && !hasExplicitWidth;
|
|
1672
|
+
const shouldAutoHeight = (opts == null ? void 0 : opts.forceAutoSize) ? !hasExplicitHeight : collapsedHeight && !hasExplicitHeight;
|
|
1673
|
+
if (!shouldAutoWidth && !shouldAutoHeight) {
|
|
1674
|
+
iframe.style.width = typeof resolvedExplicitWidth === "number" ? "".concat(resolvedExplicitWidth, "px") : "100%";
|
|
1675
|
+
iframe.style.height = typeof resolvedExplicitHeight === "number" ? "".concat(resolvedExplicitHeight, "px") : "100%";
|
|
1676
|
+
const explicitWidthPx = typeof resolvedExplicitWidth === "number" ? resolvedExplicitWidth : void 0;
|
|
1677
|
+
const explicitHeightPx = typeof resolvedExplicitHeight === "number" ? resolvedExplicitHeight : void 0;
|
|
1678
|
+
if (explicitWidthPx !== void 0 || explicitHeightPx !== void 0) {
|
|
1679
|
+
(_g = opts == null ? void 0 : opts.onSizeChange) == null ? void 0 : _g.call(opts, {
|
|
1680
|
+
width: explicitWidthPx,
|
|
1681
|
+
height: explicitHeightPx,
|
|
1682
|
+
autoSizingWidth: false,
|
|
1683
|
+
autoSizingHeight: false
|
|
1684
|
+
});
|
|
1689
1685
|
}
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
autoSizingWidth: shouldAutoWidth,
|
|
1698
|
-
autoSizingHeight: shouldAutoHeight
|
|
1699
|
-
});
|
|
1686
|
+
return;
|
|
1687
|
+
}
|
|
1688
|
+
if (shouldAutoHeight) {
|
|
1689
|
+
iframe.style.height = "0px";
|
|
1690
|
+
}
|
|
1691
|
+
if (shouldAutoWidth) {
|
|
1692
|
+
iframe.style.width = "0px";
|
|
1700
1693
|
}
|
|
1694
|
+
const contentWidth = Math.ceil(Math.max(contentDoc.documentElement.scrollWidth, contentDoc.body.scrollWidth));
|
|
1695
|
+
const contentHeight = Math.ceil(Math.max(contentDoc.documentElement.scrollHeight, contentDoc.body.scrollHeight));
|
|
1696
|
+
const width = clamp(contentWidth, minWidth, maxWidth);
|
|
1697
|
+
const height = clamp(contentHeight, minHeight, maxHeight);
|
|
1698
|
+
if (shouldAutoWidth) {
|
|
1699
|
+
iframe.style.width = "".concat(width, "px");
|
|
1700
|
+
} else {
|
|
1701
|
+
iframe.style.width = typeof resolvedExplicitWidth === "number" ? "".concat(resolvedExplicitWidth, "px") : "100%";
|
|
1702
|
+
}
|
|
1703
|
+
if (shouldAutoHeight) {
|
|
1704
|
+
iframe.style.height = "".concat(height, "px");
|
|
1705
|
+
} else {
|
|
1706
|
+
iframe.style.height = typeof resolvedExplicitHeight === "number" ? "".concat(resolvedExplicitHeight, "px") : "100%";
|
|
1707
|
+
}
|
|
1708
|
+
const isWidthConstrained = shouldAutoWidth && maxWidth !== void 0 && contentWidth > maxWidth;
|
|
1709
|
+
const isHeightConstrained = shouldAutoHeight && maxHeight !== void 0 && contentHeight > maxHeight;
|
|
1710
|
+
contentDoc.documentElement.style.overflowX = isWidthConstrained ? "auto" : "";
|
|
1711
|
+
contentDoc.documentElement.style.overflowY = isHeightConstrained ? "auto" : "";
|
|
1712
|
+
(_h = opts == null ? void 0 : opts.onSizeChange) == null ? void 0 : _h.call(opts, {
|
|
1713
|
+
width,
|
|
1714
|
+
height,
|
|
1715
|
+
autoSizingWidth: shouldAutoWidth,
|
|
1716
|
+
autoSizingHeight: shouldAutoHeight
|
|
1717
|
+
});
|
|
1701
1718
|
};
|
|
1702
1719
|
updateSize();
|
|
1720
|
+
this._autoSizeUpdate = updateSize;
|
|
1703
1721
|
const resizeObserver = new ResizeObserver(updateSize);
|
|
1704
1722
|
resizeObserver.observe(doc.body);
|
|
1705
1723
|
resizeObserver.observe(doc.documentElement);
|
|
1706
1724
|
const mutationObserver = new MutationObserver(updateSize);
|
|
1707
1725
|
mutationObserver.observe(doc.body, { childList: true, subtree: true, characterData: true, attributes: true });
|
|
1708
|
-
|
|
1726
|
+
const cleanup = () => {
|
|
1709
1727
|
resizeObserver.disconnect();
|
|
1710
1728
|
mutationObserver.disconnect();
|
|
1729
|
+
this._autoSizeUpdate = void 0;
|
|
1730
|
+
this._autoSizeCleanup = void 0;
|
|
1711
1731
|
};
|
|
1732
|
+
this._autoSizeCleanup = cleanup;
|
|
1733
|
+
return cleanup;
|
|
1712
1734
|
});
|
|
1713
1735
|
__publicField(this, "setSizeBasedOnDocumentElement", () => {
|
|
1714
1736
|
const cleanupHandler = this.send(new ExecuteScriptMessage(() => {
|
|
@@ -1755,16 +1777,15 @@ var MyopIframeComponent = class extends BaseMyopComponent {
|
|
|
1755
1777
|
return cleanupHandler;
|
|
1756
1778
|
});
|
|
1757
1779
|
__publicField(this, "dispose", () => {
|
|
1780
|
+
if (this._autoSizeCleanup) {
|
|
1781
|
+
this._autoSizeCleanup();
|
|
1782
|
+
this._autoSizeCleanup = void 0;
|
|
1783
|
+
}
|
|
1758
1784
|
if (this.cleanupInspect)
|
|
1759
1785
|
this.cleanupInspect();
|
|
1760
1786
|
super.dispose();
|
|
1761
1787
|
this.IframeElement.parentNode.removeChild(this.IframeElement);
|
|
1762
1788
|
});
|
|
1763
|
-
if (skin.loader.autoHeight) {
|
|
1764
|
-
this.initiated().then(() => {
|
|
1765
|
-
this.setHeightBasedOnScrollHeight();
|
|
1766
|
-
});
|
|
1767
|
-
}
|
|
1768
1789
|
this.element = this.IframeElement;
|
|
1769
1790
|
}
|
|
1770
1791
|
inspect() {
|
|
@@ -1974,7 +1995,7 @@ var WebcomponentLoader = class extends BaseMyopLoader {
|
|
|
1974
1995
|
};
|
|
1975
1996
|
|
|
1976
1997
|
// version:myop-sdk-version
|
|
1977
|
-
var myop_sdk_version_default = "0.3.
|
|
1998
|
+
var myop_sdk_version_default = "0.3.19";
|
|
1978
1999
|
|
|
1979
2000
|
// src/webcomponent/messageHandlers/BaseWebComponentMessageHandler.ts
|
|
1980
2001
|
var BaseWebComponentMessageHandler = class extends BaseContextMessageHandler {
|
|
@@ -2408,11 +2429,12 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
|
|
|
2408
2429
|
doc.close();
|
|
2409
2430
|
const comp = new MyopIframeComponent(componentDefinition, skin, container, IframeElement, options);
|
|
2410
2431
|
comp.sizeMeta = parsedSizeMeta;
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2432
|
+
comp.initiated().then(() => {
|
|
2433
|
+
comp.observeAutoSize({ forceAutoSize: true });
|
|
2434
|
+
if (!(options == null ? void 0 : options.hidden)) {
|
|
2435
|
+
comp.show();
|
|
2436
|
+
}
|
|
2437
|
+
});
|
|
2416
2438
|
return comp;
|
|
2417
2439
|
}
|
|
2418
2440
|
if (loaderConfig.shadowRootMode === ShadowRootModeType.none) {
|
|
@@ -2605,6 +2627,7 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2605
2627
|
// v1 cache
|
|
2606
2628
|
__publicField(this, "userFlows", {});
|
|
2607
2629
|
__publicField(this, "_defaultEnv", "production");
|
|
2630
|
+
__publicField(this, "_envExplicitlySet", false);
|
|
2608
2631
|
}
|
|
2609
2632
|
static get Main() {
|
|
2610
2633
|
const globalMain = getGlobalMain();
|
|
@@ -2622,6 +2645,7 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2622
2645
|
*/
|
|
2623
2646
|
setEnvironment(env) {
|
|
2624
2647
|
this._defaultEnv = env;
|
|
2648
|
+
this._envExplicitlySet = true;
|
|
2625
2649
|
}
|
|
2626
2650
|
/**
|
|
2627
2651
|
* Get the current default environment
|
|
@@ -2662,7 +2686,8 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2662
2686
|
usePreview = preloaded.preview;
|
|
2663
2687
|
} else {
|
|
2664
2688
|
env = environmentIdentifier || this._defaultEnv;
|
|
2665
|
-
|
|
2689
|
+
const hasEffectiveEnv = environmentIdentifier || this._envExplicitlySet;
|
|
2690
|
+
usePreview = preview === true ? true : preview === false ? false : !hasEffectiveEnv;
|
|
2666
2691
|
}
|
|
2667
2692
|
const cacheKey = "".concat(componentId, ":").concat(env, ":").concat(usePreview ? "preview" : "live");
|
|
2668
2693
|
console.log("[CloudRepository] fetchComponentV2", {
|
|
@@ -2765,6 +2790,9 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2765
2790
|
__publicField(_CloudRepository, "_main", null);
|
|
2766
2791
|
var CloudRepository = _CloudRepository;
|
|
2767
2792
|
|
|
2793
|
+
// src/helpers/cloudRepositoryHelpers.ts
|
|
2794
|
+
var _cloudRepository = CloudRepository.Main;
|
|
2795
|
+
|
|
2768
2796
|
// src/host/myopOverride.ts
|
|
2769
2797
|
var checkMyopOverride = async (componentConfig) => {
|
|
2770
2798
|
try {
|