@myop/sdk 0.3.15 → 0.3.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/bundled-declarations.d.ts +5 -2
- package/dist/cjs/{_IframeSDK.9748f61d.js → _IframeSDK.0e315746.js} +134 -87
- package/dist/cjs/_IframeSDK.0e315746.js.map +7 -0
- package/dist/cjs/_IframeSDK.5d5802e4.min.js +1 -0
- package/dist/cjs/{_WebComponentSDK.6157152e.js → _WebComponentSDK.6f1a3255.js} +134 -87
- package/dist/cjs/_WebComponentSDK.6f1a3255.js.map +7 -0
- package/dist/cjs/_WebComponentSDK.cc56ccfd.min.js +1 -0
- package/dist/cjs/_hostSDK.581f1f0b.min.js +1 -0
- package/dist/cjs/{_hostSDK.0fb0e40a.js → _hostSDK.fd5d5514.js} +134 -87
- package/dist/cjs/_hostSDK.fd5d5514.js.map +7 -0
- package/dist/cjs/myop_sdk.js +11 -11
- 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 +144 -96
- package/dist/cjs-bundled/myop_sdk.bundled.js.map +4 -4
- package/dist/cjs-bundled/myop_sdk.bundled.min.js +1 -1
- package/dist/module/Iframe/index.js +135 -88
- package/dist/module/Iframe/index.js.map +3 -3
- package/dist/module/SDK.js +144 -96
- package/dist/module/SDK.js.map +4 -4
- package/dist/module/embeddedSDK.js +1 -1
- package/dist/module/host/components/myopExtractedWebComponent.d.ts +5 -2
- package/dist/module/host/embeddedSDK.js +1 -1
- package/dist/module/host/index.js +135 -88
- package/dist/module/host/index.js.map +3 -3
- package/dist/module/webcomponent/index.js +135 -88
- package/dist/module/webcomponent/index.js.map +3 -3
- package/package.json +1 -1
- package/dist/cjs/_IframeSDK.9748f61d.js.map +0 -7
- package/dist/cjs/_IframeSDK.9bd2ab9c.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.28ac5568.min.js +0 -1
- package/dist/cjs/_WebComponentSDK.6157152e.js.map +0 -7
- package/dist/cjs/_hostSDK.0fb0e40a.js.map +0 -7
- package/dist/cjs/_hostSDK.c253d85a.min.js +0 -1
|
@@ -588,6 +588,8 @@ declare module "@myop/sdk/host/components/myopExtractedWebComponent" {
|
|
|
588
588
|
private customElement;
|
|
589
589
|
private tagName;
|
|
590
590
|
private ctaCleanup?;
|
|
591
|
+
private _ctaHandler?;
|
|
592
|
+
private _ctaQueue;
|
|
591
593
|
constructor(componentDefinition: IComponentDefinitionConfig, skin: ISkinConfig, container: HTMLElement, customElement: HTMLElement, tagName: string, options?: loaderOptions);
|
|
592
594
|
cleanupInspect: CleanupHandler;
|
|
593
595
|
inspect(): CleanupHandler;
|
|
@@ -602,9 +604,10 @@ declare module "@myop/sdk/host/components/myopExtractedWebComponent" {
|
|
|
602
604
|
*/
|
|
603
605
|
getData(): unknown;
|
|
604
606
|
/**
|
|
605
|
-
* Set
|
|
607
|
+
* Set CTA handler - unified API with iframe components.
|
|
608
|
+
* Called via props.myop_cta_handler = handler
|
|
606
609
|
*/
|
|
607
|
-
|
|
610
|
+
setCtaHandler(handler: (action: string, payload: unknown) => void): void;
|
|
608
611
|
/**
|
|
609
612
|
* For compatibility with message-based components.
|
|
610
613
|
* Web components don't use postMessage, so this is a no-op for most messages.
|
|
@@ -1156,6 +1156,114 @@ var MyopRefComponent = class extends BaseMyopComponent {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
};
|
|
1158
1158
|
|
|
1159
|
+
// src/host/components/myopExtractedWebComponent.ts
|
|
1160
|
+
var MyopExtractedWebComponent = class extends BaseMyopComponent {
|
|
1161
|
+
constructor(componentDefinition, skin, container, customElement, tagName, options) {
|
|
1162
|
+
super(componentDefinition, container, options);
|
|
1163
|
+
this.container = container;
|
|
1164
|
+
this.customElement = customElement;
|
|
1165
|
+
this.tagName = tagName;
|
|
1166
|
+
__publicField(this, "ctaCleanup");
|
|
1167
|
+
__publicField(this, "_ctaHandler");
|
|
1168
|
+
__publicField(this, "_ctaQueue", []);
|
|
1169
|
+
__publicField(this, "cleanupInspect", () => {
|
|
1170
|
+
});
|
|
1171
|
+
/**
|
|
1172
|
+
* For compatibility with message-based components.
|
|
1173
|
+
* Web components don't use postMessage, so this is a no-op for most messages.
|
|
1174
|
+
*/
|
|
1175
|
+
__publicField(this, "send", (message) => {
|
|
1176
|
+
const cleanupHandler = super.send(message);
|
|
1177
|
+
console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", message);
|
|
1178
|
+
return cleanupHandler;
|
|
1179
|
+
});
|
|
1180
|
+
__publicField(this, "dispose", () => {
|
|
1181
|
+
var _a;
|
|
1182
|
+
if (this.ctaCleanup) {
|
|
1183
|
+
this.ctaCleanup();
|
|
1184
|
+
}
|
|
1185
|
+
super.dispose();
|
|
1186
|
+
(_a = this.customElement.parentNode) == null ? void 0 : _a.removeChild(this.customElement);
|
|
1187
|
+
});
|
|
1188
|
+
this.element = customElement;
|
|
1189
|
+
this.setInitiated();
|
|
1190
|
+
}
|
|
1191
|
+
inspect() {
|
|
1192
|
+
this.cleanupInspect = setDebugStyle(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition);
|
|
1193
|
+
return this.cleanupInspect;
|
|
1194
|
+
}
|
|
1195
|
+
hide() {
|
|
1196
|
+
this.customElement.style.opacity = "0";
|
|
1197
|
+
this.customElement.style.position = "absolute";
|
|
1198
|
+
this.customElement.style.pointerEvents = "none";
|
|
1199
|
+
this.customElement.style.visibility = "hidden";
|
|
1200
|
+
this.customElement.style.height = "0";
|
|
1201
|
+
this.customElement.style.width = "0";
|
|
1202
|
+
}
|
|
1203
|
+
show() {
|
|
1204
|
+
this.customElement.style.opacity = "1";
|
|
1205
|
+
this.customElement.style.position = "unset";
|
|
1206
|
+
this.customElement.style.pointerEvents = "all";
|
|
1207
|
+
this.customElement.style.visibility = "visible";
|
|
1208
|
+
this.customElement.style.height = "";
|
|
1209
|
+
this.customElement.style.width = "";
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* Initialize the component with data by calling myop_init_interface directly
|
|
1213
|
+
*/
|
|
1214
|
+
initWithData(data) {
|
|
1215
|
+
if (typeof this.customElement.myop_init_interface === "function") {
|
|
1216
|
+
this.customElement.myop_init_interface(data);
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* Get current data from the component
|
|
1221
|
+
*/
|
|
1222
|
+
getData() {
|
|
1223
|
+
if (typeof this.customElement.myop_init_interface === "function") {
|
|
1224
|
+
return this.customElement.myop_init_interface();
|
|
1225
|
+
}
|
|
1226
|
+
return void 0;
|
|
1227
|
+
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Set CTA handler - unified API with iframe components.
|
|
1230
|
+
* Called via props.myop_cta_handler = handler
|
|
1231
|
+
*/
|
|
1232
|
+
setCtaHandler(handler) {
|
|
1233
|
+
if (this.ctaCleanup) {
|
|
1234
|
+
this.ctaCleanup();
|
|
1235
|
+
}
|
|
1236
|
+
this._ctaHandler = handler;
|
|
1237
|
+
if (this._ctaQueue.length > 0) {
|
|
1238
|
+
const queue = [...this._ctaQueue];
|
|
1239
|
+
this._ctaQueue = [];
|
|
1240
|
+
queue.forEach((item) => {
|
|
1241
|
+
if (!this.markedForDisposed) {
|
|
1242
|
+
handler(item.action, item.payload);
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
const listener = (e) => {
|
|
1247
|
+
var _a;
|
|
1248
|
+
const customEvent = e;
|
|
1249
|
+
if ((_a = customEvent.detail) == null ? void 0 : _a.action) {
|
|
1250
|
+
if (this._ctaHandler && !this.markedForDisposed) {
|
|
1251
|
+
this._ctaHandler(customEvent.detail.action, customEvent.detail.payload);
|
|
1252
|
+
} else if (!this._ctaHandler) {
|
|
1253
|
+
this._ctaQueue.push({
|
|
1254
|
+
action: customEvent.detail.action,
|
|
1255
|
+
payload: customEvent.detail.payload
|
|
1256
|
+
});
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
this.customElement.addEventListener("myop-cta", listener);
|
|
1261
|
+
this.ctaCleanup = () => {
|
|
1262
|
+
this.customElement.removeEventListener("myop-cta", listener);
|
|
1263
|
+
};
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1159
1267
|
// src/host/componentCore.ts
|
|
1160
1268
|
var createDebugTitle = (text, top, componentDefinitionConfig) => {
|
|
1161
1269
|
const titleEl = document.createElement("a");
|
|
@@ -1208,6 +1316,19 @@ var connectProps = (component, propsConfig, selectedSkin) => {
|
|
|
1208
1316
|
return false;
|
|
1209
1317
|
}
|
|
1210
1318
|
if (propConfig.behavior.type === PropConfigBehaviorTypes.code) {
|
|
1319
|
+
if (component instanceof MyopExtractedWebComponent) {
|
|
1320
|
+
const typedPropBehavior = propConfig.behavior;
|
|
1321
|
+
const propName = typedPropBehavior.remap || prop;
|
|
1322
|
+
if (propName === "myop_init_interface") {
|
|
1323
|
+
return (data) => {
|
|
1324
|
+
if (data === void 0) {
|
|
1325
|
+
return component.getData();
|
|
1326
|
+
}
|
|
1327
|
+
component.initWithData(data);
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
return void 0;
|
|
1331
|
+
}
|
|
1211
1332
|
if (selectedSkin.loader.type === SkinLoaders.HTMLLoader) {
|
|
1212
1333
|
const typedLoader = selectedSkin.loader;
|
|
1213
1334
|
if (typedLoader.shadowRootMode === ShadowRootModeType.localFrame) {
|
|
@@ -1242,6 +1363,18 @@ var connectProps = (component, propsConfig, selectedSkin) => {
|
|
|
1242
1363
|
return false;
|
|
1243
1364
|
}
|
|
1244
1365
|
if (propConfig.behavior.type === PropConfigBehaviorTypes.code) {
|
|
1366
|
+
if (component instanceof MyopExtractedWebComponent) {
|
|
1367
|
+
const typedPropBehavior = propConfig.behavior;
|
|
1368
|
+
const propName = typedPropBehavior.remap || prop;
|
|
1369
|
+
if (propName === "myop_cta_handler") {
|
|
1370
|
+
component.setCtaHandler(value);
|
|
1371
|
+
return true;
|
|
1372
|
+
}
|
|
1373
|
+
if (propName === "myop_init_interface") {
|
|
1374
|
+
component.initWithData(value);
|
|
1375
|
+
return true;
|
|
1376
|
+
}
|
|
1377
|
+
}
|
|
1245
1378
|
if (selectedSkin.loader.type === SkinLoaders.HTMLLoader) {
|
|
1246
1379
|
const typedLoader = selectedSkin.loader;
|
|
1247
1380
|
if (typedLoader.shadowRootMode === ShadowRootModeType.localFrame) {
|
|
@@ -1818,93 +1951,7 @@ var WebcomponentLoader = class extends BaseMyopLoader {
|
|
|
1818
1951
|
};
|
|
1819
1952
|
|
|
1820
1953
|
// version:myop-sdk-version
|
|
1821
|
-
var myop_sdk_version_default = "0.3.
|
|
1822
|
-
|
|
1823
|
-
// src/host/components/myopExtractedWebComponent.ts
|
|
1824
|
-
var MyopExtractedWebComponent = class extends BaseMyopComponent {
|
|
1825
|
-
constructor(componentDefinition, skin, container, customElement, tagName, options) {
|
|
1826
|
-
super(componentDefinition, container, options);
|
|
1827
|
-
this.container = container;
|
|
1828
|
-
this.customElement = customElement;
|
|
1829
|
-
this.tagName = tagName;
|
|
1830
|
-
__publicField(this, "ctaCleanup");
|
|
1831
|
-
__publicField(this, "cleanupInspect", () => {
|
|
1832
|
-
});
|
|
1833
|
-
/**
|
|
1834
|
-
* For compatibility with message-based components.
|
|
1835
|
-
* Web components don't use postMessage, so this is a no-op for most messages.
|
|
1836
|
-
*/
|
|
1837
|
-
__publicField(this, "send", (message) => {
|
|
1838
|
-
const cleanupHandler = super.send(message);
|
|
1839
|
-
console.debug("[MyopExtractedWebComponent] send() called - web components use direct API instead", message);
|
|
1840
|
-
return cleanupHandler;
|
|
1841
|
-
});
|
|
1842
|
-
__publicField(this, "dispose", () => {
|
|
1843
|
-
var _a;
|
|
1844
|
-
if (this.ctaCleanup) {
|
|
1845
|
-
this.ctaCleanup();
|
|
1846
|
-
}
|
|
1847
|
-
super.dispose();
|
|
1848
|
-
(_a = this.customElement.parentNode) == null ? void 0 : _a.removeChild(this.customElement);
|
|
1849
|
-
});
|
|
1850
|
-
this.element = customElement;
|
|
1851
|
-
this.setInitiated();
|
|
1852
|
-
}
|
|
1853
|
-
inspect() {
|
|
1854
|
-
this.cleanupInspect = setDebugStyle(this.id, "MyopExtractedWebComponent", 0, this.container, this.customElement, this.componentDefinition);
|
|
1855
|
-
return this.cleanupInspect;
|
|
1856
|
-
}
|
|
1857
|
-
hide() {
|
|
1858
|
-
this.customElement.style.opacity = "0";
|
|
1859
|
-
this.customElement.style.position = "absolute";
|
|
1860
|
-
this.customElement.style.pointerEvents = "none";
|
|
1861
|
-
this.customElement.style.visibility = "hidden";
|
|
1862
|
-
this.customElement.style.height = "0";
|
|
1863
|
-
this.customElement.style.width = "0";
|
|
1864
|
-
}
|
|
1865
|
-
show() {
|
|
1866
|
-
this.customElement.style.opacity = "1";
|
|
1867
|
-
this.customElement.style.position = "unset";
|
|
1868
|
-
this.customElement.style.pointerEvents = "all";
|
|
1869
|
-
this.customElement.style.visibility = "visible";
|
|
1870
|
-
this.customElement.style.height = "";
|
|
1871
|
-
this.customElement.style.width = "";
|
|
1872
|
-
}
|
|
1873
|
-
/**
|
|
1874
|
-
* Initialize the component with data by calling myop_init_interface directly
|
|
1875
|
-
*/
|
|
1876
|
-
initWithData(data) {
|
|
1877
|
-
if (typeof this.customElement.myop_init_interface === "function") {
|
|
1878
|
-
this.customElement.myop_init_interface(data);
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
/**
|
|
1882
|
-
* Get current data from the component
|
|
1883
|
-
*/
|
|
1884
|
-
getData() {
|
|
1885
|
-
if (typeof this.customElement.myop_init_interface === "function") {
|
|
1886
|
-
return this.customElement.myop_init_interface();
|
|
1887
|
-
}
|
|
1888
|
-
return void 0;
|
|
1889
|
-
}
|
|
1890
|
-
/**
|
|
1891
|
-
* Set up CTA handler to listen for myop-cta events
|
|
1892
|
-
*/
|
|
1893
|
-
onCta(handler) {
|
|
1894
|
-
const listener = (e) => {
|
|
1895
|
-
const customEvent = e;
|
|
1896
|
-
if (customEvent.detail && customEvent.detail.action) {
|
|
1897
|
-
handler(customEvent.detail.action, customEvent.detail.payload);
|
|
1898
|
-
}
|
|
1899
|
-
};
|
|
1900
|
-
this.customElement.addEventListener("myop-cta", listener);
|
|
1901
|
-
const cleanup = () => {
|
|
1902
|
-
this.customElement.removeEventListener("myop-cta", listener);
|
|
1903
|
-
};
|
|
1904
|
-
this.ctaCleanup = cleanup;
|
|
1905
|
-
return cleanup;
|
|
1906
|
-
}
|
|
1907
|
-
};
|
|
1954
|
+
var myop_sdk_version_default = "0.3.16";
|
|
1908
1955
|
|
|
1909
1956
|
// src/webcomponent/messageHandlers/BaseWebComponentMessageHandler.ts
|
|
1910
1957
|
var BaseWebComponentMessageHandler = class extends BaseContextMessageHandler {
|