@myop/sdk 0.1.41 → 0.1.42

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.
Files changed (32) hide show
  1. package/dist/bundled-declarations.d.ts +24 -9
  2. package/dist/cjs/{_IframeSDK.56815070.js → _IframeSDK.4fce182a.js} +15 -3
  3. package/dist/cjs/_IframeSDK.4fce182a.js.map +7 -0
  4. package/dist/cjs/_IframeSDK.6ba9f7e0.min.js +1 -0
  5. package/dist/cjs/{_WebComponentSDK.285151df.js → _WebComponentSDK.a2aed5b5.js} +15 -3
  6. package/dist/cjs/_WebComponentSDK.a2aed5b5.js.map +7 -0
  7. package/dist/cjs/_WebComponentSDK.dc12528b.min.js +1 -0
  8. package/dist/cjs/_hostSDK.5ea0f6d9.min.js +1 -0
  9. package/dist/cjs/{_hostSDK.397d0006.js → _hostSDK.f1314596.js} +15 -3
  10. package/dist/cjs/_hostSDK.f1314596.js.map +7 -0
  11. package/dist/cjs/myop_sdk.js +11 -11
  12. package/dist/cjs/myop_sdk.js.map +1 -1
  13. package/dist/cjs/myop_sdk.min.js +1 -1
  14. package/dist/module/Iframe/index.js +21 -4
  15. package/dist/module/Iframe/index.js.map +2 -2
  16. package/dist/module/SDK.js +21 -4
  17. package/dist/module/SDK.js.map +2 -2
  18. package/dist/module/common/index.d.ts +23 -9
  19. package/dist/module/common/index.js +11 -1
  20. package/dist/module/common/index.js.map +2 -2
  21. package/dist/module/host/hostSDK.d.ts +1 -0
  22. package/dist/module/host/index.js +21 -4
  23. package/dist/module/host/index.js.map +2 -2
  24. package/dist/module/webcomponent/index.js +21 -4
  25. package/dist/module/webcomponent/index.js.map +2 -2
  26. package/package.json +1 -1
  27. package/dist/cjs/_IframeSDK.09ec9f1b.min.js +0 -1
  28. package/dist/cjs/_IframeSDK.56815070.js.map +0 -7
  29. package/dist/cjs/_WebComponentSDK.285151df.js.map +0 -7
  30. package/dist/cjs/_WebComponentSDK.c0cd7c5f.min.js +0 -1
  31. package/dist/cjs/_hostSDK.0bd6ebc8.min.js +0 -1
  32. package/dist/cjs/_hostSDK.397d0006.js.map +0 -7
@@ -212,23 +212,37 @@ declare module "@myop/sdk/common" {
212
212
  type: PropType;
213
213
  messageType: MyopMessageKey;
214
214
  }
215
- type IPropConfigMode = 'input' | 'output';
216
- type IPropConfigBehaviorType = 'message';
215
+ export const PropMessageModes: {
216
+ readonly input: "input";
217
+ readonly output: "output";
218
+ };
219
+ export const PropConfigBehaviorTypes: {
220
+ readonly message: "message";
221
+ readonly code: "code";
222
+ };
217
223
  export interface IPropMessageBehaviorParam {
218
224
  value: string;
219
225
  }
226
+ export interface IPropBehavior {
227
+ type: keyof typeof PropConfigBehaviorTypes;
228
+ }
229
+ export interface IPropCodeBehavior extends IPropBehavior {
230
+ type: "code";
231
+ remap?: string;
232
+ }
233
+ export interface IPropMessageBehavior extends IPropBehavior {
234
+ type: "message";
235
+ message: MyopMessageKey;
236
+ ref: string;
237
+ params: IPropMessageBehaviorParam[];
238
+ mode: keyof typeof PropMessageModes;
239
+ }
220
240
  export interface IPropConfig {
221
241
  id: string;
222
242
  name: string;
223
243
  description: string;
224
244
  type: PropType;
225
- mode: IPropConfigMode;
226
- behavior: {
227
- type: IPropConfigBehaviorType;
228
- message: MyopMessageKey;
229
- ref: string;
230
- params: IPropMessageBehaviorParam[];
231
- };
245
+ behavior: IPropBehavior;
232
246
  }
233
247
  export class RefBehaviorType {
234
248
  static code: "code";
@@ -1598,6 +1612,7 @@ declare module "@myop/sdk/host/hostSDK" {
1598
1612
  elementAttributes?: ElementAttributes;
1599
1613
  _environment?: IEnvironment;
1600
1614
  _hasParent?: boolean;
1615
+ _inspection?: boolean;
1601
1616
  }
1602
1617
  export const hostSDK: HostSDK;
1603
1618
  global {
@@ -1685,7 +1685,7 @@ var WebcomponentLoader = class extends BaseMyopLoader {
1685
1685
  };
1686
1686
 
1687
1687
  // version:myop-sdk-version
1688
- var myop_sdk_version_default = "0.1.41";
1688
+ var myop_sdk_version_default = "0.1.42";
1689
1689
 
1690
1690
  // src/webcomponent/messageHandlers/BaseWebComponentMessageHandler.ts
1691
1691
  var BaseWebComponentMessageHandler = class extends BaseContextMessageHandler {
@@ -2066,7 +2066,19 @@ var HTMLComponentLoader = class extends BaseMyopLoader {
2066
2066
  container.appendChild(IframeElement);
2067
2067
  const doc = IframeElement.contentDocument || IframeElement.contentWindow.document;
2068
2068
  doc.open();
2069
- doc.writeln(loaderConfig.HTML);
2069
+ let HTML2Render = loaderConfig.HTML;
2070
+ if (options == null ? void 0 : options._inspection) {
2071
+ const parser = new DOMParser();
2072
+ const _doc = parser.parseFromString(loaderConfig.HTML, "text/html");
2073
+ const temp = _doc.implementation.createHTMLDocument();
2074
+ temp.body.innerHTML = "<script>\n const beforeKeysWindow = new Set(Object.keys(window));\n window.myopState = {\n beforeKeysWindow,\n };\n <\/script>";
2075
+ const node = temp.body.firstChild;
2076
+ if (node && _doc.head) {
2077
+ _doc.head.insertBefore(_doc.importNode(node, true), _doc.head.firstChild);
2078
+ }
2079
+ HTML2Render = _doc.documentElement.outerHTML;
2080
+ }
2081
+ doc.writeln(HTML2Render);
2070
2082
  doc.writeln('<script src="'.concat(window.myop.__ROOT_SDK_PUBLIC_URL__, "\"><\/script>\n <script>\n window.__federation__ = \n { ...window.__federation__,\n //TODO : get from ENV at build time, \n // inject value to module at build time \n // today we doing so just for the CJS version \n __public_path__ :'https://cdn.myop.dev/sdk/next',\n ...").concat(JSON.stringify(
2071
2083
  // @ts-ignore
2072
2084
  window.__federation__
@@ -2193,7 +2205,7 @@ var checkMyopOverride = async (componentConfig) => {
2193
2205
  }
2194
2206
  }
2195
2207
  }
2196
- } finally {
2208
+ } catch (e) {
2197
2209
  return null;
2198
2210
  }
2199
2211
  };