@myop/sdk 0.3.28 → 0.3.30
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 +19 -0
- package/dist/cjs/_IframeSDK.54e9c00a.min.js +1 -0
- package/dist/cjs/{_IframeSDK.7c201b5c.js → _IframeSDK.58a92ae6.js} +33 -4
- package/dist/cjs/{_IframeSDK.7c201b5c.js.map → _IframeSDK.58a92ae6.js.map} +2 -2
- package/dist/cjs/_MyopHelpers.172384f4.min.js +1 -0
- package/dist/cjs/{_MyopHelpers.3eeac406.js → _MyopHelpers.95610381.js} +41 -3
- package/dist/cjs/{_MyopHelpers.3eeac406.js.map → _MyopHelpers.95610381.js.map} +2 -2
- package/dist/cjs/_WebComponentSDK.2c337f58.min.js +1 -0
- package/dist/cjs/{_WebComponentSDK.952f7c87.js → _WebComponentSDK.70ad04f1.js} +33 -4
- package/dist/cjs/{_WebComponentSDK.952f7c87.js.map → _WebComponentSDK.70ad04f1.js.map} +2 -2
- package/dist/cjs/{_hostSDK.a73e7b24.js → _hostSDK.3da4ff63.js} +33 -4
- package/dist/cjs/{_hostSDK.a73e7b24.js.map → _hostSDK.3da4ff63.js.map} +2 -2
- package/dist/cjs/_hostSDK.e22156b3.min.js +1 -0
- package/dist/cjs/myop_sdk.js +14 -14
- 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 +44 -6
- package/dist/cjs-bundled/myop_sdk.bundled.js.map +2 -2
- package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -1
- package/dist/module/Iframe/index.js +34 -5
- package/dist/module/Iframe/index.js.map +2 -2
- package/dist/module/SDK.js +44 -6
- package/dist/module/SDK.js.map +2 -2
- package/dist/module/embeddedSDK.js +1 -1
- package/dist/module/helpers/CloudRepository.d.ts +13 -0
- package/dist/module/helpers/cloudRepositoryHelpers.d.ts +6 -0
- package/dist/module/helpers/index.js +41 -4
- package/dist/module/helpers/index.js.map +2 -2
- package/dist/module/host/embeddedSDK.js +1 -1
- package/dist/module/host/index.js +34 -5
- package/dist/module/host/index.js.map +2 -2
- package/dist/module/webcomponent/index.js +34 -5
- package/dist/module/webcomponent/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/cjs/_IframeSDK.7cd7468c.min.js +0 -1
- package/dist/cjs/_MyopHelpers.e8e1216b.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.ead0b8a6.min.js +0 -1
- package/dist/cjs/_hostSDK.a882a5c1.min.js +0 -1
|
@@ -1900,7 +1900,7 @@ var WebcomponentLoader = class extends BaseMyopLoader {
|
|
|
1900
1900
|
};
|
|
1901
1901
|
|
|
1902
1902
|
// version:myop-sdk-version
|
|
1903
|
-
var myop_sdk_version_default = "0.3.
|
|
1903
|
+
var myop_sdk_version_default = "0.3.30";
|
|
1904
1904
|
|
|
1905
1905
|
// src/webcomponent/messageHandlers/BaseWebComponentMessageHandler.ts
|
|
1906
1906
|
var BaseWebComponentMessageHandler = class extends BaseContextMessageHandler {
|
|
@@ -2565,6 +2565,8 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2565
2565
|
__publicField(this, "userFlows", {});
|
|
2566
2566
|
__publicField(this, "_defaultEnv", "production");
|
|
2567
2567
|
__publicField(this, "_envExplicitlySet", false);
|
|
2568
|
+
__publicField(this, "_staticMode", false);
|
|
2569
|
+
__publicField(this, "_queryParams", {});
|
|
2568
2570
|
}
|
|
2569
2571
|
static get Main() {
|
|
2570
2572
|
const globalMain = getGlobalMain();
|
|
@@ -2577,6 +2579,21 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2577
2579
|
}
|
|
2578
2580
|
return _CloudRepository._main;
|
|
2579
2581
|
}
|
|
2582
|
+
/**
|
|
2583
|
+
* Enable static mode for self-hosted component registries.
|
|
2584
|
+
* In static mode, URLs are constructed as file paths instead of query params:
|
|
2585
|
+
* ${baseUrl}/components/${componentId}/${env}.json
|
|
2586
|
+
*/
|
|
2587
|
+
enableStaticMode() {
|
|
2588
|
+
this._staticMode = true;
|
|
2589
|
+
}
|
|
2590
|
+
/**
|
|
2591
|
+
* Set query parameters to append to all fetch URLs (e.g. for CDN cache busting).
|
|
2592
|
+
* Example: `setQueryParams({ lastupdate: '11112026' })`
|
|
2593
|
+
*/
|
|
2594
|
+
setQueryParams(params) {
|
|
2595
|
+
this._queryParams = params;
|
|
2596
|
+
}
|
|
2580
2597
|
/**
|
|
2581
2598
|
* Set the default environment for this CloudRepository instance
|
|
2582
2599
|
*/
|
|
@@ -2641,11 +2658,23 @@ var _CloudRepository = class _CloudRepository {
|
|
|
2641
2658
|
this.variants[cacheKey] = new Promise(
|
|
2642
2659
|
async (resolve, reject) => {
|
|
2643
2660
|
try {
|
|
2644
|
-
let url
|
|
2645
|
-
if (
|
|
2646
|
-
|
|
2661
|
+
let url;
|
|
2662
|
+
if (this._staticMode) {
|
|
2663
|
+
const file = usePreview ? "preview" : env;
|
|
2664
|
+
url = "".concat(this._baseUrl, "/components/").concat(componentId, "/").concat(file, ".json");
|
|
2665
|
+
const qs = new URLSearchParams(this._queryParams).toString();
|
|
2666
|
+
if (qs) url += "?".concat(qs);
|
|
2667
|
+
} else {
|
|
2668
|
+
url = "".concat(this._baseUrl, "/consume?id=").concat(componentId, "&env=").concat(env);
|
|
2669
|
+
if (usePreview) {
|
|
2670
|
+
url += "&preview=true";
|
|
2671
|
+
}
|
|
2647
2672
|
}
|
|
2648
2673
|
const res = await fetch(url);
|
|
2674
|
+
if (!res.ok) {
|
|
2675
|
+
reject(new Error('Failed to load component "'.concat(componentId, '" (').concat(res.status).concat(this._staticMode ? " from ".concat(url) : "", ")")));
|
|
2676
|
+
return;
|
|
2677
|
+
}
|
|
2649
2678
|
const json = await res.json();
|
|
2650
2679
|
const variant = json.item;
|
|
2651
2680
|
if (!variant) {
|